4 Replies Latest reply on Jul 4, 2008 10:23 AM by Carlos Delfino

    Could not deploy EJB3.0 entities

    Samba Kolusu Newbie

      Hi!

      I'm new to JBoss
      And I'm trying to test the EJB3.0 support in JBoss 4.2.1.GA server

      Here is my persistence.xml

      <?xml version="1.0" encoding="UTF-8" ?>
      <persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
      version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">

      <persistence-unit name="Model" transaction-type="JTA">

      org.hibernate.ejb.HibernatePersistence

      <jta-data-source>java:jdbc/OracleDS </jta-data-source>






      <!-- <jar-file>TestModel.jar</jar-file>
      com.prapansol.demos.model.Emp
      com.prapansol.demos.model.Dept

      <exclude-unlisted-classes>true</exclude-unlisted-classes>
      -->




      </persistence-unit>


      I'm getting the error :


       Problem starting service persistence.units:ear=TestModel.ear,jar=TestModel.jar,unitName=Model
      java.lang.RuntimeException: java.lang.NoSuchFieldError: tokenTypeToASTClassMap
       at org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:109)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
       at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
       at $Proxy0.start(Unknown Source)
       at org.jboss.system.ServiceController.start(ServiceController.java:417)
       at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      


      Can any one tell me what could be causing this problem , and a solution to this, if possible!

      Thanks in advance,
      Samba

        • 1. Re: Could not deploy EJB3.0 entities
          Samba Kolusu Newbie

          Hello, I changed the antlr.jar in the server's default instance's lib directory, and
          put antlr-2.7.6 jar , and restarted the server, and that's it..

          It now worked fine..

          • 2. Re: Could not deploy EJB3.0 entities
            Samba Kolusu Newbie

            Hello to all,

            Now,having got EJB3.0 working with Hibernate,
            I'm set to deploy EJB 3.0 application using toplink as Persistence Provider..

            But I'm getting the following error :

            
            Persistence Unit Model; state Deployed; factoryCount 1
            03:02:15,952 ERROR [STDERR] javax.persistence.TransactionRequiredException:
            Exception Description: No transaction is currently active
            03:02:15,953 ERROR [STDERR] at oracle.toplink.essentials.internal.ejb.cmp3.transaction.EntityTransactionWrapper.throwCheckTransactionFailedException(EntityTransactionWrapper.java:70)
            03:02:15,953 ERROR [STDERR] at hibernate.transaction.manager_lookup_classoracle.toplink.essentials.internal.ejb.cmp3.transaction.base.EntityTransactionWrapper.checkForTransaction(EntityTransactionWrapper.java:62)
            03:02:15,953 ERROR [STDERR] at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl.checkForTransaction(EntityManagerImpl.java:616)
            03:02:15,953 ERROR [STDERR] at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl.joinTransaction(EntityManagerImpl.java:646)
            03:02:15,953 ERROR [STDERR] at org.jboss.ejb3.entity.ManagedEntityManagerFactory.getTransactionScopedEntityManager(ManagedEntityManagerFactory.java:183)
            03:02:15,953 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManager.persist(TransactionScopedEntityManager.java:182)
            03:02:15,954 ERROR [STDERR] at com.prapansol.demos.service.SRServiceBean.persistEntity(SRServiceBean.java:76)
            



            In Hibernate we have
            hibernate.transaction.manager_lookup_class
            How can we make toplink look up the JBossTransactionManager class?

            Any idea?
            Thnks for your help in advance,
            Samba

            • 3. Re: Could not deploy EJB3.0 entities
              Samba Kolusu Newbie

              Hi!

              I'm able clear this hurdle, in sense that I am able to assign the JBosstransactionManager to the toplink TransactionController by specifying a Session Customizer class in the persistence.xml , and then in the customize method the the SessionCustomizer Class I added a listener class in which prelogin method I 've forced toplink to use ExternaltransactionController...

              All this below:

              
               <property name="toplink.session.customizer" value="com.prapansol.demos.service.JBossTransactionConfigurator"/>
              
              And In the "customize" method of that class I added a SessionEventListener as below :
              
               public class JBossTransactionConfigurator implements SessionCustomizer{
               public void customize(Session session) {
              
              
               session.getActiveSession().getEventManager().addListener(new
              JBossSessionPreLoginListener());
              
               }
              }
              
              
              



              And in the "prelogin" method of My SessionEvent Listener class , I added the Server platform, and JTATransactionController as shown below:

              public class JBossSessionPreLoginListener extends SessionEventAdapter{
               public void preLogin(SessionEvent event) {
              
               Session session = event.getSession();
               session.logMessage("Initializing JBossPlatform ......");
               session.getLogin().setPlatformClassName("oracle.toplink.essentials.platform.server.jboss.JBossPlatform");
               //session.getLogin().setUsesExternalTransactionController(true);
               session.getLogin().useExternalTransactionController();
               session.getActiveSession().logMessage("Initializing JBossTransaction Controller ......");
               session.setExternalTransactionController(new JBossTransactionController());
               session.getActiveSession().logMessage("Successfully Configured JBossTransactionController ....");
              
               }
              }
              
              


              But , I'm getting the error when the bean is requested from a JSP or a backing bean of JSF page:
               UnitOfWork(8650745)--Thread(Thread[http-127.0.0.1-8080-1,5,jboss])--TX binding to tx mgr, status=STATUS_ACTIVE
              11:23:14,923 ERROR [STDERR] java.lang.IllegalArgumentException: Object: com.prapansol.demos.model.Emp@a3aaf5 is not a known entity type.
              11:23:14,924 ERROR [STDERR] at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.registerNewObjectForPersist(UnitOfWorkImpl.java:3198)
              11:23:14,924 ERROR [STDERR] at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl.persist(EntityManagerImpl.java:190)
              11:23:14,924 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManager.persist(TransactionScopedEntityManager.java:182)
              11:23:14,924 ERROR [STDERR] at com.prapansol.demos.service.SRServiceBean.persistEntity(SRServiceBean.java:76)
              11:23:14,924 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              11:23:14,924 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              11:23:14,924 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              11:23:14,924 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
              11:23:14,924 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
              11:23:14,924 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
              11:23:14,924 ERROR [STDERR] at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
              11:23:14,924 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              11:23:14,924 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
              11:23:14,925 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              11:23:14,925 ERROR [STDERR] at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
              11:23:14,925 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              11:23:14,925 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
              11:23:14,925 ERROR [STDERR] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
              11:23:14,925 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              11:23:14,925 ERROR [STDERR] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
              11:23:14,925 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              11:23:14,925 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
              11:23:14,925 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              11:23:14,925 ERROR [STDERR] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
              11:23:14,925 ERROR [STDERR] at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
              11:23:14,925 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              11:23:14,925 ERROR [STDERR] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
              11:23:14,925 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              11:23:14,925 ERROR [STDERR] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
              11:23:14,925 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
              11:23:14,926 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:214)
              11:23:14,926 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:184)
              11:23:14,926 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:81)
              11:23:14,926 ERROR [STDERR] at $Proxy96.persistEntity(Unknown Source)
              11:23:14,926 ERROR [STDERR] at org.apache.jsp.oracleTest_jsp._jspService(oracleTest_jsp.java:142)
              11:23:14,926 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
              11:23:14,926 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
              11:23:14,926 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387)
              11:23:14,926 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
              11:23:14,926 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
              11:23:14,926 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
              11:23:14,927 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              11:23:14,927 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              11:23:14,927 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
              11:23:14,927 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              11:23:14,927 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              11:23:14,927 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
              11:23:14,927 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
              11:23:14,927 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
              11:23:14,927 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
              11:23:14,927 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
              11:23:14,927 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
              11:23:14,927 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
              11:23:14,927 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              11:23:14,927 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
              11:23:14,927 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
              11:23:14,927 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
              11:23:14,928 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
              11:23:14,928 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
              11:23:14,930 INFO [STDOUT] [TopLink Finer]: 2007.11.11 11:23:14.929--UnitOfWork(8650745)--Thread(Thread[http-127.0.0.1-8080-1,5,jboss])--TX afterCompletion callback, status=ROLLEDBACK
              11:23:14,930 INFO [STDOUT] [TopLink Finer]: 2007.11.11 11:23:14.930--UnitOfWork(8650745)--Thread(Thread[http-127.0.0.1-8080-1,5,jboss])--release unit of work
              11:23:14,930 INFO [STDOUT] [TopLink Finer]: 2007.11.11 11:23:14.930--UnitOfWork(8650745)--Thread(Thread[http-127.0.0.1-8080-1,5,jboss])--initialize identitymaps
              11:23:14,931 INFO [STDOUT] [TopLink Finer]: 2007.11.11 11:23:14.931--ClientSession(21410136)--Thread(Thread[http-127.0.0.1-8080-1,5,jboss])--client released
              
              






              It seems the toplink entitiyManager is still not recognizing the entities created ... or may be they were not created as the Warning Messages displayed at the deployment time indicate :
              ServerSession(26489568)--Thread(Thread[main,5,jboss])--property=toplink.orm.throw.exceptions; default value=true
              11:22:56,899 INFO [STDOUT] [TopLink Finer]: 2007.11.11 11:22:56.899--ServerSession(26489568)--Thread(Thread[main,5,jboss])--Searching for default mapping file in file:/u01/home/developer/jboss-4.2.1.GA/server/default/tmp/deploy/tmp51731TestModel.ear-contents/TestModel.jar
              11:22:56,909 INFO [STDOUT] [TopLink Warning]: 2007.11.11 11:22:56.909--Thread(Thread[main,5,jboss])--java.lang.NullPointerException: null was thrown on attempt of PersistenceLoadProcessor to load class com.prapansol.demos.model.Emp. The class is ignored.
              11:22:56,911 INFO [STDOUT] [TopLink Warning]: 2007.11.11 11:22:56.910--Thread(Thread[main,5,jboss])--java.lang.NullPointerException: null was thrown on attempt of PersistenceLoadProcessor to load class com.prapansol.demos.model.Dept. The class is ignored.
              11:22:56,913 INFO [STDOUT] [TopLink Warning]: 2007.11.11 11:22:56.912--Thread(Thread[main,5,jboss])--java.lang.NullPointerException: null was thrown on attempt of PersistenceLoadProcessor to load class com.prapansol.demos.model.Dept. The class is ignored.
              11:22:56,914 INFO [STDOUT] [TopLink Warning]: 2007.11.11 11:22:56.913--Thread(Thread[main,5,jboss])--java.lang.NullPointerException: null was thrown on attempt of PersistenceLoadProcessor to load class com.prapansol.demos.model.Emp. The class is ignored.
              11:22:56,915 INFO [STDOUT] [TopLink Warning]: 2007.11.11 11:22:56.914--Thread(Thread[main,5,jboss])--java.lang.NullPointerException: null was thrown on attempt of PersistenceLoadProcessor to load class com.prapansol.demos.service.SRServiceBean. The class is ignored.
              11:22:56,916 INFO [STDOUT] [TopLink Warning]: 2007.11.11 11:22:56.915--Thread(Thread[main,5,jboss])--java.lang.NullPointerException: null was thrown on attempt of PersistenceLoadProcessor to load class com.prapansol.demos.service.JBossTransactionConfigurator. The class is ignored.
              11:22:56,917 INFO [STDOUT] [TopLink Warning]: 2007.11.11 11:22:56.916--Thread(Thread[main,5,jboss])--java.lang.NullPointerException: null was thrown on attempt of PersistenceLoadProcessor to load class com.prapansol.demos.service.SRService. The class is ignored.
              11:22:56,918 INFO [STDOUT] [TopLink Warning]: 2007.11.11 11:22:56.918--Thread(Thread[main,5,jboss])--java.lang.NullPointerException: null was thrown on attempt of PersistenceLoadProcessor to load class com.prapansol.demos.service.SRServiceLocal. The class is ignored.
              11:22:56,919 INFO [STDOUT] [TopLink Warning]: 2007.11.11 11:22:56.919--Thread(Thread[main,5,jboss])--java.lang.NullPointerException: null was thrown on attempt of PersistenceLoadProcessor to load class com.prapansol.demos.service.JBossSessionPreLoginListener. The class is ignored.
              11:22:56,925 INFO [STDOUT] [TopLink Finest]: 2007.11.11 11:22:56.925--ServerSession(26489568)--Thread(Thread[main,5,jboss])--end predeploying Persistence Unit Model; state Predeployed; factoryCount 1
               creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
              11:22:56,950 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=TestModel.ear,jar=TestModel.jar,name=SRService,service=EJB3 with dependencies:
              11:22:56,950 INFO [JmxKernelAbstraction] persistence.units:ear=TestModel.ear,jar=TestModel.jar,unitName=Model
              11:22:56,984 INFO [EJBContainer] STARTED EJB: com.prapansol.demos.service.SRServiceBean ejbName: SRService
              11:22:57,005 INFO [EJB3Deployer] Deployed: file:/u01/home/developer/jboss-4.2.1.GA/server/default/tmp/deploy/tmp51731TestModel.ear-contents/TestModel.jar
              11:22:57,010 INFO [EARDeployer] Started J2EE application: file:/u01/home/developer/jboss-4.2.1.GA/server/default/deploy/TestModel.ear
              11:22:58,179 INFO [EARDeployer] Init J2EE application: file:/u01/home/developer/jboss-4.2.1.GA/server/default/deploy/UserInterface.ear
              11:22:59,054 INFO [TomcatDeployer] deploy, ctxPath=/UI, warUrl=.../tmp/deploy/tmp51732UserInterface.ear-contents/UserInterface-exp.war/
              11:23:03,302 INFO [EARDeployer] Started J2EE application: file:/u01/home/developer/jboss-4.2.1.GA/server/default/deploy/UserInterface.ear
              11:23:03,509 INFO [EARDeployer] Init J2EE application: file:/u01/home/developer/jboss-4.2.1.GA/server/default/deploy/bc4j.ear
              11:23:04,266 WARN [DeployerInterceptorJSE] Cannot load servlet class: oracle.jbo.server.emd.EMDServlet
               deploy, ctxPath=/webapp, warUrl=.../tmp/deploy/tmp51733bc4j.ear-contents/webapp-exp.war/
              11:23:04,459 WARN [TomcatDeployer] Failed to setup clustering, clustering disabled. NoClassDefFoundError: org/jgroups/blocks/MethodCall
              11:23:04,478 INFO [EARDeployer] Started J2EE application: file:/u01/home/developer/jboss-4.2.1.GA/server/default/deploy/bc4j.ear
              11:23:04,635 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
              11:23:04,795 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
              
              




              Why does the entitymanager not create the entities?
              Any hint as to what is causing this, or How to proceed further?


              • 4. Re: Could not deploy EJB3.0 entities
                Carlos Delfino Newbie

                Hi all!
                anybody have one soluction for this warning:
                11:22:56,909 INFO [STDOUT] [TopLink Warning]: 2007.11.11 11:22:56.909--Thread(Thread[main,5,jboss])
                --java.lang.NullPointerException: null was thrown on attempt of PersistenceLoadProcessor to load cla
                ss com.prapansol.demos.model.Emp. The class is ignored.


                I get too!
                10:55:48,345 INFO [STDOUT] [TopLink Warning]: 2008.07.04 10:55:48.345--java.lang.NullPointerException: null was thrown on attempt of PersistenceLoadProcessor to load class model.PlanoAssinatura. The class is ignored.

                thanks a Lot!!!!