0 Replies Latest reply on Mar 17, 2009 7:17 AM by Michal Paka

    javassist based hibernate proxies on remote machine with net

    Michal Paka Newbie

      Hi all,

      I am working on a swing / web application bridge for a swing client. As a communication layer I am using something I would call RMI over HTTP (serialized class data is transfered through HTTP). The swing client needs to be small because it will be invoked using Java WebStart. This is the reason why I cannot include all hiberante dependencies in the client JAR and I am forced to use network class loading. The problem appear when I try to deserialize hiberante proxies.

      This is what I get on the client side:

      Caused by: org.hibernate.HibernateException: Javassist Enhancement failed: ...the package...Studio
       at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxy(JavassistLazyInitializer.java:109)
       at org.hibernate.proxy.pojo.javassist.SerializableProxy.readResolve(SerializableProxy.java:78)
       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 java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1061)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1762)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
       at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
       at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
       at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
       at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
       at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
       at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
       at ...the package.....JavaNativeDeserializer.deserializeObject(JavaNativeDeserializer.java:46)
       ... 8 more
      Caused by: java.lang.ClassFormatError: Invalid code attribute name index 0 in class file javassist/util/proxy/ProxyFactory
       at java.lang.ClassLoader.defineClass1(Native Method)
       at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
       at ...the package....ServerAwareClassLoader.load(ServerAwareObjectInputStream.java:192)
       at ...the package....ServerAwareClassLoader.loadClass(ServerAwareObjectInputStream.java:106)
       at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
       at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxy(JavassistLazyInitializer.java:95)
       ... 30 more
      


      I am sure that transfer layer works fine. No class data gets corrupted (md5 calculated on both ends matches).

      I need to mention that if I include all dependencies in the client jar file everything works fine.

      I suspect that there are some class loading issues assicuated with javaasist. Do I need to do something special to load the javaasist classes?