|
Hello,
we're injecting TransactionSynchronizationRegistry in some error
handling path in our application:
@Resource
private TransactionSynchronizationRegistry
transactionSynchronizationRegistry;
What we do is that we store some meta-data which is valid for the
SQL transaction scope in that registry, so that if there is an error
down the line, we can tie the error to this meta-data. And this works
fine but after days of running a production workload, we get errors
because this injection fails.
We get this error concurrently on multiple threads:
17-Jun-2020 10:54:53.809 WARNING [managed-thread-18]
org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties
Injection data not found in JNDI context:
jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry',
target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry17-Jun-2020
10:54:53.810 WARNING [managed-thread-8]
org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties
Injection data not found in JNDI context:
jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry',
target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
17-Jun-2020 10:54:53.810 WARNING [managed-thread-16]
org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties
Injection data not found in JNDI context:
jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry',
target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
17-Jun-2020 10:54:53.809 WARNING [managed-thread-7]
org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties
Injection data not found in JNDI context:
jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry',
target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
17-Jun-2020 10:54:53.811 WARNING [managed-thread-16]
org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties
Injection data not found in JNDI context:
jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry',
target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
17-Jun-2020 10:54:53.812 INFO [managed-thread-16]
com.littransit.rabbitmq.RabbitChangesPublisher.handleEventInternal em:
org.apache.openejb.persistence.JtaEntityManager@619cca3f - managed-thread-16
17-Jun-2020 10:54:53.812 WARNING [managed-thread-10]
org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties
Injection data not found in JNDI context:
jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry',
target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
17-Jun-2020 10:54:53.812 WARNING [managed-thread-18]
org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties
Injection data not found in JNDI context:
jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry',
target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
And very shortly afterwards:
17-Jun-2020 10:54:53.814 SEVERE [managed-thread-16]
com.littransit.rabbitmq.RabbitChangesPublisher.handleEventInternal
Failed publishing rabbit message
java.lang.NullPointerException
at
com.littransit.rabbitmq.RabbitChangesPublisher.writeRabbitOutboxAccountItem(RabbitChangesPublisher.java:50)
And this is a NPE reading the transactionSynchronizationRegistry
injected field.
Shortly afterwards we see this issue again in other managed threads:
17-Jun-2020 10:54:53.836 WARNING [managed-thread-12]
org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties
Injection data not found in JNDI context:
jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry',
target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
17-Jun-2020 10:54:53.843 WARNING [managed-thread-12]
org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties
Injection data not found in JNDI context:
jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry',
target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
17-Jun-2020 10:54:53.844 WARNING [managed-thread-19]
org.apache.openejb.cdi.CdiResourceInjectionService.fillInjectionProperties
Injection data not found in JNDI context:
jndiName='comp/env/com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry',
target=com.littransit.rabbitmq.RabbitChangesPublisher/transactionSynchronizationRegistry
This is happening in managed threads that we instanciated with:
@Resource
private ManagedThreadFactory factory;
Then factory.newThread(...).
We do not understand how come @Resource
TransactionSynchronizationRegistry works, until it doesn't. We are using
TOMEE 8.0.1 on java11. Is there something we're doing wrong, or do you
have any advice?
Regards,
Emmanuel
|