我正在使用hibernate 5.0.2和weblogic 12.我有一个独立的应用程序初始化上下文,然后在weblogic中调用EJB。当我运行独立应用程序时,我收到以下错误消息。
2015年10月20日下午8:56:52 org.hibernate.proxy.pojo.javassist.JavassistProxyFactory deserializeProxy 错误:HHH000142:Javassist增强失败:com.fedex.net2.persistence.pojo.ParameterDefinitionE java.lang.ClassCastException:com.fedex.net2.persistence.pojo.ParameterDefinitionE _ $$ _ javassist_0无法强制转换为javassist.util.proxy.Proxy 在org.hibernate.proxy.pojo.javassist.JavassistProxyFactory.deserializeProxy(JavassistProxyFactory.java:156) 在org.hibernate.proxy.pojo.javassist.SerializableProxy.readResolve(SerializableProxy.java:116) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:483) at java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1104) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1810) 在java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801) 在java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371) at java.util.ArrayList.readObject(ArrayList.java:791) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:483) at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1896) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801) 在java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371) at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:208) at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:602) at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:204) 在weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:62) 在weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:264) 在weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:477) 在weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:285) at com.fedex.net2.parameter.ParameterSBean_cswnpo_EOImpl_12130_WLStub.findAllParameterValuesListForSeqNo(Unknown Source) 在com.fedex.net2.parameter.Parameter.getParamValue(Parameter.java:122) 在com.fedex.net2.comm.daemon.ChannelDef.getChnlParams(ChannelDef.java:310) 在com.fedex.net2.comm.daemon.CommInDaemon.connectChannel(CommInDaemon.java:696) 在com.fedex.net2.comm.daemon.CommInDaemon.main(CommInDaemon.java:278)
接下来是异常。
线程中的异常" main" org.hibernate.HibernateException:HHH000142:Javassist Enhancement失败:com.fedex.net2.persistence.pojo.ParameterDefinitionE 在org.hibernate.proxy.pojo.javassist.JavassistProxyFactory.deserializeProxy(JavassistProxyFactory.java:163) 在org.hibernate.proxy.pojo.javassist.SerializableProxy.readResolve(SerializableProxy.java:116) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:483) at java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1104) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1810) 在java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351) at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1993) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1918) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801) 在java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371) at java.util.ArrayList.readObject(ArrayList.java:791) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:483) at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1896) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801) 在java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371) at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:208) at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:602) at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:204) 在weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:62) 在weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:264) 在weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:477) 在weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:285) at com.fedex.net2.parameter.ParameterSBean_cswnpo_EOImpl_12130_WLStub.findAllParameterValuesListForSeqNo(Unknown Source) 在com.fedex.net2.parameter.Parameter.getParamValue(Parameter.java:122) 在com.fedex.net2.comm.daemon.ChannelDef.getChnlParams(ChannelDef.java:310) 在com.fedex.net2.comm.daemon.CommInDaemon.connectChannel(CommInDaemon.java:696) 在com.fedex.net2.comm.daemon.CommInDaemon.main(CommInDaemon.java:278) 引起:java.lang.ClassCastException:com.fedex.net2.persistence.pojo.ParameterDefinitionE _ $$ _ javassist_0无法强制转换为javassist.util.proxy.Proxy 在org.hibernate.proxy.pojo.javassist.JavassistProxyFactory.deserializeProxy(JavassistProxyFactory.java:156) ......还有35个
我不理解为什么我的独立应用无法访问数据。它与延迟加载有关。我做错了什么。
我在类路径中有正确的jar。到目前为止已验证100次。仍然无法找出原因?
任何想法???
答案 0 :(得分:0)
降级到Hibernate 3.6.4有助于解决这个问题。
答案 1 :(得分:0)
添加到build.gradle
dependencies {
modules {
module("javassist:javassist") {
replacedBy("org.javassist:javassist")
}
}
}