[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3826?page=c...
]
Arie van Wijngaarden commented on HHH-3826:
-------------------------------------------
Well, I had the same problem and found the reason why:
Javassist uses for finding and constructing proxies the class loader that loaded the class
to proxy. This is normally what you want, since you want to clean up the proxy when the
proxied class is cleaned up as well. Very important in an OSGi environment since you want
to keep your PermGen space clean.
However, in the case of hibernate, hibernate assigns an extra interface
"HibernateProxy" to the proxy class. This interface must therefore also be
visible to the class loader used by javassist, which is, as stated, the loader that loaded
the original domain class.
If you linked up the bundles in OSGi as I did, this is probably not the situation you
have: I made a separate bundle with my domain classes and the session factory that is used
to store the objects in another. My domain class bundle is therefore not dependent on
hibernate or javassist and therefore its class loader cannot see/find the
hibernate/javassist classes needed.
A solution is of course to add the needed hibernate/javassist packages to the
Import-Packages of the domain class bundle, but I do not really like that.
Another options is to leave it as is and just ignore the failure of the proxy creation. In
my situation it still works without the proxies. Maybe there is a hibernate option to just
skip the whole proxy creation stuff out (don't know).
Regards,
Arie
Hibernate 3.3.1.GA + Javassist issue 3.9.0.GA :
java.lang.RuntimeException: by java.lang.NoClassDefFoundError:
org/hibernate/proxy/HibernateProxy (OSGI Server)
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-3826
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3826
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.3.1
Reporter: Charles Moulliard
Hi,
I try to use Hibernate 3.3.1.GA in combination with Spring OSGI 1.2.0-rc1. Unfortunately,
there is a classloading issue on OSGI :
{code}
Caused by: java.lang.RuntimeException: by java.lang.NoClassDefFoundError:
org/hibernate/proxy/HibernateProxy
at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:174)
at
org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxyFactory(JavassistLazyInitializer.java:162)
... 58 more
Caused by: javassist.CannotCompileException: by java.lang.NoClassDefFoundError:
org/hibernate/proxy/HibernateProxy
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:167)
at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:170)
... 59 more
Caused by: java.lang.NoClassDefFoundError: org/hibernate/proxy/HibernateProxy
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:159)
... 60 more
{code}
remark : the package org.hibernate.proxy is defined in the MANIFEST file (section -
Import-PAckage)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira