打包好的war包部署到was8,启动应用之后双击进入用户功能,这时后台报错,错误如下:
*******************************************************
Error Type= ErrorCode=999999 ErrorUserMsg=系统异常:ERROR-IN-doRestList
*******************************************************
java.lang.ClassCastException: hulk.web.frame.user.entity.User_$$_javassist_8 incompatible with javassist.util.proxy.Proxy
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxy(JavassistLazyInitializer.java:148) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at org.hibernate.proxy.pojo.javassist.JavassistProxyFactory.getProxy(JavassistProxyFactory.java:73) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at org.hibernate.tuple.entity.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:758) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(AbstractEntityPersister.java:4419) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at org.hibernate.event.internal.DefaultLoadEventListener.createProxyIfNecessary(DefaultLoadEventListener.java:334) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:260) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:152) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1053) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at org.hibernate.internal.SessionImpl.internalLoad(SessionImpl.java:980) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:714) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at org.hibernate.type.EntityType.resolve(EntityType.java:502) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at org.hibernate.engine.internal.TwoPhaseLoad.doInitializeEntity(TwoPhaseLoad.java:168) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:137) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:1112) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at org.hibernate.loader.Loader.processResultSet(Loader.java:969) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at org.hibernate.loader.Loader.doQuery(Loader.java:917) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:348) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at org.hibernate.loader.Loader.doList(Loader.java:2550) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at org.hibernate.loader.Loader.doList(Loader.java:2536) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2366) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at org.hibernate.loader.Loader.list(Loader.java:2361) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:124) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1623) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:374) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at org.hibernate.internal.CriteriaImpl.uniqueResult(CriteriaImpl.java:396) ~[hibernate-core-4.2.21.Final.jar:4.2.21.Final]
at hulk.web.frame.org.dao.OrgDaoImpl.getOrgById(OrgDaoImpl.java:95) ~[hulk2-core-1.1.jar:?]
at hulk.web.frame.role.service.RoleServiceImpl.countTotalRole(RoleServiceImpl.java:221) ~[hulk2-core-1.1.jar:?]
at hulk.web.frame.role.service.RoleServiceImpl$$FastClassBySpringCGLIB$$10417feb.invoke() ~[spring-core-4.1.6.RELEASE.jar:?]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717) ~[spring-aop-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) ~[spring-tx-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653) ~[spring-aop-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at hulk.web.frame.role.service.RoleServiceImpl$$EnhancerBySpringCGLIB$$b274c625.countTotalRole() ~[spring-core-4.1.6.RELEASE.jar:?]
at hulk.web.frame.role.action.RoleControl.countTotalRecord(RoleControl.java:36) ~[hulk2-core-1.1.jar:?]
at hulk.web.frame.base.control.BaseListControl.doRestList(BaseListControl.java:52) [hulk2-core-1.1.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.6.0]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) ~[?:1.6.0]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) ~[?:1.6.0]
at java.lang.reflect.Method.invoke(Method.java:611) ~[?:1.6.0]
上网百度了下,说是was8本身的jar包与我们的应用引用的jar包冲突导致的,找出来就是:was8服务器上的/opt/IBM/WebSphere/AppServer/plugins/javassist.jar与我们的war包中的/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/localhostNode01Cell/oms_war.ear/oms.war/WEB-INF/lib/javassist-3.18.1-GA.jar冲突。
首先,我们尝试了修改应用的类加载顺序:
重启应用之后还是报错,我们又尝试了用我们应用的jar包替换was8本地的jar包,结果was8启动不了。此时再将javassist.jar放回原来的目录was还是不能启动(最后通过执行/opt/IBM/WebSphere/AppServer/bin/osgiCfgInit.sh解决了不能启动的问题)。
设置好了之后应用,共享库就建好了,之后就是应用到我们的程序
如果发布的是ear包,则配置上面的Application,如果发布的是war包,则配置下面的Module
然后确定重启应用,jar包冲突问题就解决了。
新建共享库参考:was配置共享库–百度文库