Uploaded image for project: 'Hibernate ORM'
  1. Hibernate ORM
  2. HHH-8778

Javassist ClassCastException after switching from 4.2.7.SP1 to 4.2.8.Final

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Won't Fix
    • Affects Version/s: 4.2.8
    • Fix Version/s: None
    • Component/s: hibernate-core
    • Labels:
      None
    • Environment:
      Windows 2008 Server, Java 7u13 x64, Glassfish 3.1.2.2
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true

      Description

      After switching our project from 4.2.7.SP1 to 4.2.8.Final, we have got java.lang.ClassCastException: ru....Vendor_$$_javassist_9 cannot be cast to javassist.util.proxy.Proxy

      We are re-check environment and downgrade hibernate version to 4.1.12.Final - all seems work fine. The same for 4.2.7.SP1.

      We are using runtime bytecode transformation (javassist 1.18.1-GA) and hbm-based mapping behind JPA.

      java.lang.ClassCastException: ru....Vendor_$$_javassist_9 cannot be cast to javassist.util.proxy.Proxy
           at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxy(JavassistLazyInitializer.java:148)
           at org.hibernate.proxy.pojo.javassist.JavassistProxyFactory.getProxy(JavassistProxyFactory.java:73)
           at org.hibernate.tuple.entity.AbstractEntityTuplizer.createProxy(AbstractEntityTuplizer.java:758)
           at org.hibernate.persister.entity.AbstractEntityPersister.createProxy(AbstractEntityPersister.java:4419)
           at org.hibernate.event.internal.DefaultLoadEventListener.createProxyIfNecessary(DefaultLoadEventListener.java:333)
           at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:259)
           at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:151)
           at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1017)
           at org.hibernate.internal.SessionImpl.internalLoad(SessionImpl.java:944)
           at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:671)
           at org.hibernate.type.EntityType.resolve(EntityType.java:489)
           at org.hibernate.engine.internal.TwoPhaseLoad.doInitializeEntity(TwoPhaseLoad.java:168)
           at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:137)
           at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:1112)
           at org.hibernate.loader.Loader.processResultSet(Loader.java:969)
           at org.hibernate.loader.Loader.doQuery(Loader.java:917)
           at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:348)
           at org.hibernate.loader.Loader.doList(Loader.java:2548)
           at org.hibernate.loader.Loader.doList(Loader.java:2534)
           at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2364)
           at org.hibernate.loader.Loader.list(Loader.java:2359)
           at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:495)
           at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:357)
           at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:195)
           at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1194)
           at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101)
           at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:268)
           at com.mysema.query.jpa.impl.AbstractJPAQuery.getResultList(AbstractJPAQuery.java:196)
           at com.mysema.query.jpa.impl.AbstractJPAQuery.list(AbstractJPAQuery.java:242)
           at ru.....changeRoles(EmployeeManagementAppBean.java:141)
           at java.lang.reflect.Method.invoke(Method.java:601)
           at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1052)
           at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1124)
           at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5388)
           at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:619)
           at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)
           at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:571)
           at org.jboss.weld.ejb.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:42)
           at java.lang.reflect.Method.invoke(Method.java:601)
           at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:861)
           at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)
           at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:571)
           at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:162)
           at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:144)
           at java.lang.reflect.Method.invoke(Method.java:601)
           at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:861)
           at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)
           at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:370)
           at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5360)
           at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5348)
           at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:214)
           at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:89)
           at com.sun.proxy.$Proxy295.changeRoles(Unknown Source)
           at java.lang.reflect.Method.invoke(Method.java:601)
           at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:267)
           at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
           at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)
           at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:263)
           at org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:110)
           at org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:56)
           at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105)
           at ru....$725942301$Proxy$_$$_Weld$Proxy$.changeRoles(EmployeeManagementApp$725942301$Proxy$_$$_Weld$Proxy$.java)
           at java.lang.reflect.Method.invoke(Method.java:601)
           at org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:435)
           at com.sun.proxy.$Proxy325.changeRoles(Unknown Source)
           at ru....onSubmit(EmployeeRolesTab.java:52)
           at org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink$1.onSubmit(AjaxSubmitLink.java:116)
           at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior$1.onSubmit(AjaxFormSubmitBehavior.java:179)
           at org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1253)
           at org.apache.wicket.markup.html.form.Form.process(Form.java:925)
           at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:771)
           at org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:156)
           at org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:123)
           at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:626)
           at java.lang.reflect.Method.invoke(Method.java:601)
           at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258)
           at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241)
           at org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:247)
           at org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:226)
           at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:861)
           at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
           at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:261)
           at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:218)
           at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
           at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
           at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
           at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
           at ru...doFilter(DomainEnvironmentConfigurationServiceFilter.java:57)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
           at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
           at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
           at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
           at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
           at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
           at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
           at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
           at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
           at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
           at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
           at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
           at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
           at ru.....doFilter(LoggerContextInjectingFilter.java:43)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
           at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
           at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
           at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
           at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
           at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
           at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
           at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
           at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
           at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
           at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
           at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
           at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
           at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
           at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
           at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
           at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
           at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
           at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
           at java.lang.Thread.run(Thread.java:722)
      

        Issue Links

          Activity

          Hide
          christian.beikov Christian Beikov added a comment -

          Here a little guide on how to update javassist in WAS. This was tested with WAS 8.0.0.1.
          The javassist.jar in WAS_HOME/plugins has to be replaced by the jar from: http://search.maven.org/remotecontent?filepath=org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar
          Keep the old one as backup.
          Invoke WAS_HOME/profiles/PROFILE_NAME/bin/osgiCfgInit.sh and then WAS_HOME/profiles/PROFILE_NAME/bin/clearClassCache.sh or the *.bat files on windows machines.

          Thanks to this post I found out how to do it: http://ramirezag.wordpress.com/2014/02/27/hibernate-4-2-8-and-websphere-8-5-5-1-issues/

          Show
          christian.beikov Christian Beikov added a comment - Here a little guide on how to update javassist in WAS. This was tested with WAS 8.0.0.1. The javassist.jar in WAS_HOME/plugins has to be replaced by the jar from: http://search.maven.org/remotecontent?filepath=org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar Keep the old one as backup. Invoke WAS_HOME/profiles/PROFILE_NAME/bin/osgiCfgInit.sh and then WAS_HOME/profiles/PROFILE_NAME/bin/clearClassCache.sh or the *.bat files on windows machines. Thanks to this post I found out how to do it: http://ramirezag.wordpress.com/2014/02/27/hibernate-4-2-8-and-websphere-8-5-5-1-issues/
          Hide
          javapapo Paris Apostolopoulos added a comment -

          Hi Christian, I had seen this solution as well but here are the reasons I did not used it.

          • I was unable on production to request a change on the root path of an already install Websphere
          • Working for more than a year with the all the weird stuff Wesbphere introduces I became sort of afraid of it's internal structure and depenencies, they seem to have this thing working under some very specific dependencies. JavaAssist is being used by other libraries WAS uses internally and I would not like to risk any crazy bugs on other layers.

          But at the end of the day, the brave take risk, so maybe you would be just fine. When it comes in my case, we have frozen the dependency on 4.2.7, we will be keep monitoring if IBM updates the dependency on a fix pack..and we have already migrated our code base to Wildfly

          Show
          javapapo Paris Apostolopoulos added a comment - Hi Christian, I had seen this solution as well but here are the reasons I did not used it. I was unable on production to request a change on the root path of an already install Websphere Working for more than a year with the all the weird stuff Wesbphere introduces I became sort of afraid of it's internal structure and depenencies, they seem to have this thing working under some very specific dependencies. JavaAssist is being used by other libraries WAS uses internally and I would not like to risk any crazy bugs on other layers. But at the end of the day, the brave take risk, so maybe you would be just fine. When it comes in my case, we have frozen the dependency on 4.2.7, we will be keep monitoring if IBM updates the dependency on a fix pack..and we have already migrated our code base to Wildfly
          Hide
          christian.beikov Christian Beikov added a comment -

          Another possibility would be to checkout the tag that you want to use and patch it.
          I patched 4.2.8.Final and it needed only 3 little changes. I am awaiting the approval of my boss regarding the javassist update, so maybe I have to build hibernate myself too.
          I will let you know when I do that and post links to a repository that contains patched versions.
          I also sent you an email regarding the migration, hope you can give me some info.

          Show
          christian.beikov Christian Beikov added a comment - Another possibility would be to checkout the tag that you want to use and patch it. I patched 4.2.8.Final and it needed only 3 little changes. I am awaiting the approval of my boss regarding the javassist update, so maybe I have to build hibernate myself too. I will let you know when I do that and post links to a repository that contains patched versions. I also sent you an email regarding the migration, hope you can give me some info.
          Hide
          christian.beikov Christian Beikov added a comment -

          The best solution would probably be to get rid of ProxyFactory as described in HHH-5684.

          Show
          christian.beikov Christian Beikov added a comment - The best solution would probably be to get rid of ProxyFactory as described in HHH-5684 .
          Hide
          christian.beikov Christian Beikov added a comment -

          Please reopen! My PR fixes this issues.

          Show
          christian.beikov Christian Beikov added a comment - Please reopen! My PR fixes this issues.

            People

            • Votes:
              2 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development