You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Jukkales <sh...@nodch.de> on 2013/04/09 14:42:06 UTC

Several problems while deploying

Hi there, me again

i have several problems while deploying a webapp. This EAR contains an WAR
(the webapp itself) and 1+n JAR Modules which contains JPA Entites, CDI
Beans and maybe EJBs. I found some strange things about the WAR File...

I have attached a Test project. On two problems a dont have any idea which
cause it.

1. ClassNotFoundException on OpenJPA while enhancing entites



It seams that openjpa misses some classes and this only happens if the
entites are in the WAR file. If there are inside of an JAR Module, i put
them as <jar-file> in persistence.xml and every thing is okay. Define the
classes from the WAR File with <class> dose NOT work for me.

Also i have a Question about the placement of the persistence.xml file. To
get JPA working i have to place it in WEB-INF/persistence.xml of the WAR
file. But the specification say it needs to be in
WEB-INF/classes/META-INF/persistence.xml


2. CDI is unable to Inject inside an Interceptor



I dont have any idea why this happens because of this:


On the first run through the code everything is fine. On the second run the
API type is not found anymore. I saw this while debugging.



TomEE 1.5.1 dose not execute CDI Extensions, in 1.5.2/1.6.0 this is fine.

Is something wrong with the way i try this? One problem is followed by an
other.

Thanks for help.


Test project here:
just mvn install
test.7z <http://openejb.979440.n4.nabble.com/file/n4662131/test.7z>  





--
View this message in context: http://openejb.979440.n4.nabble.com/Several-problems-while-deploying-tp4662131.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: Several problems while deploying

Posted by Jukkales <sh...@nodch.de>.
Thanks, this works perfect now :)

But this wasn't the last error i have :( Got also an error with cdi events:

*Service class*


*ObserverClass*


*Call with*


The observer dose not observe custom events.


And i have two Questions:

1. Is there a planned release date for 1.6.0? :)
2. Inside a CDI extension i observe /ProcessAnnotatedType<?>/ to get all
existing classes. All types i get there are classes which are inside the
war. I do not get any class in a dependency jar which contains CDI beans,
too. Is this normal? 



--
View this message in context: http://openejb.979440.n4.nabble.com/Several-problems-while-deploying-tp4662131p4662196.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: Several problems while deploying

Posted by Romain Manni-Bucau <rm...@gmail.com>.
was a bug (https://issues.apache.org/jira/browse/TOMEE-893)

will be fixed with tomorrow snapshot

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/4/10 Jukkales <sh...@nodch.de>

> i thought that too but for example this wont work too:
>
>
>
> So the PersistenceUnit is not injected.
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Several-problems-while-deploying-tp4662131p4662145.html
> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>

Re: Several problems while deploying

Posted by Jukkales <sh...@nodch.de>.
i thought that too but for example this wont work too:



So the PersistenceUnit is not injected.



--
View this message in context: http://openejb.979440.n4.nabble.com/Several-problems-while-deploying-tp4662131p4662145.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: Several problems while deploying

Posted by Romain Manni-Bucau <rm...@gmail.com>.
i think your issue is simply
the foo.bar.test.producers.EntityManagerFactoryProducer is not created at
all (it is done lazily and since you don't have any method it is not done i
think)

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/4/10 Jukkales <sh...@nodch.de>

> Yes, its using @PersistenceUnit and it is not excluded. Wen i create a
> get-method with @Produces instead of type it on the field, it will be
> called, but the field annotated with @PersistenceUnit is null every time.
>
>
>
> The structure is:
>
>
> The Datasource is a simple Oracle one, which is linked in persistence.xml
>
>
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Several-problems-while-deploying-tp4662131p4662143.html
> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>

Re: Several problems while deploying

Posted by Jukkales <sh...@nodch.de>.
Yes, its using @PersistenceUnit and it is not excluded. Wen i create a
get-method with @Produces instead of type it on the field, it will be
called, but the field annotated with @PersistenceUnit is null every time.



The structure is:


The Datasource is a simple Oracle one, which is linked in persistence.xml






--
View this message in context: http://openejb.979440.n4.nabble.com/Several-problems-while-deploying-tp4662131p4662143.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: Several problems while deploying

Posted by Romain Manni-Bucau <rm...@gmail.com>.
I dont have the code anymore (on my phone) but using @PersistenceUnit
should be fine, it just needs to be scanned (not in exclusions.list).
 Le 9 avr. 2013 20:25, "Jukkales" <sh...@nodch.de> a écrit :

> Ah cool it is almost working. but the EntityManagerFactory is still not
> created. Maybe a configuration problem?
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Several-problems-while-deploying-tp4662131p4662138.html
> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>

Re: Several problems while deploying

Posted by Jukkales <sh...@nodch.de>.
Ah cool it is almost working. but the EntityManagerFactory is still not
created. Maybe a configuration problem?



--
View this message in context: http://openejb.979440.n4.nabble.com/Several-problems-while-deploying-tp4662131p4662138.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: Several problems while deploying

Posted by Romain Manni-Bucau <rm...@gmail.com>.
i tested with the snapshot

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/4/9 Jukkales <sh...@nodch.de>

> Ah okay, i missed it that it needs to be in that folder.
>
> But really? Which version you are using exactly? I still get the error that
> OpenJPA cannot load entities which are inside the JAR.
>
> You may have a look to the test/common package. There you will find two
> producers. EntityManagerFactoryProducer and EntityManagerProducer. The
> EntityManagerProducer is called right, but the factory is not created so a
> nullpointer will result. Dose this happens because the producers are in the
> jar, but the persistence.xml is in the war?
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Several-problems-while-deploying-tp4662131p4662135.html
> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>

Re: Several problems while deploying

Posted by Jukkales <sh...@nodch.de>.
Ah okay, i missed it that it needs to be in that folder.

But really? Which version you are using exactly? I still get the error that
OpenJPA cannot load entities which are inside the JAR.

You may have a look to the test/common package. There you will find two
producers. EntityManagerFactoryProducer and EntityManagerProducer. The
EntityManagerProducer is called right, but the factory is not created so a
nullpointer will result. Dose this happens because the producers are in the
jar, but the persistence.xml is in the war?  



--
View this message in context: http://openejb.979440.n4.nabble.com/Several-problems-while-deploying-tp4662131p4662135.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: Several problems while deploying

Posted by Romain Manni-Bucau <rm...@gmail.com>.
seems to work here, just take care to put beans.xml in META-INF for jar and
not WEB-INF

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/4/9 Jukkales <sh...@nodch.de>

> Hi there, me again
>
> i have several problems while deploying a webapp. This EAR contains an WAR
> (the webapp itself) and 1+n JAR Modules which contains JPA Entites, CDI
> Beans and maybe EJBs. I found some strange things about the WAR File...
>
> I have attached a Test project. On two problems a dont have any idea which
> cause it.
>
> 1. ClassNotFoundException on OpenJPA while enhancing entites
>
>
>
> It seams that openjpa misses some classes and this only happens if the
> entites are in the WAR file. If there are inside of an JAR Module, i put
> them as <jar-file> in persistence.xml and every thing is okay. Define the
> classes from the WAR File with <class> dose NOT work for me.
>
> Also i have a Question about the placement of the persistence.xml file. To
> get JPA working i have to place it in WEB-INF/persistence.xml of the WAR
> file. But the specification say it needs to be in
> WEB-INF/classes/META-INF/persistence.xml
>
>
> 2. CDI is unable to Inject inside an Interceptor
>
>
>
> I dont have any idea why this happens because of this:
>
>
> On the first run through the code everything is fine. On the second run the
> API type is not found anymore. I saw this while debugging.
>
>
>
> TomEE 1.5.1 dose not execute CDI Extensions, in 1.5.2/1.6.0 this is fine.
>
> Is something wrong with the way i try this? One problem is followed by an
> other.
>
> Thanks for help.
>
>
> Test project here:
> just mvn install
> test.7z <http://openejb.979440.n4.nabble.com/file/n4662131/test.7z>
>
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Several-problems-while-deploying-tp4662131.html
> Sent from the OpenEJB Dev mailing list archive at Nabble.com.
>