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.

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?

    Can you tell us more about the compromise here?

    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.EntityManagerFactoryBuilderImpl$4.perform(
EntityManagerFactoryBuilderImpl.java:852)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(
EntityManagerFactoryBuilderImpl.java:845)
at
org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.
withTccl(ClassLoaderServiceImpl.java:398)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(
EntityManagerFactoryBuilderImpl.java:844)
at
org.hibernate.jpa.HibernatePersistenceProvider.
createContainerEntityManagerFactory(HibernatePersistenceProvider.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