5 Replies Latest reply on Nov 23, 2011 6:06 AM by yanivlugassy

    Entity beans 2.1 lookup in jboss AS7

    yanivlugassy

      we are trying to migrate one of our applications from jboss 4.2.3 to jboss-as-7.0.2.Final

      our application still uses some very old CMP entity beans ( EJB 2.1)

      i know its better not to use them anymore , but from many reasons i prefer to do it in two steps meaning first migrate than change

      otherwise the risk and the effort will be too much to handle ...

       

      These ejbs are part of an ear file .

      i managed to deploy me ear file (with no errors)

      in the server log it prints that it deployed all the modules(including the ejbs)

      and added javax.persistence.api dependency

       

      i have my web application functioning but when i try to apply functions that lookup for one of the entity beans in the code i get a NameNotFoundException

      when trying to figure out what is going in the JNDI i looked at the console application

      but it seems as if only the Ear file was registered in the JNDI  but its modules didnt  ...

       

      is there a configuration thing that might solve this issue ?

      does jboss 7 supports EJB 2.1 (in Jboss 6 i saw posts that said that although they are not part of the spec anymore

      it is supported)

      any help would be appreciated?

        • 1. Re: Entity beans 2.1 lookup in jboss AS7
          prasad.deshpande

          I think AS7 release doesn't support EJB2.1 as it was only released with web profile, but that should be available in AS7.1 release..

          • 2. Re: Entity beans 2.1 lookup in jboss AS7
            yanivlugassy

            i think 7.1.0 beta version is due for today i will check that

            thanks

            • 3. Re: Entity beans 2.1 lookup in jboss AS7
              yanivlugassy

              well i took the jboss-as-7.1.0.Alpha2-SNAPSHOT form yesterady nightly build

              and made a small progress

              now my ejbs are registered in the JNDI  and i am able to get the object in the lookup operation however when i try to create the Object  with the code bellow

               

              public PDGBuildRemoteInterface createNewBean()

                          throws javax.naming.NamingException {

                      PDGBuildRemoteInterface bean = null;

                      Context initialContext = new InitialContext();

                      PDGBuildHomeInterface home = (PDGBuildHomeInterface)javax.rmi.PortableRemoteObject.narrow(

                                      initialContext.lookup(JNDIWrapper.getJNDISuffix(JNDIWrapper.BUILD_HOME_INTERFACE)),PDGBuildHomeInterface.class);

               

               

                      try {

                         bean = home.create(new PDGBuildPK(Long.parseLong(getNaxtVal("BUILDS_SEQ"))));

                      } catch (Exception e) {

               

                          e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.

                      }

                      return bean;

                  }

               

               

              i get the following error:

               

               

               

              12:07,968 INFO  [org.jboss.ejb.client]  JBoss EJB Client version 1.0.0.Beta7

              12:08,093 ERROR [org.jboss.as.ejb3.tx.CMTTxInterceptor]  javax.ejb.EJBTransactionRolledbackException: JBAS011048: Failed to construct component instance

              12:08,093 ERROR [stderr]  javax.transaction.TransactionRolledbackException: JBAS011048: Failed to construct component instance

              12:08,093 ERROR [stderr]     at org.jboss.as.ejb3.component.interceptors.EjbExceptionTransformingInterceptorFactory$1.processInvocation(EjbExceptionTransformingInterceptorFactory.java:58)

              12:08,093 ERROR [stderr]     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

              12:08,093 ERROR [stderr]     at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:44)

              12:08,093 ERROR [stderr]     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

              12:08,093 ERROR [stderr]     at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)

              12:08,093 ERROR [stderr]     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

              12:08,109 ERROR [stderr]     at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:55)

              12:08,109 ERROR [stderr]     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

              12:08,109 ERROR [stderr]     at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

              12:08,109 ERROR [stderr]     at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)

              12:08,109 ERROR [stderr]     at org.jboss.as.ejb3.remote.LocalEjbReceiver.processInvocation(LocalEjbReceiver.java:166)

              12:08,109 ERROR [stderr]     at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:185)

              12:08,109 ERROR [stderr]     at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:113)

              12:08,109 ERROR [stderr]     at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:96)

              12:08,109 ERROR [stderr]     at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:86)

              • 4. Re: Entity beans 2.1 lookup in jboss AS7
                prasad.deshpande

                Can you please attach full server.log, also, what is the structure of your application, where are you trying to access this EJB (inside application/standalone client)?

                • 5. Re: Entity beans 2.1 lookup in jboss AS7
                  yanivlugassy

                  the ejb is part of an ear file which also contains a web application

                  in the web application one of the jsp pages triggers an action on the server side that invokes the code i gave in my previous post

                  in order to get the remote object of the CMP Enitity to enter a record to the database

                  i attached the full log to my previous post as well