You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by pspyra <ps...@man.poznan.pl> on 2013/12/03 16:23:10 UTC

How to integrate liferay bundled with tomcat with tomee (openEJB)

I have liferay 6.1 bundled with tomcat 7 (already populated with some 
data from users, that's why I cannot switch to liferay bundled with 
glassfish) and now I'm trying to develope new portlet with persistence 
and the whole EJB stuff.
I found that there should be some way to integrate tomcat 7 with openEJB 
and that's my question - how can I do that?
Now I have liferay portlet project with maven dependency

<dependency>
    <groupId>org.apache.openejb</groupId>
    <artifactId>javaee-api</artifactId>
    <version>6.0-5</version>
</dependency>

and persistence.xml file

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit name="kepler_v1PU">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
     <properties>
       <property name="openjpa.ConnectionURL" 
value="jdbc:mysql://localhost:3306/kepler_v1"/>
       <property name="openjpa.ConnectionDriverName" 
value="com.mysql.jdbc.Driver"/>
       <property name="openjpa.ConnectionUserName" value="xyz"/>
       <property name="openjpa.ConnectionPassword" value="xyz"/>
       <property name="openjpa.Log" value="DefaultLevel=WARN, Tool=INFO"/>
     </properties>
   </persistence-unit>
</persistence>

And I'm still getting the error
javax.persistence.PersistenceException: No Persistence provider for 
EntityManager named kepler_v1PU

Do you have any idea how can I resolve this issue?
Maybe it's related with duplicated jars (for example there are 
liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/lib/ext/persistence.jar and 
liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/lib/annotations-api.jar with 
implementations of the class javax.persistence.Persistence).

Regards,
Piotrek Spyra.

Re: How to integrate liferay bundled with tomcat with tomee (openEJB)

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

You use a jta datasource with resource local config, is it intended?

Does liferay provides hibernate? If yes set <provider> in your persistence
unit
Le 3 déc. 2013 16:27, "pspyra" <ps...@man.poznan.pl> a écrit :

> I have liferay 6.1 bundled with tomcat 7 (already populated with some data
> from users, that's why I cannot switch to liferay bundled with glassfish)
> and now I'm trying to develope new portlet with persistence and the whole
> EJB stuff.
> I found that there should be some way to integrate tomcat 7 with openEJB
> and that's my question - how can I do that?
> Now I have liferay portlet project with maven dependency
>
> <dependency>
>    <groupId>org.apache.openejb</groupId>
>    <artifactId>javaee-api</artifactId>
>    <version>6.0-5</version>
> </dependency>
>
> and persistence.xml file
>
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
> <persistence-unit name="kepler_v1PU">
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</
> provider>
>     <properties>
>       <property name="openjpa.ConnectionURL" value="jdbc:mysql://localhost:
> 3306/kepler_v1"/>
>       <property name="openjpa.ConnectionDriverName"
> value="com.mysql.jdbc.Driver"/>
>       <property name="openjpa.ConnectionUserName" value="xyz"/>
>       <property name="openjpa.ConnectionPassword" value="xyz"/>
>       <property name="openjpa.Log" value="DefaultLevel=WARN, Tool=INFO"/>
>     </properties>
>   </persistence-unit>
> </persistence>
>
> And I'm still getting the error
> javax.persistence.PersistenceException: No Persistence provider for
> EntityManager named kepler_v1PU
>
> Do you have any idea how can I resolve this issue?
> Maybe it's related with duplicated jars (for example there are
> liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/lib/ext/persistence.jar and
> liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/lib/annotations-api.jar with
> implementations of the class javax.persistence.Persistence).
>
> Regards,
> Piotrek Spyra.
>

Re: How to integrate liferay bundled with tomcat with tomee (openEJB)

Posted by pspyra <ps...@man.poznan.pl>.
Hi Romain,

Thanks for your answer and sorry that I left this thread for a long time.
I already solved my problem by adding openejb-core to the project

<dependency>
	<groupId>org.apache.openejb</groupId>
	<artifactId>openejb-core</artifactId>
	<version>4.5.0</version>
</dependency>

I'm not subscribed on tomee mailing list, but I hope you will find this 
asnwer.
Regards,
Piotrek.

03.12.2013 16:23, pspyra:
> I have liferay 6.1 bundled with tomcat 7 (already populated with some 
> data from users, that's why I cannot switch to liferay bundled with 
> glassfish) and now I'm trying to develope new portlet with persistence 
> and the whole EJB stuff.
> I found that there should be some way to integrate tomcat 7 with 
> openEJB and that's my question - how can I do that?
> Now I have liferay portlet project with maven dependency
>
> <dependency>
>    <groupId>org.apache.openejb</groupId>
>    <artifactId>javaee-api</artifactId>
>    <version>6.0-5</version>
> </dependency>
>
> and persistence.xml file
>
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
> <persistence-unit name="kepler_v1PU">
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>     <properties>
>       <property name="openjpa.ConnectionURL" 
> value="jdbc:mysql://localhost:3306/kepler_v1"/>
>       <property name="openjpa.ConnectionDriverName" 
> value="com.mysql.jdbc.Driver"/>
>       <property name="openjpa.ConnectionUserName" value="xyz"/>
>       <property name="openjpa.ConnectionPassword" value="xyz"/>
>       <property name="openjpa.Log" value="DefaultLevel=WARN, Tool=INFO"/>
>     </properties>
>   </persistence-unit>
> </persistence>
>
> And I'm still getting the error
> javax.persistence.PersistenceException: No Persistence provider for 
> EntityManager named kepler_v1PU
>
> Do you have any idea how can I resolve this issue?
> Maybe it's related with duplicated jars (for example there are 
> liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/lib/ext/persistence.jar and 
> liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/lib/annotations-api.jar with 
> implementations of the class javax.persistence.Persistence).
>
> Regards,
> Piotrek Spyra.