You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by "Ueberbach, Michael" <mi...@dbh.de> on 2007/03/28 12:28:25 UTC

How to deploy JPA?

Hello,

I need some help in finding out the right way to deploy an
ejb-application in Geronimo 2.0M3.
Szenario is as follows:
There is a connection-pool already deployed to an existing
MySQL-Database, let's say "MyTestPool".
The application has some entity beans and stateless session beans using
EJB3.0 annotations. I want to use JPA
for persistence.
Can someone give an example what way the mimimum persistence.xml and the
neccessary corresponding entries in the openejb-jar.xml
have to look like to get right connection between the application and
the connection-pool?

I've had already a look at the daytrader example (2.0M2-jpa-plan.xml),
but (if I got it right) this makes use of an ext-module
entry for the database connection. Is this really neccessary? How can I
describe a reference to my existing connection-pool?

Thanks for every hint.

Michael



AW: How to deploy JPA?

Posted by "Ueberbach, Michael" <mi...@dbh.de>.
Thanks for the help. I will try and report later.
Michael

________________________________

Von: David Jencks [mailto:david_jencks@yahoo.com] 
Gesendet: Mittwoch, 28. März 2007 14:24
An: user@geronimo.apache.org
Betreff: Re: How to deploy JPA?


Unless someone changed the code a lot while I wasn't looking I don't think that will work. 

 I think you need to 
(1) make sure your pool module is an ancestor of your ejb app: the easiest way is to make it a dependency in the geronimo plan for the ejb app.  This has the same effect as the "ext-module" in daytrader.
(2) assuming you do want jta :-) use <jta-data-source>MyTestPool</jta-data-source>  or <jta-data-source>name=MyTestPool</jta-data-source>


thanks
david jencks


On Mar 28, 2007, at 7:43 AM, David Carew wrote:


	You should be able to do it in your persistence.xml file. with the  <jta-data-source> element
	e.g. < jta-data-source>java:comp/env/MyTestPool</jta-data-source> 
	
	
	On 3/28/07, Ueberbach, Michael <mi...@dbh.de> wrote: 

		Hello, 

		I need some help in finding out the right way to deploy an ejb-application in Geronimo 2.0M3. 
		Szenario is as follows: 
		There is a connection-pool already deployed to an existing MySQL-Database, let's say "MyTestPool". 
		The application has some entity beans and stateless session beans using EJB3.0 annotations. I want to use JPA 
		for persistence. 
		Can someone give an example what way the mimimum persistence.xml and the neccessary corresponding entries in the openejb-jar.xml

		have to look like to get right connection between the application and the connection-pool? 

		I've had already a look at the daytrader example (2.0M2-jpa-plan.xml), but (if I got it right) this makes use of an ext-module

		entry for the database connection. Is this really neccessary? How can I describe a reference to my existing connection-pool?

		Thanks for every hint. 

		Michael 





AW: How to deploy JPA?

Posted by "Ueberbach, Michael" <mi...@dbh.de>.
Hello David,
 
meanwhile I have tried to deploy following your advices. Unfortunately I got a NPE from the class PersistenceUnitBuilder.
Here I put the stack trace, the used persistence.xml and openejb-jar.xml.
Is there something missing?
Thanks
Michael
 
22:04:47,798 ERROR [Deployer] Deployment failed due to 
java.lang.NullPointerException
 at org.apache.geronimo.persistence.builder.PersistenceUnitBuilder.buildPersistenceUnits(PersistenceUnitBuilder.java:115)
 at org.apache.geronimo.persistence.builder.PersistenceUnitBuilder.build(PersistenceUnitBuilder.java:107)
 at org.apache.geronimo.persistence.builder.PersistenceUnitBuilder$$FastClassByCGLIB$$e8dd93fa.invoke(<generated>)
 at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
 at org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
 at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:127)
 at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:820)
 at org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
 at org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperationInvoker.java:35)
 at org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(ProxyMethodInterceptor.java:96)
 at org.apache.geronimo.deployment.NamespaceDrivenBuilder$$EnhancerByCGLIB$$cce80b50.build(<generated>)
 at org.apache.geronimo.deployment.NamespaceDrivenBuilderCollection.build(NamespaceDrivenBuilderCollection.java:48)
 at org.apache.geronimo.openejb.deployment.EjbModuleBuilder.initContext(EjbModuleBuilder.java:452)
 at org.apache.geronimo.openejb.deployment.EjbModuleBuilder$$FastClassByCGLIB$$cd80af20.invoke(<generated>)
 at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
 at org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
 at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:127)
 at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:820)
 at org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
 at org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperationInvoker.java:35)
 at org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(ProxyMethodInterceptor.java:96)
 at org.apache.geronimo.j2ee.deployment.ModuleBuilder$$EnhancerByCGLIB$$209f25af.initContext(<generated>)
 at org.apache.geronimo.j2ee.deployment.EARConfigBuilder.buildConfiguration(EARConfigBuilder.java:539)
 at org.apache.geronimo.j2ee.deployment.EARConfigBuilder$$FastClassByCGLIB$$38e56ec6.invoke(<generated>)
 at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
 at org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
 at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:127)
 at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:820)
 at org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
 at org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperationInvoker.java:35)
 at org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(ProxyMethodInterceptor.java:96)
 at org.apache.geronimo.j2ee.deployment.CorbaGBeanNameSource$$EnhancerByCGLIB$$57cc9fc4.buildConfiguration(<generated>)
 at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:302)
 at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:124)
 at org.apache.geronimo.deployment.Deployer$$FastClassByCGLIB$$734a235d.invoke(<generated>)
 at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
 at org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
 at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:127)
 at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:855)
 at org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
 at org.apache.geronimo.deployment.plugin.local.AbstractDeployCommand.doDeploy(AbstractDeployCommand.java:114)
 at org.apache.geronimo.deployment.plugin.local.DistributeCommand.run(DistributeCommand.java:60)
 at java.lang.Thread.run(Thread.java:595)
  (...)
 
These are the persistence.xml and part of the openejb-jar.xml
 
<persistence>
    <persistence-unit name="StammdatenVerwaltung">
        <description>Zugriff auf Stammdaten</description>
        <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
        <jta-data-source>MySQLPool</jta-data-source>
    </persistence-unit>
</persistence>
 

<openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1" xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2">
  <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
    <dep:moduleId>
      <dep:groupId>lama</dep:groupId>
      <dep:artifactId>de.lama.sample3</dep:artifactId>
      <dep:version>1.0</dep:version>
      <dep:type>jar</dep:type>
    </dep:moduleId>
    <dep:dependencies>
      <dep:dependency>
          <dep:groupId>console.dbpool</dep:groupId>
          <dep:artifactId>MySQLPool</dep:artifactId>
          <dep:version>1.0</dep:version>
          <dep:type>rar</dep:type>
      </dep:dependency>
      <dep:dependency>
          <dep:groupId>aspectj</dep:groupId>
          <dep:artifactId>aspectjrt</dep:artifactId>
          <dep:version>1.5</dep:version>
          <dep:type>jar</dep:type>
      </dep:dependency>
      <dep:dependency>
          <dep:groupId>org.apache.geronimo.configs</dep:groupId>
          <dep:artifactId>openjpa</dep:artifactId>
          <dep:type>car</dep:type>
      </dep:dependency>
    </dep:dependencies>
    <dep:hidden-classes/>
    <dep:non-overridable-classes/>
  </dep:environment>
  <enterprise-beans>
    <session>
      <ejb-name>StammdatenExtFassadeBean</ejb-name>
      <jndi-name>ejb/StammdatenExtFassadeBean</jndi-name>
    </session>
  </enterprise-beans>
</openejb-jar>



________________________________

Von: David Jencks [mailto:david_jencks@yahoo.com] 
Gesendet: Mittwoch, 28. März 2007 14:24
An: user@geronimo.apache.org
Betreff: Re: How to deploy JPA?


Unless someone changed the code a lot while I wasn't looking I don't think that will work. 


 I think you need to 
(1) make sure your pool module is an ancestor of your ejb app: the easiest way is to make it a dependency in the geronimo plan for the ejb app.  This has the same effect as the "ext-module" in daytrader.
(2) assuming you do want jta :-) use <jta-data-source>MyTestPool</jta-data-source>  or <jta-data-source>name=MyTestPool</jta-data-source>



thanks
david jencks


On Mar 28, 2007, at 7:43 AM, David Carew wrote:


	You should be able to do it in your persistence.xml file. with the  <jta-data-source> element
	e.g. < jta-data-source>java:comp/env/MyTestPool</jta-data-source> 
	
	
	On 3/28/07, Ueberbach, Michael <mi...@dbh.de> wrote: 

		Hello, 

		I need some help in finding out the right way to deploy an ejb-application in Geronimo 2.0M3. 
		Szenario is as follows: 
		There is a connection-pool already deployed to an existing MySQL-Database, let's say "MyTestPool". 
		The application has some entity beans and stateless session beans using EJB3.0 annotations. I want to use JPA 
		for persistence. 
		Can someone give an example what way the mimimum persistence.xml and the neccessary corresponding entries in the openejb-jar.xml

		have to look like to get right connection between the application and the connection-pool? 

		I've had already a look at the daytrader example (2.0M2-jpa-plan.xml), but (if I got it right) this makes use of an ext-module

		entry for the database connection. Is this really neccessary? How can I describe a reference to my existing connection-pool?

		Thanks for every hint. 

		Michael 





Re: How to deploy JPA?

Posted by David Jencks <da...@yahoo.com>.
Unless someone changed the code a lot while I wasn't looking I don't  
think that will work.

  I think you need to
(1) make sure your pool module is an ancestor of your ejb app: the  
easiest way is to make it a dependency in the geronimo plan for the  
ejb app.  This has the same effect as the "ext-module" in daytrader.
(2) assuming you do want jta :-) use <jta-data-source>MyTestPool</jta- 
data-source>  or <jta-data-source>name=MyTestPool</jta-data-source>

thanks
david jencks


On Mar 28, 2007, at 7:43 AM, David Carew wrote:

> You should be able to do it in your persistence.xml file. with the   
> <jta-data-source> element
> e.g. < jta-data-source>java:comp/env/MyTestPool</jta-data-source>
>
> On 3/28/07, Ueberbach, Michael <mi...@dbh.de> wrote:
> Hello,
>
> I need some help in finding out the right way to deploy an ejb- 
> application in Geronimo 2.0M3.
> Szenario is as follows:
> There is a connection-pool already deployed to an existing MySQL- 
> Database, let's say "MyTestPool".
> The application has some entity beans and stateless session beans  
> using EJB3.0 annotations. I want to use JPA
> for persistence.
> Can someone give an example what way the mimimum persistence.xml  
> and the neccessary corresponding entries in the openejb-jar.xml
>
> have to look like to get right connection between the application  
> and the connection-pool?
>
> I've had already a look at the daytrader example (2.0M2-jpa- 
> plan.xml), but (if I got it right) this makes use of an ext-module
>
> entry for the database connection. Is this really neccessary? How  
> can I describe a reference to my existing connection-pool?
>
> Thanks for every hint.
>
> Michael
>
>
>


Re: How to deploy JPA?

Posted by David Carew <dc...@gmail.com>.
You should be able to do it in your persistence.xml file. with the  <
jta-data-source> element
e.g. <jta-data-source>java:comp/env/MyTestPool</jta-data-source>

On 3/28/07, Ueberbach, Michael <mi...@dbh.de> wrote:
>
>  Hello,
>
> I need some help in finding out the right way to deploy an ejb-application
> in Geronimo 2.0M3.
> Szenario is as follows:
> There is a connection-pool already deployed to an existing MySQL-Database,
> let's say "MyTestPool".
> The application has some entity beans and stateless session beans using
> EJB3.0 annotations. I want to use JPA
> for persistence.
> Can someone give an example what way the mimimum persistence.xml and the
> neccessary corresponding entries in the openejb-jar.xml
>
> have to look like to get right connection between the application and the
> connection-pool?
>
> I've had already a look at the daytrader example (2.0M2-jpa-plan.xml), but
> (if I got it right) this makes use of an ext-module
>
> entry for the database connection. Is this really neccessary? How can I
> describe a reference to my existing connection-pool?
>
> Thanks for every hint.
>
> Michael
>
>