2 Replies Latest reply on May 14, 2008 7:31 AM by gigsvoo

    ClassCastException During Hibernate Session.get() when using

    gigsvoo Newbie

      Hi there,

      I deployed a SAR into JBoss 4.2.2 using shipped hibernate version. The JNDI of the SessionFactory loaded and in my WAR (deployed same with SAR at JBOSS_HOME/server/default/deploy) is able to get SessionFactory and Session object.

      When I try to do a

      ClassA a = session.get(ClassA.class, id);
      
      
      I would hit ClassCastException error. During debug session, I had saw the right side return the ClassA object but when it trying to assigned to left side, the error comes out.
      
      The same class of ClassA existed both inside the SAR deployed as well as the WAR deployed.
      
      What could be the reason?
      
      Note: If I turn on the
      
      
      Java2ClassLoadingCompliance
      UseJbossWebLoader
      
      
      
      switches in JBOSS_HOME\server\default\deploy\jboss-web.deployer\META-INF\jboss-service.xml then everything works fine. But I can't do that because they are other components requires library from tomcat container.
      
      Please help. Thanks