2016-11-18 10:10 GMT+01:00 Emmanuel Touzery <[email protected]>
:

> Hello,
>
>     thank you. Darjan is my colleague, I can confirm both solutions solve
> the issue.
>
>     May I ask... My understanding is that tomee.jpa.cdi=false is the 7.0.1
> behaviour (which worked fine for us), while "tomee.jpa.factory.lazy=true"
> is a "trick" to avoid the problem we've just hit while enabling a new
> feature.
>
>
This is true. This is a "trick" for the JPA provider doing eager JPA lookup
of listeners etc where the spec kind of require it to be lazy to work.
Hibernate is part of this category.


>     So for us, cdi=false is a safe, known state, while lazy=true could be
> risky (from what I understand, there could be problems if hibernate
> attempts to make use of CDI in the early startup?). But then if lazy=true
> is the "future" and it's likely hibernate will make use or require the
> feature in the future, it's probably best to go that way?
>
>
Both should be fine but hibernate will be initialize later with the lazy
option which can make one request slow at the beginning depending the
application.


>     Can you tell us more about the compromise here?
>
>
If you dont care of JPA/CDI integration first one is enough, if you need it
then you need second one.


>     Thank you!
>
> Emmanuel
>
>
> On 18/11/16 09:43, Romain Manni-Bucau wrote:
>
>> Hello
>>
>> You can disable cdi for hibernate tomee.jpa.cdi=false in the persistence
>> unit or system properties.
>>
>> If you want it - was not part if 7.0.1 - you can in the same locations set
>> tomee.jpa.factory.lazy to true.
>>
>> Idea is to let hibernate initialize ince cdi is started but let cdi have
>> jpa entity manager or factory - yes chicken egg problem but spec is
>> written
>> this way ;).
>>
>> Le 18 nov. 2016 09:25, "Darjan Oblak" <[email protected]> a écrit :
>>
>> Hi,
>>>
>>> our app deployed successfully on 7.0.1, but fails on 7.0.2. However, the
>>> problem disappears if I replace lib/openejb-core-7.0.2.jar in tomee 7.0.2
>>> distribution by openejb-core-7.0.1.jar
>>>
>>> Any clues what could be the problem?
>>>
>>> The exception we get:
>>>
>>> Caused by: java.lang.IllegalStateException: On a thread without an
>>> initialized context nor a classloader mapping a deployed app
>>> at
>>> org.apache.openejb.cdi.ThreadSingletonServiceImpl.get(
>>> ThreadSingletonServiceImpl.java:287)
>>> at
>>> org.apache.openejb.cdi.ThreadSingletonServiceImpl.getContext(
>>> ThreadSingletonServiceImpl.java:263)
>>> at
>>> org.apache.openejb.cdi.ThreadSingletonServiceImpl.get(
>>> ThreadSingletonServiceImpl.java:298)
>>> at
>>> org.apache.openejb.cdi.ThreadSingletonServiceImpl.get(
>>> ThreadSingletonServiceImpl.java:60)
>>> at
>>> org.apache.webbeans.config.WebBeansFinder.getSingletonInstance(
>>> WebBeansFinder.java:51)
>>> at
>>> org.apache.webbeans.config.WebBeansContext.getInstance(
>>> WebBeansContext.java:185)
>>> at
>>> org.apache.webbeans.config.WebBeansContext.currentInstance(
>>> WebBeansContext.java:203)
>>> at
>>> org.apache.openejb.assembler.classic.EntityManagerFactoryCallable$
>>> 1.findBm(EntityManagerFactoryCallable.java:105)
>>> at
>>> org.apache.openejb.assembler.classic.EntityManagerFactoryCallable$
>>> 1.invoke(EntityManagerFactoryCallable.java:96)
>>> at com.sun.proxy.$Proxy121.createAnnotatedType(Unknown Source)
>>> at
>>> org.hibernate.jpa.event.internal.jpa.BeanManagerListenerFactory$
>>> BeanMetaData.<init>(BeanManagerListenerFactory.java:77)
>>> at
>>> org.hibernate.jpa.event.internal.jpa.BeanManagerListenerFactory$
>>> BeanMetaData.<init>(BeanManagerListenerFactory.java:71)
>>> at
>>> org.hibernate.jpa.event.internal.jpa.BeanManagerListenerFactory.
>>> buildListener(BeanManagerListenerFactory.java:57)
>>> at
>>> org.hibernate.jpa.event.internal.jpa.LegacyCallbackProcessor.
>>> resolveCallbacks(LegacyCallbackProcessor.java:167)
>>> at
>>> org.hibernate.jpa.event.internal.jpa.LegacyCallbackProcessor.
>>> processCallbacksForEntity(LegacyCallbackProcessor.java:70)
>>> at
>>> org.hibernate.jpa.event.spi.JpaIntegrator.integrate(
>>> JpaIntegrator.java:150)
>>> at
>>> org.hibernate.internal.SessionFactoryImpl.<init>(
>>> SessionFactoryImpl.java:312)
>>> at
>>> org.hibernate.cfg.Configuration.buildSessionFactory(
>>> Configuration.java:1859)
>>> at
>>> org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderI
>>> mpl$4.perform(
>>> EntityManagerFactoryBuilderImpl.java:852)
>>> at
>>> org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderI
>>> mpl$4.perform(
>>> EntityManagerFactoryBuilderImpl.java:845)
>>> at
>>> org.hibernate.boot.registry.classloading.internal.ClassLoade
>>> rServiceImpl.
>>> withTccl(ClassLoaderServiceImpl.java:398)
>>> at
>>> org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(
>>> EntityManagerFactoryBuilderImpl.java:844)
>>> at
>>> org.hibernate.jpa.HibernatePersistenceProvider.
>>> createContainerEntityManagerFactory(HibernatePersistenceProv
>>> ider.java:152)
>>> at
>>> org.apache.openejb.assembler.classic.EntityManagerFactoryCallable.call(
>>> EntityManagerFactoryCallable.java:122)
>>> at
>>> org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory
>>> .createDelegate(ReloadableEntityManagerFactory.java:134)
>>> ... 68 more
>>>
>>> Thank you,
>>> Best Regards,
>>> Darjan Oblak
>>>
>>>
>

Reply via email to