4 Replies Latest reply on Jan 15, 2010 9:27 AM by a a

    java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence

    a a Newbie

      Hi

       

      I am getting the following error when trying to log into application which I have deployed on the jboss 5.0.1 server:

       

      java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence

       

      Anyone shed some light on this?

       

      thanks

        • 1. Re: java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence
          jaikiran pai Master

          That single line of log is not going to help in identifying the issue. Please post the entire exception stacktrace and some details around when this happens and some information about your application.

           

          By the way, the latest stable 5.x series AS is 5.1.0. You might want to upgrade to that.

          • 2. Re: java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence
            a a Newbie

            2010-01-15 10:40:15,898 ERROR [javax.enterprise.resource.webcontainer.jsf.application] (http-127.0.0.1-8080-1) /login.xhtml @70,88 action

            ="#{loginBean.login}": java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence
            javax.faces.el.EvaluationException: /login.xhtml @70,88 action="#{loginBean.login}": java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence
                at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
                at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
                at com.icesoft.faces.component.ext.HtmlInputText.broadcast(HtmlInputText.java:713)
                at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
                at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
                at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
                at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
                at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
                at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
                at com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:17)
                at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCycle(ReceiveSendUpdates.java:94)
                at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:54)
                at com.icesoft.faces.webapp.http.core.RequestVerifier.service(RequestVerifier.java:26)
                at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:24)
                at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:160)
                at com.icesoft.faces.webapp.http.servlet.SessionDispatcher$1.service(SessionDispatcher.java:38)
                at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
                at com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:63)
                at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:55)
                at com.icesoft.faces.webapp.http.servlet.SessionVerifier.service(SessionVerifier.java:19)
                at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23)
                at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:91)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
                at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:56)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
                at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
                at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
                at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                at java.lang.Thread.run(Thread.java:595)
            Caused by: java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence
                at javax.persistence.Persistence.findAllProviders(Persistence.java:186)
                at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:103)
                at com.talgentra.tallyman.admin.util.EntityManagerFactoryAccessor.<init>(EntityManagerFactoryAccessor.java:33)
                at com.talgentra.tallyman.admin.util.EntityManagerFactoryAccessor.getInstance(EntityManagerFactoryAccessor.java:52)
                at com.talgentra.tallyman.admin.util.EntityManagerFactoryAccessor.getEntityManagerFactory(EntityManagerFactoryAccessor.java:45)
                at com.talgentra.tallyman.domain.dao.implementation.BaseJpaImpl.getEntityManagerFactory(BaseJpaImpl.java:19)
                at com.talgentra.tallyman.domain.dao.implementation.ServerConfigJpaImpl.findAll(ServerConfigJpaImpl.java:78)
                at com.talgentra.tallyman.domain.dao.implementation.ServerConfigJpaImpl.findAll(ServerConfigJpaImpl.java:27)
                at com.talgentra.tallyman.domain.facade.DefaultServerConfigFacade.getAll(DefaultServerConfigFacade.java:78)
                at com.talgentra.tallyman.admin.delegates.DefaultServerConfigBD.refresh(DefaultServerConfigBD.java:92)
                at com.talgentra.tallyman.admin.delegates.DefaultServerConfigBD.getAll(DefaultServerConfigBD.java:59)
                at com.talgentra.tallyman.admin.delegates.DefaultOperationConfigBD.refreshServerOperationVOList(DefaultOperationConfigBD.java:155)
                at com.talgentra.tallyman.admin.beans.security.LoginBean.login(LoginBean.java:44)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:585)
                at org.apache.el.parser.AstValue.invoke(AstValue.java:170)
                at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
                at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
                at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
                ... 43 more

             

             

            This is the error stack that I get. I am logging into an application which I deployed from a war file. When I run the application I can see the login page but when I log in it shows the error message above. Running on a seperate tomcat I can log into the app so I know it works fine.

            • 3. Re: java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence
              jaikiran pai Master

              Which JPA implementation are you trying to use? Do you have a persistence.xml file in your application? What does it look like?

              • 4. Re: java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence
                a a Newbie

                Hi

                 

                Yes I have a persistence.xml file which is as below:

                 

                 

                <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">

                 

                    <persistence-unit name="test" transaction-type="RESOURCE_LOCAL">
                        <provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>

                 

                        <class>com.talgentra.tallyman.domain.model.admin.ServerConfigImpl</class>
                        <class>com.talgentra.tallyman.domain.model.admin.JobConfigImpl</class>
                        <class>com.talgentra.tallyman.domain.model.admin.OperationLogConfigImpl</class>
                        <class>com.talgentra.tallyman.domain.model.admin.OperationTaskConfigImpl</class>
                        <class>com.talgentra.tallyman.domain.model.admin.ScheOperationConfigImpl</class>

                 

                        <properties>
                            <property name="toplink.logging.level" value="INFO"/>
                        </properties>
                    </persistence-unit>

                 

                </persistence>

                 

                 

                Hope this is what you wanted.

                 

                Thanks