It's an integration issue with camel-cdi triggering the init too early,
making it lazy works


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-07-29 23:54 GMT+02:00 Shultz, Dmitry <[email protected]>:

> BTW, here is how the same section of log file looks when app is
> successfully deployed on running TomEE:
>
> 2016-07-29 14:33:00,420 [http-nio-7080-exec-5] INFO JpaComponent.java 134
> | Using EntityManagerFactory configured:
> org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory@5566ceee
> 2016-07-29 14:33:00,452 [http-nio-7080-exec-5] INFO
> JtaTransactionManager.java 490 | Using JTA UserTransaction:
> org.apache.openejb.resource.GeronimoTransactionManagerFactory$DestroyableTransactionManager@609724e1
> 2016-07-29 14:33:00,452 [http-nio-7080-exec-5] INFO
> JtaTransactionManager.java 501 | Using JTA TransactionManager:
> org.apache.openejb.resource.GeronimoTransactionManagerFactory$DestroyableTransactionManager@609724e1
> 2016-07-29 14:33:00,453 [http-nio-7080-exec-5] INFO
> JtaTransactionManager.java 535 | Using JTA
> TransactionSynchronizationRegistry:
> org.apache.openejb.resource.GeronimoTransactionManagerFactory$DestroyableTransactionManager@609724e1
> 2016-07-29 14:33:00,453 [http-nio-7080-exec-5] INFO AppProducers.java 60 |
> jtaTransactionManager produced
> 2016-07-29 14:33:00,453 [http-nio-7080-exec-5] INFO JpaComponent.java 143
> | Using TransactionManager found in registry with id
> [jtaTransactionManager]
> org.springframework.transaction.jta.JtaTransactionManager@5c44ab46
> 2016-07-29 14:33:00,688 [http-nio-7080-exec-5] INFO
> JtaTransactionManager.java 490 | Using JTA UserTransaction:
> org.apache.openejb.resource.GeronimoTransactionManagerFactory$DestroyableTransactionManager@609724e1
> 2016-07-29 14:33:00,688 [http-nio-7080-exec-5] INFO
> JtaTransactionManager.java 501 | Using JTA TransactionManager:
> org.apache.openejb.resource.GeronimoTransactionManagerFactory$DestroyableTransactionManager@609724e1
> 2016-07-29 14:33:00,689 [http-nio-7080-exec-5] INFO
> JtaTransactionManager.java 535 | Using JTA
> TransactionSynchronizationRegistry:
> org.apache.openejb.resource.GeronimoTransactionManagerFactory$DestroyableTransactionManager@609724e1
> 2016-07-29 14:33:00,689 [http-nio-7080-exec-5] INFO AppProducers.java 60 |
> jtaTransactionManager produced
>
> For some reason  jtaTransactionManager producer called twice, but it works.
>
>
> -----Original Message-----
> From: Shultz, Dmitry [mailto:[email protected]]
> Sent: July-29-16 2:46 PM
> To: [email protected]
> Subject: RE: Camel JPA + JTA Transaction (TomEE)
>
> Romain,
>
> TransactionManager  is never injected in my case (and yes, - I removed
> parameters from producer).
>
> I'm having some strange problems with UserTransaction as well. It works
> when I'm deploying the app on the already running TpomEE, but fails when
> TomEE is restarted with the app deployed.
> Here is the exception (it is injected in the AppProducers class):
>
> 14:33| INFO | ManagedManagementStrategy.java 191 | JMX is enabled 14:33|
> INFO | DefaultTypeConverter.java 56 | Loaded 185 type converters 14:33|
> INFO | DefaultRuntimeEndpointRegistry.java 203 | Runtime endpoint registry
> is in extended mode gathering usage statistics of all incoming and outgoing
> endpoints (cache limit: 1000) 14:33| INFO | JpaComponent.java 134 | Using
> EntityManagerFactory configured:
> org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory@56744adf
> WARNING - Injection data not found in JNDI context:
> jndiName='comp/env/com.company.mix.wosess.camel.AppProducers/userTransaction',
> target=com. company.mix.wosess.camel.AppProducers/userTransaction
> 14:33| INFO | DefaultCamelContext.java 3066 | Apache Camel 2.17.2
> (CamelContext: event-storage-service) is shutting down 14:33| INFO |
> DefaultCamelContext.java 3151 | Apache Camel 2.17.2 (CamelContext:
> event-storage-service) uptime 0.245 seconds 14:33| INFO |
> DefaultCamelContext.java 3152 | Apache Camel 2.17.2 (CamelContext:
> event-storage-service) is shutdown in 0.005 seconds SEVERE - No JTA
> UserTransaction available - specify either 'userTransaction' or
> 'userTransactionName' or 'transactionManager' or 'transactionManagerName'
> java.lang.IllegalStateException: No JTA UserTransaction available -
> specify either 'userTransaction' or 'userTransactionName' or
> 'transactionManager' or 'transactionManagerName'
>         at
> org.springframework.transaction.jta.JtaTransactionManager.checkUserTransactionAndTransactionManager(JtaTransactionManager.java:494)
>         at
> org.springframework.transaction.jta.JtaTransactionManager.afterPropertiesSet(JtaTransactionManager.java:436)
>         at
> com.kaltire.mix.wosess.camel.AppProducers.createTransactionManager(AppProducers.java:58)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:497)
>         at
> org.apache.webbeans.inject.InjectableMethod.doInjection(InjectableMethod.java:155)
>         at
> org.apache.webbeans.portable.ProducerMethodProducer.produce(ProducerMethodProducer.java:89)
>         at
> org.apache.webbeans.portable.AbstractProducer.produce(AbstractProducer.java:172)
>         at
> org.apache.webbeans.component.AbstractOwbBean.create(AbstractOwbBean.java:122)
>         at
> org.apache.webbeans.component.ProducerMethodBean.create(ProducerMethodBean.java:95)
>         at
> org.apache.webbeans.context.DependentContext.getInstance(DependentContext.java:68)
>         at
> org.apache.webbeans.context.AbstractContext.get(AbstractContext.java:125)
>         at
> org.apache.webbeans.container.BeanManagerImpl.getReference(BeanManagerImpl.java:789)
>         at
> org.apache.webbeans.container.InjectableBeanManager.getReference(InjectableBeanManager.java:165)
>         at
> org.apache.camel.cdi.BeanManagerHelper.getReference(BeanManagerHelper.java:56)
>         at
> org.apache.camel.cdi.CdiCamelRegistry.findByTypeWithName(CdiCamelRegistry.java:71)
>         at
> org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.findByTypeWithName(PropertyPlaceholderDelegateRegistry.java:70)
>         at
> org.apache.camel.component.jpa.JpaComponent.doStart(JpaComponent.java:139)
>
> How to make it to support TomEE restart?
>
> Cheers,
> Dmitry
>
>
> -----Original Message-----
> From: Romain Manni-Bucau [mailto:[email protected]]
> Sent: July-29-16 1:35 PM
> To: [email protected]
> Subject: Re: Camel JPA + JTA Transaction (TomEE)
>
> Normally no,
>
> @Resource
> private TransactionManager transactionManager;
>
> or with a specified name if you prefer
>
> @Resource(name = "java:comp/TransactionManager") // or
> java:comp/env/comp/TransactionManager for some older tomee versions private
> TransactionManager transactionManager;
>
>
> work to get injected by TomEE the transaction manager.
>
> Did you remove the parameters from your producer?
>
> Just a new JtaTransactionManager() without any configuration should also
> work relying on defaults of spring.
>
> The unsatisfied exception you get is cause spring is scanned as a EE
> library and does a @Inject TransactionManager mgr;. Just add in
> conf.exclusions.list:
>
> default-list
> spring-
>
> and it should work
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog <
> https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog <
> http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau>
> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber <
> http://www.tomitribe.com> | JavaEE Factory <
> https://javaeefactory-rmannibucau.rhcloud.com>
>
> 2016-07-29 20:17 GMT+02:00 dimas <[email protected]>:
>
> > Is there anything else i need to do besides just reference it as
> @Resource?
> > It's still 'null'
> >
> >
> >
> > --
> > View this message in context:
> > http://camel.465427.n5.nabble.com/Camel-JPA-JTA-Transaction-TomEE-tp57
> > 85642p5785653.html Sent from the Camel - Users mailing list archive at
> > Nabble.com.
> >
>

Reply via email to