You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Marco Laponder <ma...@kewill.com> on 2011/06/21 09:51:53 UTC
now as new thread: hidden-classes on ear lib directory
Hi All:
My apologies, my previous post was a reply on another subject mixing up
the thread.
So once more my post but now really as a new thread...
I have an ear which contains a war file. The jar files required by my
application are in the lib directory of the ear. The WEB-INF/lib
directory is empty. I am using hibernate version 3.6.0.Final and I want
my application to use the jpa 2.0 of hibernate (hibernate-jpa-2.0-api),
so I have added a hidden-classes element with a filter on
javax.persistence.
However when I have this construction, hibernate doesn't recognize my
annotated classes anymore (it gives an mapping exception Unknown
Entity). But when I move the libraries from the ear lib directory to the
WEB-INF/lib directory I no longer have this exception.
I am running on Geronimo 2.2.1 and my deployment plan is:
<?xml version="1.0" encoding="utf-8"?>
<application application-name="Sample"
xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-2.0"
xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-2.0"
xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0"
xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">
<sys:environment>
<sys:moduleId>
<sys:groupId>com.sample</sys:groupId>
<sys:artifactId>sample</sys:artifactId>
<sys:version>0.1-SNAPSHOT</sys:version>
<sys:type>car</sys:type>
</sys:moduleId>
<sys:hidden-classes>
<filter>javax.persistence</filter>
</sys:hidden-classes>
</sys:environment>
</application>
Am I doing something incorrect in my setup or deployment plan or should
this construction work ?
Best regards,
Marco
Re: now as new thread: hidden-classes on ear lib directory
Posted by Kevan Miller <ke...@gmail.com>.
On Jun 22, 2011, at 10:10 PM, Ivan wrote:
> IIRC, the EAR classloader is not the only parent classloader for your web application. I think that Geronimo adds the JPA related classloader as one of the parent classloaders of your web application, and unfortunately, the EAR classloader is not the first on in the list.
Ah. Yes, you're right. Slowly, I swap it back in. So, Marco, I don't think there's a way to put everything in your EAR's lib directory.
--kevan
Re: now as new thread: hidden-classes on ear lib directory
Posted by Ivan <xh...@gmail.com>.
IIRC, the EAR classloader is not the only parent classloader for your web
application. I think that Geronimo adds the JPA related classloader as one
of the parent classloaders of your web application, and unfortunately, the
EAR classloader is not the first on in the list.
2011/6/23 Kevan Miller <ke...@gmail.com>
>
> On Jun 21, 2011, at 3:51 AM, Marco Laponder wrote:
>
> > Hi All:
> >
> > My apologies, my previous post was a reply on another subject mixing up
> the thread.
> > So once more my post but now really as a new thread…
> >
> > I have an ear which contains a war file. The jar files required by my
> > application are in the lib directory of the ear. The WEB-INF/lib
> > directory is empty. I am using hibernate version 3.6.0.Final and I want
> > my application to use the jpa 2.0 of hibernate (hibernate-jpa-2.0-api),
> > so I have added a hidden-classes element with a filter on
> > javax.persistence.
> >
> > However when I have this construction, hibernate doesn't recognize my
> > annotated classes anymore (it gives an mapping exception Unknown
> > Entity). But when I move the libraries from the ear lib directory to the
> > WEB-INF/lib directory I no longer have this exception.
>
> Hmm. It sounds like your war's are inheriting the hidden-classes
> configuration. To be honest, I can't remember the specifics of how that
> will/should work.
>
> In general, each of your WAR's will have a ClassLoader. Their parent will
> be the EAR ClassLoader. You want the EAR ClassLoader to have the hidden
> classes, but not the WAR ClassLoaders. From your description, it sounds like
> this isn't the case. You could try defining each of your wars in the
> deployment plan. Perhaps explicitly defining their <environment> will
> override this behavior? Beyond that, unless somebody remembers more,
> somebody will need to dig through the code...
>
> --kevan
--
Ivan
Re: now as new thread: hidden-classes on ear lib directory
Posted by Kevan Miller <ke...@gmail.com>.
On Jun 21, 2011, at 3:51 AM, Marco Laponder wrote:
> Hi All:
>
> My apologies, my previous post was a reply on another subject mixing up the thread.
> So once more my post but now really as a new thread…
>
> I have an ear which contains a war file. The jar files required by my
> application are in the lib directory of the ear. The WEB-INF/lib
> directory is empty. I am using hibernate version 3.6.0.Final and I want
> my application to use the jpa 2.0 of hibernate (hibernate-jpa-2.0-api),
> so I have added a hidden-classes element with a filter on
> javax.persistence.
>
> However when I have this construction, hibernate doesn't recognize my
> annotated classes anymore (it gives an mapping exception Unknown
> Entity). But when I move the libraries from the ear lib directory to the
> WEB-INF/lib directory I no longer have this exception.
Hmm. It sounds like your war's are inheriting the hidden-classes configuration. To be honest, I can't remember the specifics of how that will/should work.
In general, each of your WAR's will have a ClassLoader. Their parent will be the EAR ClassLoader. You want the EAR ClassLoader to have the hidden classes, but not the WAR ClassLoaders. From your description, it sounds like this isn't the case. You could try defining each of your wars in the deployment plan. Perhaps explicitly defining their <environment> will override this behavior? Beyond that, unless somebody remembers more, somebody will need to dig through the code...
--kevan