Caused by: java.lang.ClassCastException: com.chuantao.domain.Dict_$$_javassist_1 cannot be cast to javassist.util.proxy.Proxy at org.hibernate.proxy.pojo.javassist.JavassistProxyFactory.getProxy(JavassistProxyFactory.java:123)
15:19:15,774 ERROR DefaultDispatcherErrorHandler:42 - Exception occurred during processing request: HHH000142: Javassist Enhancement failed: com.chuantao.domain.Dict; nested exception is org.hibernate.HibernateException: HHH000142: Javassist Enhancement failed: com.chuantao.domain.Dictorg.springframework.orm.hibernate5.HibernateSystemException: HHH000142: Javassist Enhancement failed: com.chuantao.domain.Dict; nested exception is org.hibernate.HibernateException: HHH000142: Javassist Enhancement failed: com.chuantao.domain.Dictat org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:219)at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:344)at org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:309)at org.springframework.orm.hibernate5.HibernateTemplate.findByCriteria(HibernateTemplate.java:1004)at com.chuantao.daoImp.CustomerDaoImpl.findByCurrentPage(CustomerDaoImpl.java:51)at com.chuantao.serviceImp.CustomerServiceImpl.findByCurrentPage(CustomerServiceImpl.java:33)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)at java.lang.reflect.Method.invoke(Unknown Source)at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)at com.sun.proxy.$Proxy33.findByCurrentPage(Unknown Source)at com.chuantao.web.action.CustomerAction.findByCurrentPage(CustomerAction.java:97)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)at java.lang.reflect.Method.invoke(Unknown Source)at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:891)at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1293)at ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68)at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo(XWorkMethodAccessor.java:117)at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethod(XWorkMethodAccessor.java:108)at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:1369)at ognl.ASTMethod.getValueBody(ASTMethod.java:90)at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)at ognl.SimpleNode.getValue(SimpleNode.java:258)at ognl.Ognl.getValue(Ognl.java:494)at ognl.Ognl.getValue(Ognl.java:458)at com.opensymphony.xwork2.ognl.OgnlUtil$2.execute(OgnlUtil.java:309)at com.opensymphony.xwork2.ognl.OgnlUtil.compileAndExecute(OgnlUtil.java:340)at com.opensymphony.xwork2.ognl.OgnlUtil.getValue(OgnlUtil.java:307)at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:423)at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:287)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:250)at org.apache.struts2.interceptor.DeprecationInterceptor.intercept(DeprecationInterceptor.java:41)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167)at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:76)at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:229)at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:229)at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)at org.apache.struts2.interceptor.DateTextFieldInterceptor.intercept(DateTextFieldInterceptor.java:125)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:253)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:139)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:564)at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81)at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)at java.lang.Thread.run(Unknown Source)Caused by: org.hibernate.HibernateException: HHH000142: Javassist Enhancement failed: com.chuantao.domain.Dictat org.hibernate.proxy.pojo.javassist.JavassistProxyFactory.getProxy(JavassistProxyFactory.java:130)at org.hibernate.tuple.entity.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:666)at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(AbstractEntityPersister.java:4462)at org.hibernate.event.internal.DefaultLoadEventListener.createProxyIfNecessary(DefaultLoadEventListener.java:359)at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:274)at org.hibernate.event.internal.DefaultLoadEventListener.doOnLoad(DefaultLoadEventListener.java:121)at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:89)at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1129)at org.hibernate.internal.SessionImpl.internalLoad(SessionImpl.java:1022)at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:632)at org.hibernate.type.EntityType.resolve(EntityType.java:424)at org.hibernate.engine.internal.TwoPhaseLoad.doInitializeEntity(TwoPhaseLoad.java:154)at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:128)at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:1132)at org.hibernate.loader.Loader.processResultSet(Loader.java:992)at org.hibernate.loader.Loader.doQuery(Loader.java:930)at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:336)at org.hibernate.loader.Loader.doList(Loader.java:2611)at org.hibernate.loader.Loader.doList(Loader.java:2594)at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2423)at org.hibernate.loader.Loader.list(Loader.java:2418)at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:109)at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1774)at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:363)at org.springframework.orm.hibernate5.HibernateTemplate$35.doInHibernate(HibernateTemplate.java:1015)at org.springframework.orm.hibernate5.HibernateTemplate$35.doInHibernate(HibernateTemplate.java:1004)at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:341)... 105 more
错误的原因是因为
存在两个javassist包,删除一个低版本的就可以
另一个错误是在于,延迟加载,在Struts过滤器前面增加一个新的过滤器就可以了。
<!--解决延迟 加载 。需要在核心过滤器之前出来 --> <filter> <filter-name>OpenSessionInViewFilter</filter-name> <filter-class>org.springframework.orm.hibernate5.support.OpenSessionInViewFilter</filter-class> </filter> <filter-mapping> <filter-name>OpenSessionInViewFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <!-- Struts2核心过滤器 --> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>