4 Replies Latest reply on Dec 22, 2004 8:00 PM by redbeard15

    Error invoking the entity bean in BMP

    sjagga

      Hello,

      I am new to the JBOSS world, I have been trying to test a BMP entity bean and wrote a simple code that should fetch records from mySQL database. When I call the bean after creating it using a finder method I am getting the following error. Can somebody please help me?

      thanks!

      2004-12-21 13:54:27,963 INFO [STDOUT] New login account entity bean java object created by EJB Continer
      2004-12-21 13:54:27,983 INFO [STDOUT] setEntityContext() called. 2004-12-21 13:54:27,983 ERROR [org.jboss.ejb.plugins.LogInterceptor] EJBException in method: public abstract admin.access.login admin.access.loginHome.findByUserName(java.lang.String) throws java.rmi.RemoteException,javax.ejb.FinderException: javax.ejb.EJBException: Deprecated
      at org.jboss.ejb.EnterpriseContext$EJBContextImpl.getEnvironment(EnterpriseContext.java:339)
      at admin.access.loginBean.setEntityContext(loginBean.java:266)
      at org.jboss.ejb.EntityEnterpriseContext.(EntityEnterpriseContext.java:81)

        • 1. Re: Error invoking the entity bean in BMP
          redbeard15

          You're going to have to supply a bit more information. It looks like something is happening at 'loginBean.java:266' (loginBean.setEntityContext(). What's happening there?

          • 2. Re: Error invoking the entity bean in BMP
            sjagga

            Thank you for your response. I got that problem because I was playing around with env object and I removed all those statements and I am no longer getting this problem, however I stepped into another issue. Here is the info....from server.log. As you see the find, activate, load all worked fine, when I am calling the get method I get this problem, the code looks like below....in the servlet...
            -----------servlet class--------------------------

            login beanRemote;
            beanRemote = (login) home.findByUserName("admin");
            loginPK pk = (loginPK) beanRemote.getPrimaryKey();
            login newLogin = null;
            newLogin = home.findByPrimaryKey(pk);
            out.println("<p align=\"center\"> Message from Security Entity Bean is: " + "Hello " + newLogin.getUserName() + "");

            ---------------server.log-----------------------

            rarchicalLoaderRepository3@134ae32, cl=org.jboss.mx.loading.UnifiedClassLoader3@1d07c3f{ url=null ,addedOrder=0}

            2004-12-22 16:17:19,022 INFO [STDOUT] ejbFindByPrimaryKey(1) called.

            2004-12-22 16:17:19,082 INFO [STDOUT] ejbActivate() called.

            2004-12-22 16:17:19,092 INFO [STDOUT] ejbLoad() called.

            2004-12-22 16:17:19,092 INFO [STDOUT] user information from query: admin

            2004-12-22 16:17:19,092 INFO [STDOUT] password information from query: admin

            2004-12-22 16:17:19,102 INFO [STDOUT] getuserName() called.

            2004-12-22 16:17:19,102 ERROR [org.jboss.ejb.BeanLock] removing bean lock and it has tx set! org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock@1737b9f, bean=admin/login, id=1, refs=0, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=MERCY/3, BranchQual=, localId=3], synched=null, timeout=5000, queue=[]
            2004-12-22 16:17:19,102 ERROR [org.jboss.ejb.plugins.LogInterceptor] RuntimeException in method: public abstract java.lang.String admin.access.login.getUserName() throws java.rmi.RemoteException:

            java.lang.IllegalStateException: removing bean lock and it has tx set!

            at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.removeRef(QueuedPessimisticEJBLock.java:461)

            at org.jboss.ejb.BeanLockManager.removeLockRef(BeanLockManager.java:116)

            at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:106)

            at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:53)

            at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)

            at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)

            at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:316)

            at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:149)

            at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:128)

            at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)

            at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)

            at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:514)

            at org.jboss.ejb.Container.invoke(Container.java:854)

            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:324)

            at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)

            at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)

            at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)

            at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:242)

            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)

            at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:155)

            at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:104)

            at org.jboss.invocation.MarshallingInvokerInterceptor.invoke(MarshallingInvokerInterceptor.java:55)

            at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)

            at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)

            at org.jboss.proxy.ejb.EntityInterceptor.invoke(EntityInterceptor.java:97)

            at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)

            at $Proxy50.getUserName(Unknown Source)


            "redBeard15" wrote:
            You're going to have to supply a bit more information. It looks like something is happening at 'loginBean.java:266' (loginBean.setEntityContext(). What's happening there?


            • 3. Re: Error invoking the entity bean in BMP
              sjagga

              Never mind, I was able to solve that problem as well. I have found out that I had to define the hashCode() and equals() method for my primaryKey class. Wow that was a great catch thanks to Google and somebody came across a similar issue.

              Thanks again....

              • 4. Re: Error invoking the entity bean in BMP
                redbeard15

                Good to hear you're on your way. I have to admit that I use Xdoclet for code and deployment descriptor. Works great. Never have to worry about missing items in interfaces, value object or PK classes, descriptors, etc.