You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by rsumner <ry...@sumnerfamily.com> on 2010/07/14 08:47:24 UTC

inplace deployment and persistence.xml

I've been experiencing a very interesting error when playing around with
inPlace deployments and whole EARs.  

I have gotten the applications deployed and what seem to be working with the
exception of OpenJPA and injection of the PersistenceContext into my Session
beans.  When the application initially deploys, I will see the following
error in my geronimo.out:

org.apache.geronimo.common.DeploymentException: Could not resolve reference
at deploy time for query
?name=persistence/mydb#org.apache.geronimo.persistence.PersistenceUnitGBean.
No GBeans found.

In my session bean:

@PersistenceContext(unitName="mydb")
protected EntityManager em;

If I deploy the exact EAR without using the inplace method, it will deploy
and work flawlessly within Geronimo 2.1.5. 

I tried taking the persistence.xml out of the ejb.jar/META-INF and putting
it in the base ear/META-INF, but that didn't seem to help.  I enabled debug
logging of the container, but it didn't seem to give me any helpful
information surrounding the exception about why it can't find that
persistence unit correctly.

I know the problem isn't related to the data source as I can see that deploy
just fine (yes, it's a application-scoped data source that's deployed with
the application in the geronimo deployment descriptor).  

I'm at a complete loss.  Only other thing to mention is that Geronimo is
running as a non-privileged user.  Any help would be greatly appreciated. 
For now, I'll run a non-inplace deployment. 
-- 
View this message in context: http://apache-geronimo.328035.n3.nabble.com/inplace-deployment-and-persistence-xml-tp965725p965725.html
Sent from the Users mailing list archive at Nabble.com.

Re: inplace deployment and persistence.xml

Posted by rsumner <ry...@sumnerfamily.com>.
Sure thing.  I spent the time to put some debug code in-place and figure out
the problem.  In PersistenceUnitBuilder.initContext(), there was no
condition being put in place for the the fact that the
moduleContext.getBaseDir() is not different regardless of whether or not the
ModuleContext was constructed with inPlaceConfiguration dir not being null. 
Rather than changing the ModuleContext to help support a boolean for this
value (which I think probably might have been cleaner), I went a layer up
and checked to see if the configurationData of the rootEar had a null
inPlaceConfigurationDir which would indicate the same condition from above. 
I adjusted the rootBaseFile and moduleBaseURI accordingly if it wasn't null
from the when the MoudleContext was built.

I've created a JIRA issue for it located here:
https://issues.apache.org/jira/browse/GERONIMO-5452

In addition, I've attached the fix here that I wrote for the 2.1.6 branch.  

http://apache-geronimo.328035.n3.nabble.com/file/n975531/inplace-persistencebuilder.patch
inplace-persistencebuilder.patch 

Thanks for allowing me the opportunity to contribute.
-- 
View this message in context: http://apache-geronimo.328035.n3.nabble.com/inplace-deployment-and-persistence-xml-tp965725p975531.html
Sent from the Users mailing list archive at Nabble.com.

Re: inplace deployment and persistence.xml

Posted by David Jencks <da...@yahoo.com>.
Unfortunately I don't have time to look into this soon.  I would guess that the PersistenceUnitBuilder is not actually scanning your in-place ear for the persistence.xmls.  I would investigate this by putting some breakpoints in the PersistenceUnitBuilder and seeing what happens when I deploy the inplace ear.

Could you file a jira issue for this?  Any info you may be able to get by debugging, or even better a patch to fix it would be great!

https://issues.apache.org/jira/browse/GERONIMO

thanks
david jencks

On Jul 13, 2010, at 11:47 PM, rsumner wrote:

> 
> I've been experiencing a very interesting error when playing around with
> inPlace deployments and whole EARs.  
> 
> I have gotten the applications deployed and what seem to be working with the
> exception of OpenJPA and injection of the PersistenceContext into my Session
> beans.  When the application initially deploys, I will see the following
> error in my geronimo.out:
> 
> org.apache.geronimo.common.DeploymentException: Could not resolve reference
> at deploy time for query
> ?name=persistence/mydb#org.apache.geronimo.persistence.PersistenceUnitGBean.
> No GBeans found.
> 
> In my session bean:
> 
> @PersistenceContext(unitName="mydb")
> protected EntityManager em;
> 
> If I deploy the exact EAR without using the inplace method, it will deploy
> and work flawlessly within Geronimo 2.1.5. 
> 
> I tried taking the persistence.xml out of the ejb.jar/META-INF and putting
> it in the base ear/META-INF, but that didn't seem to help.  I enabled debug
> logging of the container, but it didn't seem to give me any helpful
> information surrounding the exception about why it can't find that
> persistence unit correctly.
> 
> I know the problem isn't related to the data source as I can see that deploy
> just fine (yes, it's a application-scoped data source that's deployed with
> the application in the geronimo deployment descriptor).  
> 
> I'm at a complete loss.  Only other thing to mention is that Geronimo is
> running as a non-privileged user.  Any help would be greatly appreciated. 
> For now, I'll run a non-inplace deployment. 
> -- 
> View this message in context: http://apache-geronimo.328035.n3.nabble.com/inplace-deployment-and-persistence-xml-tp965725p965725.html
> Sent from the Users mailing list archive at Nabble.com.