users@glassfish.java.net

Re: Hibernate and Spring not working on Glassfish 2

From: Sahoo <Sahoo_at_Sun.COM>
Date: Wed, 06 Feb 2008 13:25:44 +0530

glassfish_at_javadesktop.org wrote:
> Actually I've tried what woel suggested.
> Unfortunately we had some major issues with this. E.g. I have seen a lot of cases where the Hibernate JPA implementation tries to load the persistence.xml without luck. The reason is that the jars in the gf lib directory are loaded by another classloader than the web application (which acutually contains the persistence.xml). Thus hibernate is not able to find the persistence.xml if you put the hibernate jars in the gf lib dir.
>
It's not just GlassFish, many appservers use different classloaders to
load system classes vis-a-vis application classes. What is important is
the class loader delegation chain and thread's context class loader. In
GlassFish, an application's class loader delegates to the class loader
that loads stuff from lib directory. We also set the application's class
loader as the current thread's context class loader. Hibernate should be
using thread's context class loader to load persistence.xml. I will be
surprised to know if they actually don't. Which version of Hibernate are
you using where you see such problems? Have you reported in their forum?
> Another issue I have found is some weird behaviour if you are not careful using the right web.xml schema. Glassfish may behave completely different depending on the the schema version you are using. I made some tests using 2.4 and 2.5 and found out that the deployment process completes with totally different results/errors sometimes. E.g. you might not be able to put in RESOURCE_LOCAL if you are using 2.5. Maybe this helps some other people who are in favour of RESOURCE_LOCAL instead of JTA
>
One of the common problems encountered by users is that for them
injection does not happen because they use schema version in web.xml as
2.4. It goes away when they change it to 2.5. Schema version comes into
play because of the Java EE spec requirement; it is *not* a GlassFish
specific behavior. Every compliant application server has to consider
schema version of the descriptors to determine whether to process
annotations or not.

I think the current issue is different. It appears to be a set up issue
or a Sailfin thing. It is now being discussed in sailfin forum.

Thanks,
Sahoo
> [Message sent by forum member 'klausstake' (klausstake)]
>
> http://forums.java.net/jive/thread.jspa?messageID=257601
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>