Showing results for 
Search instead for 
Did you mean: 

Hybris DB-connection or RelationInvalidationListener errors after Update to 2205

0 Kudos

We started getting a lot of errors in integration tests that use impex scripts and the importCsv() method after updating Hybris to version 2205. Especially for tear down impex scripts that are imported in the @After method.

It also seems that junit tenat initialization (by yunitinit command) helps solve the problem, but only for one test case. So maybe there is a table in the database that needs to be cleared before running the test?

This does not affect the execution of tests, but it makes it very difficult to read the logs.

Please share your experience with this problem. I found a similar question here, but unfortunately without answers.

Full error stack trace in attached file transaction-invalidation-error.txt.

Short stack trace below:

ERROR [hybrisHTTP14] (junit) [InvalidationTopic] unexpected error invalidating InvalidationTopic[hjmp, entity] via listener de.hybris.platform.cache.relation.RelationInvalidationListener@a867b41asked
java.lang.IllegalStateException: The transaction is performing invalidatins after commit / rollback. You cannot access the database in this phase.
        at de.hybris.platform.tx.Transaction.getTXBoundConnection( ~[coreserver.jar:?]
        at de.hybris.platform.jdbcwrapper.DataSourceImpl.getFromPool( ~[coreserver.jar:?]
        at de.hybris.platform.jdbcwrapper.DataSourceImpl.doGetConnection( ~[coreserver.jar:?]
        at de.hybris.platform.jdbcwrapper.DataSourceImpl.getConnection( ~[coreserver.jar:?]
        at de.hybris.platform.jdbcwrapper.DataSourceImpl.getConnection( ~[coreserver.jar:?]
        at de.hybris.platform.persistence.type.ComposedType_HJMPWrapper$FindByTypeCode1FinderResult.getFromDatabase( ~[coreserver.jar:?]
        at de.hybris.platform.persistence.type.ComposedType_HJMPWrapper$FindByTypeCode1FinderResult.compute( ~[coreserver.jar:?]
        at de.hybris.platform.cache.AbstractCacheUnit.privateGetNoLock( ~[coreserver.jar:?]
        at de.hybris.platform.cache.AbstractCacheUnit.privateGet( ~[coreserver.jar:?]
        at de.hybris.platform.cache.AbstractCacheUnit.get( ~[coreserver.jar:?]
        at de.hybris.platform.persistence.type.ComposedType_HJMPWrapper$FindByTypeCode1FinderResult.getFinderResult( ~[coreserver.jar:?]
        at de.hybris.platform.persistence.type.ComposedType_HJMPWrapper.ejbFindByTypeCode( ~[coreserver.jar:?]
        at jdk.internal.reflect.GeneratedMethodAccessor407.invoke(Unknown Source) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke( ~[?:?]
        at java.lang.reflect.Method.invoke( ~[?:?]
        at de.hybris.platform.util.Utilities.callMethod( ~[coreserver.jar:?]
        at de.hybris.platform.util.Utilities.callMethod( ~[coreserver.jar:?]
        at de.hybris.platform.persistence.framework.HomeInvocationHandler.invokeMethod( ~[coreserver.jar:?]
        at de.hybris.platform.persistence.framework.HomeInvocationHandler.invoke( ~[coreserver.jar:?]
        at jdk.proxy2.$Proxy25.findByTypeCode(Unknown Source) ~[?:?]
        at de.hybris.platform.persistence.type.TypeManagerEJB.getRootComposedType( ~[coreserver.jar:?]
        at de.hybris.platform.jalo.type.TypeManager.getRootComposedType( ~[coreserver.jar:?]
        at de.hybris.platform.cache.relation.TypePKsExtractor.getTypePKs( ~[coreserver.jar:?]

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

So, after reading the documentation, I found a couple of ways that work in some cases:

- I tried adding the @Transactional annotation as mentioned in the TransactionRunListener documentation (here) and it seems to have fixed the bug:

"Listener which will start a transaction before each test and will rollback it when test is finished"

But I'm not sure about this. Because documentation says that extended class already managed transactions.

- We got a lot of errors because of "@After" method with tear-down scripts. And it seems like we can just remove tear-down scripts with After method, because transaction will rolled-back by the TransactionRunListener(as mentioned here)

- Also I tried to extend ServicelayerTest instead of ServicelayerTransactionalTest and it helped me too for another cases.

I would be grateful if you share the correct solution to this problem!

Answers (0)