1 2 Previous Next 16 Replies Latest reply on Feb 22, 2012 8:16 AM by Tanya Ruttenberg

    org.hibernate.internal.SessionImpl cannot be cast to org.hibernate.Session

    Tanya Ruttenberg Expert

      I am migrating my Seam2 EAR from JBoss 5 to 7.  The EAR has I've been carefully reading everything I can get my hands on. Please let me know if there is any more info you need.  I've been playing around with libraries and jboss-deployment, and pom's and excising libraries out of the .ear just to see what happens.  I'm stumped at this point.

       

      jboss-deployment-structure.xml is

       

      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">

        <deployment>

          <dependencies>

            <module name="org.apache.log4j" export="true" />

            <module name="org.dom4j" export="true" />

            <module name="org.apache.commons.logging" export="true" />

            <module name="org.apache.commons.collections" export="true" />

            <module name="org.apache.commons.beanutils" export="true" />

            <module name="org.apache.commons.lang" export="true" />

            <module name="javax.faces.api" slot="1.2" export="true" />

            <module name="com.sun.jsf-impl" slot="1.2" export="true" />

          </dependencies>

          <exclusions>

            <module name="org.antlr" slot="main" />

            <module name="javax.faces.api" slot="main" />

            <module name="com.sun.jsf-impl" slot="main" />

            <module name="org.hibernate" />

          </exclusions>

        </deployment>

        <sub-deployment name="Dac.jar">

          <exclusions>

          </exclusions>

        </sub-deployment>

        <sub-deployment name="Contacts.jar">

          <exclusions>

          </exclusions>

        </sub-deployment>

        <sub-deployment name="ond-ejb.jar">

          <exclusions>

          </exclusions>

        </sub-deployment>

        <sub-deployment name="ond.war">

          <exclusions>

            <module name="javax.faces.api" slot="main" />

            <module name="org.hibernate" />

            <module name="com.sun.jsf-impl" slot="main" />

          </exclusions>

          <dependencies>

            <module name="javax.faces.api" slot="1.2" export="true" />

            <module name="com.sun.jsf-impl" slot="1.2" export="true" />

          </dependencies>

        </sub-deployment>

      </jboss-deployment-structure>

       

      Structure of EAR is

       

      ond.ear

      - lib

        antlr-runtime

        dne-exceptions (ours)

        gwt-servlet (just to quiet an error that occurs during deployment)

        hibernate-commons-annotations-3.3.0

        hibernate-core-3.3.0.SP1

        hibernate-entitymanager-3.4.0.GA

        hibernate-validator-3.1.0.GA

        jboss-el-1.0_02.CR5

        jboss-el-1.0_02.CR5

        jboss-seam-remoting-2.2.0.GA

        richfaces-api-3.3.1.GA

        slf4j-api-1.6.4

        slf4j-log4j12-1.6.4

        ssaIdentity (ours)

      Contacts.jar (ejb)

      Dac.jar (ejb)

      jboss-seam.jar

      ond.war

      ond-ejb.war (ejb)

      Smc.jar (ejb)

       

      When I try to load a page that invokes entityManager, I get the following.  Help!

       

      11:59:43,404 SEVERE [facelets.viewhandler] (http--0.0.0.0-8080-2) Error Rendering View[/pages/search/AdvancedSearch.xhtml]: org.jboss.seam.InstantiationException: Could not instantiate Seam component: officeTagsBean
      at org.jboss.seam.Component.newInstance(Component.java:2144) [jboss-seam.jar:]
      at org.jboss.seam.Component.getInstance(Component.java:2021) [jboss-seam.jar:]
      at org.jboss.seam.Component.getInstance(Component.java:1983) [jboss-seam.jar:]
      at org.jboss.seam.Component.getInstance(Component.java:1977) [jboss-seam.jar:]
      at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55) [jboss-seam.jar:]
      at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50) [jboss-seam.jar:]
      at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:148) [jboss-seam.jar:]
      at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:51) [jboss-seam.jar:]
      at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:173) [jsf-impl-1.2_15-jbossorg-2.jar:1.2_15.jbossorg-1-20111019-SNAPSHOT]
      at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:200) [jsf-impl-1.2_15-jbossorg-2.jar:1.2_15.jbossorg-1-20111019-SNAPSHOT]
      at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44) [jboss-el-1.0_02.CR5.jar:]
      at org.jboss.el.parser.AstValue.getValue(AstValue.java:63) [jboss-el-1.0_02.CR5.jar:]
      at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186) [jboss-el-1.0_02.CR5.jar:]
      at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71) [jsf-facelets-1.1.15.B1.jar:]
      at javax.faces.component.UISelectItems.getValue(UISelectItems.java:141) [jsf-api-1.2_15-jbossorg-2.jar:1.2_15.jbossorg-1-20111019-SNAPSHOT]
      at org.ajax4jsf.util.SelectUtils.getSelectItems(SelectUtils.java:84) [richfaces-impl-3.3.1.GA.jar:]
      at org.richfaces.renderkit.ComboBoxBaseRenderer.encodeItems(ComboBoxBaseRenderer.java:95) [richfaces-ui-3.3.1.GA.jar:]
      at org.richfaces.renderkit.html.ComboBoxRenderer.doEncodeEnd(ComboBoxRenderer.java:558) [richfaces-ui-3.3.1.GA.jar:]
      at org.richfaces.renderkit.html.ComboBoxRenderer.doEncodeEnd(ComboBoxRenderer.java:587) [richfaces-ui-3.3.1.GA.jar:]
      at org.ajax4jsf.renderkit.RendererBase.encodeEnd(RendererBase.java:134) [richfaces-impl-3.3.1.GA.jar:]
      at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:864) [jsf-api-1.2_15-jbossorg-2.jar:1.2_15.jbossorg-1-20111019-SNAPSHOT]
      at org.jboss.seam.ui.util.cdk.RendererBase.renderChild(RendererBase.java:190) [jboss-seam-ui-2.1.1.GA.jar:]
      at org.jboss.seam.ui.util.cdk.RendererBase.renderChildren(RendererBase.java:166) [jboss-seam-ui-2.1.1.GA.jar:]
      at org.jboss.seam.ui.renderkit.DecorateRendererBase.doEncodeChildren(DecorateRendererBase.java:146) [jboss-seam-ui-2.1.1.GA.jar:]
      at org.jboss.seam.ui.util.cdk.RendererBase.encodeChildren(RendererBase.java:92) [jboss-seam-ui-2.1.1.GA.jar:]
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:840) [jsf-api-1.2_15-jbossorg-2.jar:1.2_15.jbossorg-1-20111019-SNAPSHOT]
      at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:236) [jsf-impl-1.2_15-jbossorg-2.jar:1.2_15.jbossorg-1-20111019-SNAPSHOT]
      at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:180) [jsf-impl-1.2_15-jbossorg-2.jar:1.2_15.jbossorg-1-20111019-SNAPSHOT]
      at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:127) [jsf-impl-1.2_15-jbossorg-2.jar:1.2_15.jbossorg-1-20111019-SNAPSHOT]
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:840) [jsf-api-1.2_15-jbossorg-2.jar:1.2_15.jbossorg-1-20111019-SNAPSHOT]
      at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:277) [richfaces-impl-3.3.1.GA.jar:]
      at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258) [richfaces-impl-3.3.1.GA.jar:]
      at org.richfaces.renderkit.html.SimpleToggleControlTemplate.doEncodeChildren(SimpleToggleControlTemplate.java:347) [richfaces-ui-3.3.1.GA.jar:]
      at org.richfaces.renderkit.html.SimpleToggleControlTemplate.doEncodeChildren(SimpleToggleControlTemplate.java:342) [richfaces-ui-3.3.1.GA.jar:]
      at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:120) [richfaces-impl-3.3.1.GA.jar:]
      at org.richfaces.renderkit.html.SimpleTogglePanelRenderer.encodeChildren(SimpleTogglePanelRenderer.java:186) [richfaces-ui-3.3.1.GA.jar:]
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:840) [jsf-api-1.2_15-jbossorg-2.jar:1.2_15.jbossorg-1-20111019-SNAPSHOT]
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:930) [jsf-api-1.2_15-jbossorg-2.jar:1.2_15.jbossorg-1-20111019-SNAPSHOT]
      at javax.faces.render.Renderer.encodeChildren(Renderer.java:148) [jsf-api-1.2_15-jbossorg-2.jar:1.2_15.jbossorg-1-20111019-SNAPSHOT]
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:840) [jsf-api-1.2_15-jbossorg-2.jar:1.2_15.jbossorg-1-20111019-SNAPSHOT]
      at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:277) [richfaces-impl-3.3.1.GA.jar:]
      at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258) [richfaces-impl-3.3.1.GA.jar:]
      at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:220) [richfaces-ui-3.3.1.GA.jar:]
      at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:215) [richfaces-ui-3.3.1.GA.jar:]
      at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:120) [richfaces-impl-3.3.1.GA.jar:]
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:840) [jsf-api-1.2_15-jbossorg-2.jar:1.2_15.jbossorg-1-20111019-SNAPSHOT]
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:930) [jsf-api-1.2_15-jbossorg-2.jar:1.2_15.jbossorg-1-20111019-SNAPSHOT]
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:933) [jsf-api-1.2_15-jbossorg-2.jar:1.2_15.jbossorg-1-20111019-SNAPSHOT]
      at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592) [jsf-facelets-1.1.15.B1.jar:]
      at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100) [richfaces-api-3.3.1.GA.jar:]
      at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176) [richfaces-impl-3.3.1.GA.jar:]
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110) [jsf-impl-1.2_15-jbossorg-2.jar:1.2_15.jbossorg-1-20111019-SNAPSHOT]
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) [jsf-impl-1.2_15-jbossorg-2.jar:1.2_15.jbossorg-1-20111019-SNAPSHOT]
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-1.2_15-jbossorg-2.jar:1.2_15.jbossorg-1-20111019-SNAPSHOT]
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266) [jsf-api-1.2_15-jbossorg-2.jar:1.2_15.jbossorg-1-20111019-SNAPSHOT]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.7.Final.jar:]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.7.Final.jar:]
      at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:115) [prettyfaces-jsf12-3.2.0.jar:]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.7.Final.jar:]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.7.Final.jar:]
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734) [jbossweb-7.0.7.Final.jar:]
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:541) [jbossweb-7.0.7.Final.jar:]
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:479) [jbossweb-7.0.7.Final.jar:]
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:407) [jbossweb-7.0.7.Final.jar:]
      at org.jboss.seam.web.RewriteFilter.process(RewriteFilter.java:98) [jboss-seam.jar:]
      at org.jboss.seam.web.RewriteFilter.doFilter(RewriteFilter.java:57) [jboss-seam.jar:]
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]
      at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90) [jboss-seam.jar:]
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]
      at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) [jboss-seam.jar:]
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]
      at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) [jboss-seam.jar:]
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]
      at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178) [richfaces-impl-3.3.1.GA.jar:]
      at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) [richfaces-impl-3.3.1.GA.jar:]
      at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368) [richfaces-impl-3.3.1.GA.jar:]
      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495) [richfaces-impl-3.3.1.GA.jar:]
      at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56) [jboss-seam.jar:]
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]
      at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60) [jboss-seam.jar:]
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]
      at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53) [jboss-seam.jar:]
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]
      at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) [jboss-seam.jar:]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.7.Final.jar:]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.7.Final.jar:]
      at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:115) [prettyfaces-jsf12-3.2.0.jar:]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.7.Final.jar:]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.7.Final.jar:]
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.7.Final.jar:]
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.7.Final.jar:]
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:397) [jbossweb-7.0.7.Final.jar:]
      at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.0.CR1b.jar:7.1.0.CR1b]
      at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:151) [jboss-as-web-7.1.0.CR1b.jar:7.1.0.CR1b]
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.7.Final.jar:]
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.7.Final.jar:]
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.7.Final.jar:]
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.7.Final.jar:]
      at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897) [jbossweb-7.0.7.Final.jar:]
      at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:626) [jbossweb-7.0.7.Final.jar:]
      at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2033) [jbossweb-7.0.7.Final.jar:]
      at java.lang.Thread.run(Thread.java:662) [:1.6.0_25]
      Caused by: java.lang.RuntimeException: could not proxy delegate
      at org.jboss.seam.persistence.HibernatePersistenceProvider.proxyDelegate(HibernatePersistenceProvider.java:148) [jboss-seam.jar:]
      at org.jboss.seam.persistence.EntityManagerProxy.getDelegate(EntityManagerProxy.java:97) [jboss-seam.jar:]
      at org.jboss.seam.persistence.HibernatePersistenceProvider.getSession(HibernatePersistenceProvider.java:381) [jboss-seam.jar:]
      at org.jboss.seam.persistence.HibernatePersistenceProvider.setFlushModeManual(HibernatePersistenceProvider.java:157) [jboss-seam.jar:]
      at org.jboss.seam.persistence.ManagedPersistenceContext.setEntityManagerFlushMode(ManagedPersistenceContext.java:316) [jboss-seam.jar:]
      at org.jboss.seam.persistence.ManagedPersistenceContext.initEntityManager(ManagedPersistenceContext.java:81) [jboss-seam.jar:]
      at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManager(ManagedPersistenceContext.java:107) [jboss-seam.jar:]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_25]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_25]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_25]
      at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_25]
      at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) [jboss-seam.jar:]
      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) [jboss-seam.jar:]
      at org.jboss.seam.Component.callComponentMethod(Component.java:2249) [jboss-seam.jar:]
      at org.jboss.seam.Component.unwrap(Component.java:2275) [jboss-seam.jar:]
      at org.jboss.seam.Component.getInstance(Component.java:2041) [jboss-seam.jar:]
      at org.jboss.seam.Component.getInstance(Component.java:1983) [jboss-seam.jar:]
      at org.jboss.seam.Component.getInstance(Component.java:1977) [jboss-seam.jar:]
      at org.jboss.seam.Component.getInstanceInAllNamespaces(Component.java:2349) [jboss-seam.jar:]
      at org.jboss.seam.Component.getValueToInject(Component.java:2301) [jboss-seam.jar:]
      at org.jboss.seam.Component.injectAttributes(Component.java:1736) [jboss-seam.jar:]
      at org.jboss.seam.Component.inject(Component.java:1554) [jboss-seam.jar:]
      at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:61) [jboss-seam.jar:]
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam.jar:]
      at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:97) [jboss-seam.jar:]
      at org.jboss.seam.util.Work.workInTransaction(Work.java:47) [jboss-seam.jar:]
      at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:91) [jboss-seam.jar:]
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam.jar:]
      at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) [jboss-seam.jar:]
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam.jar:]
      at org.jboss.seam.security.SecurityInterceptor.aroundInvoke(SecurityInterceptor.java:163) [jboss-seam.jar:]
      at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam.jar:]
      at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) [jboss-seam.jar:]
      at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185) [jboss-seam.jar:]
      at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103) [jboss-seam.jar:]
      at dne.nmst.ond.action.OfficeTagsBean_$$_javassist_seam_3.create(OfficeTagsBean_$$_javassist_seam_3.java) [ond-ejb.jar:]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_25]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_25]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_25]
      at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_25]
      at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) [jboss-seam.jar:]
      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) [jboss-seam.jar:]
      at org.jboss.seam.Component.callComponentMethod(Component.java:2249) [jboss-seam.jar:]
      at org.jboss.seam.Component.callCreateMethod(Component.java:2172) [jboss-seam.jar:]
      at org.jboss.seam.Component.newInstance(Component.java:2132) [jboss-seam.jar:]
      ... 101 more
      Caused by: java.lang.ClassCastException: org.hibernate.internal.SessionImpl cannot be cast to org.hibernate.Session
      at org.jboss.seam.persistence.HibernatePersistenceProvider.proxyDelegate(HibernatePersistenceProvider.java:140) [jboss-seam.jar:]
      ... 145 more

       

        • 1. Re: org.hibernate.internal.SessionImpl cannot be cast to org.hibernate.Session
          Scott Marlow Master

          Tanya,

           

          After a recent exploration of another issue, I suspect that Seam is actually using the Hibernate 4 module, which is (globally) available via the javax.persistence.Persistence.createEntityManager/createEntityManager methods. 

           

          To verify this, could you try to enable TRACE logging for org.hibernate?  Then attach the as7/standalone/log/server.log here.  An example of setting the logging settings can be found here (just search for troubleshooting).

           

          Scott

          • 2. Re: org.hibernate.internal.SessionImpl cannot be cast to org.hibernate.Session
            Tanya Ruttenberg Expert

            Thanks for the quick response.  Let me know what you find out.

            TDR

            • 3. Re: org.hibernate.internal.SessionImpl cannot be cast to org.hibernate.Session
              Scott Marlow Master

              Even though you have excluded the Hibernate 4.0.1.Final jars (org.hibernate:main), it is still being used in your application deployment.  We determined the same thing was happening in forum thread https://community.jboss.org/message/717160 which took a bit of discussion and exploration before we realized this.  You might want to follow that thread as well (especially the part about trying to use Hibernate 4 with Seam 2.x).

               

              I'm trying to see if I can address this with changes for jira AS7-3423.  You might want to watch that jira for changes (you can register to be notified via email).

               

              13:53:29,978 DEBUG [org.hibernate.type.BasicTypeRegistry] (MSC service thread 1-2) Adding type registration imm_binary -> org.hibernate.type.AdaptedImmutableType@10fbe75

              13:53:29,978 DEBUG [org.hibernate.type.BasicTypeRegistry] (MSC service thread 1-2) Adding type registration imm_serializable -> org.hibernate.type.AdaptedImmutableType@a0ff27

              13:53:29,991 INFO  [org.hibernate.annotations.common.Version] (MSC service thread 1-2) HCANN000001: Hibernate Commons Annotations {4.0.1.Final}

              13:53:29,995 INFO  [org.hibernate.Version] (MSC service thread 1-2) HHH000412: Hibernate Core {4.0.0.Final}

              13:53:29,996 INFO  [org.hibernate.cfg.Environment] (MSC service thread 1-2) HHH000206: hibernate.properties not found

              13:53:29,998 INFO  [org.hibernate.cfg.Environment] (MSC service thread 1-2) HHH000021: Bytecode provider name : javassist

              13:53:30,007 DEBUG [org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory] (MSC service thread 1-2) Registering IdentifierGenerator strategy [uuid2] -> [org.hibernate.id.UUIDGenerator]

              13:53:30,007 DEBUG [org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory] (MSC service thread 1-2) Registering IdentifierGenerator strategy [guid] -> [org.hibernate.id.GUIDGenerator]

              • 4. Re: org.hibernate.internal.SessionImpl cannot be cast to org.hibernate.Session
                Tanya Ruttenberg Expert

                Thanks Scott. That is one of the forum postings I read.  I'll check it out more closely now that I'm sure it applies to us.

                I also signed on to the watch list for that JIRA.

                 

                I really like JBoss 7 so far, btw.  Great work you guys!

                 

                TDR

                • 5. Re: org.hibernate.internal.SessionImpl cannot be cast to org.hibernate.Session
                  Tanya Ruttenberg Expert

                  I have read through that other discussion https://community.jboss.org/message/717160  and basically understood it, but was unclear as to the conclusion.  I have tried a whole bunch of things ar this point and nothing works.

                   

                  I got all parts of my app  to build against the following hibernate libraries

                   

                  hibnernate-core-4.1.0.Final

                  hibernate-validator-3.1.0.GA

                  hibernate-entitymanager-4.0.1.Final

                   

                  I even built seam 2.5-SNAPSHOT.  My app built and deployed without a problem.

                  My EAR/lib contents:

                   

                  antlr-runtime-3.2.jar
                  bsh-2.0b4.jar
                  commons-collections-3.2.jar
                  dne-exception-1.0.0.jar
                  dom4j-1.6.1-brew.jar
                  freemarker-2.3.8.jar
                  gwt-servlet-2.4.0.jar
                  hibernate-annotations-3.5.6-Final.jar
                  hibernate-commons-annotations-4.0.1.Final.jar
                  hibernate-core-4.1.0.Final.jar
                  hibernate-entitymanager-4.1.0.Final.jar
                  hibernate-envers-3.6.7.Final.jar
                  hibernate-jpa-2.0-api-1.0.1.Final.jar
                  hibernate-tools-3.2.0.ga.jar
                  hibernate-validator-3.1.0.GA.jar
                  javassist-3.15.0-GA.jar
                  jboss-el-1.0_02.CR5.jar
                  jboss-logging-3.1.0.CR2.jar
                  jboss-seam-remoting-2.5-SNAPSHOT.jar
                  jboss-transaction-api_1.1_spec-1.0.0.Final.jar
                  jtidy-r8-20060801.jar
                  richfaces-api-3.3.1.GA.jar
                  slf4j-api-1.6.4.jar
                  slf4j-log4j12-1.6.4.jar

                   

                  Not a single thing has ultimately changed.  I hit some snags on the way and got some variation in errors, but once I got those ironed out, I remain stuck with the error described above.

                   

                  Does that mean anything?  Am I still unwittingly using hibernate 3 somewhere and don't know it?

                   

                  I have been looking at this for so long I feel a little like I am in twilight zone.  I'd love to hear any other ideas.  I hate to admit defeat and I really hate to have to go back to JBoss 5 (too much waiting around), but maybe I should just wait for 7.1.1.Final.

                   

                  TDR

                  • 6. Re: org.hibernate.internal.SessionImpl cannot be cast to org.hibernate.Session
                    Scott Marlow Master

                    I'm still working on a solution but am wondering if you have tried removing the hibernate-jpa-2.0-api-1.0.1.Final.jar?  That could be causing some issues (since it can cause ClassCastExceptions with the javax.persistence.api module that has the same classes).

                    • 9. Re: org.hibernate.internal.SessionImpl cannot be cast to org.hibernate.Session
                      Marek Novotny Master

                      Scott Marlow wrote:

                       

                      Even though you have excluded the Hibernate 4.0.1.Final jars (org.hibernate:main), it is still being used in your application deployment.  We determined the same thing was happening in forum thread https://community.jboss.org/message/717160 which took a bit of discussion and exploration before we realized this.  You might want to follow that thread as well (especially the part about trying to use Hibernate 4 with Seam 2.x).

                       

                      I'm trying to see if I can address this with changes for jira AS7-3423.  You might want to watch that jira for changes (you can register to be notified via email).

                       

                      13:53:29,978 DEBUG [org.hibernate.type.BasicTypeRegistry] (MSC service thread 1-2) Adding type registration imm_binary -> org.hibernate.type.AdaptedImmutableType@10fbe75

                      13:53:29,978 DEBUG [org.hibernate.type.BasicTypeRegistry] (MSC service thread 1-2) Adding type registration imm_serializable -> org.hibernate.type.AdaptedImmutableType@a0ff27

                      13:53:29,991 INFO  [org.hibernate.annotations.common.Version] (MSC service thread 1-2) HCANN000001: Hibernate Commons Annotations {4.0.1.Final}

                      13:53:29,995 INFO  [org.hibernate.Version] (MSC service thread 1-2) HHH000412: Hibernate Core {4.0.0.Final}

                      13:53:29,996 INFO  [org.hibernate.cfg.Environment] (MSC service thread 1-2) HHH000206: hibernate.properties not found

                      13:53:29,998 INFO  [org.hibernate.cfg.Environment] (MSC service thread 1-2) HHH000021: Bytecode provider name : javassist

                      13:53:30,007 DEBUG [org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory] (MSC service thread 1-2) Registering IdentifierGenerator strategy [uuid2] -> [org.hibernate.id.UUIDGenerator]

                      13:53:30,007 DEBUG [org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory] (MSC service thread 1-2) Registering IdentifierGenerator strategy [guid] -> [org.hibernate.id.GUIDGenerator]

                      Tanya, you need to exclude the hibernate main slot also in EJB module.

                      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
                      ... 
                      
                        <sub-deployment name="ond-ejb.jar">
                          <exclusions>
                            <module name="org.hibernate" />
                          </exclusions>
                        </sub-deployment>
                      
                      ...
                      
                      
                      </jboss-deployment-structure>
                      
                      • 10. Re: org.hibernate.internal.SessionImpl cannot be cast to org.hibernate.Session
                        Marek Novotny Master

                        Tanya Ruttenberg wrote:

                         

                        I just tried it. Same problem.

                        Tanya, everywhere you or Seam uses hibernate has to be exclusion of main hibernate slot. If you give a try and for sure insert the exclusion everywhere, you shouldn't see Hibernate Core {4.0.x.Final}.

                         

                        I just can point you to my blog https://community.jboss.org/blogs/marek-novotny/2011/12/16/dvdstore-migration-for-jboss-as-710beta, which covers all migration required steps for Seam 2.2.2.Final and Hibernate 3.

                         

                         


                        • 11. Re: org.hibernate.internal.SessionImpl cannot be cast to org.hibernate.Session
                          Marek Novotny Master

                          As a side note, migrated Dvdstore from my blog is still working on AS 7.1.0.Final.

                          • 12. Re: org.hibernate.internal.SessionImpl cannot be cast to org.hibernate.Session
                            Tanya Ruttenberg Expert

                            Thanks to all who have replied for your answers hear and your various writings elsewhere in forums, blogs, etc.  I have read them all I think by now!!

                             

                            Here is where I am currently holding with this:

                             

                            I fully reverted by to my original configuration of Seam-2.2.2.Final w/Hibernate 3 libraries. 

                            I got to the point where all references to Hibernate 4 were replaced with references to Hibernate 3 when I deployed my app.  However, I was still getting the following error while deploying EJB's:

                             

                            java.lang.ClassCastException: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider cannot be cast to org.hibernate.service.jdbc.connections.spi.ConnectionProvider

                             

                            I figured out via reading someone's posting somewhere  to add this to my persistence.xml

                             

                            <property name="jboss.as.jpa.providerModule" value="hibernate3-bundled">

                             

                            I think because I am using pre-Hibernate 3.5 libraries that this didn't apply to me. Whatever, it got rid of the above error.  I am now working on an ANTLR error, but I'm optimistic I can sort that one out myself.  FTR it is this

                             

                            java.lang.ClassNotFoundException: antlr.ANTLRException

                             

                            Making progress!

                            • 13. Re: org.hibernate.internal.SessionImpl cannot be cast to org.hibernate.Session
                              Marek Novotny Master

                              Tanya,

                               

                              that is great that you got to the next point.

                               

                              Using

                              <property name="jboss.as.jpa.providerModule" value="hibernate3-bundled">

                              is the right approach and if you are using hibernate core 3.3/3.4 aka JPA 1. then only possible way how to configure bundled hibernate libs in your application.

                               

                              For antlr exception, just include in jboss-deployment-structure.xml file org.antlr main module (see documentation for classloading in AS7 - https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7)

                               

                              <dependencies>
                                    <module name="org.antlr" export="true" />
                              </dependencies>
                              


                              • 14. Re: org.hibernate.internal.SessionImpl cannot be cast to org.hibernate.Session
                                Tanya Ruttenberg Expert

                                Thanks. Happy to report I figured out the antlr error before you posted your reply.

                                 

                                The last piece is I had to explicitly add <class>this.is.my.entity.Class</class> to each persistence.xml things started to really work.

                                 

                                I'm now stuck on this error, but I will open a new discussion if I can't find the answer posted already

                                 

                                ARJUNA012140: Adding multiple last resources is disallowed. Trying to add LastResourceRecord

                                 

                                TDR

                                 

                                1 2 Previous Next