5 Replies Latest reply on May 28, 2004 10:27 AM by jual

    Problems if i try to access the members

    jual

      Hello together

      I have a findByName method that returns a Collection of LocalRemotes.
      findByName works well but when i try to read the membervalues through the getMethods()
      like this one:

      Iterator i =collection.iterator();
      
       List resultList = new ArrayList();
      
       PersonLocal entity = null;
       while (i.hasNext())
       {
      
       entity =(PersonLocal) i.next();
      
       entity.getID();
       entity.getName()
       }



      i get this kind of exception:

      org.jboss.tm.JBossTransactionRolledbackException: null; CausedByException is:
      null; CausedByException is:
      null; CausedByException is:
      null; nested exception is:
      javax.ejb.EJBException: null; CausedByException is:
      null; - nested throwable: (javax.ejb.EJBException: null; CausedByException is:
      null)
      at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:262)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:195)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      at org.jboss.ejb.StatefulSessionContainer.internalInvoke(StatefulSessionContainer.java:416)
      at org.jboss.ejb.Container.invoke(Container.java:700)
      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.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:367)
      at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:534)
      Caused by: javax.ejb.EJBException: null; CausedByException is:
      null
      at org.jboss.ejb.plugins.BMPPersistenceManager.loadEntity(BMPPersistenceManager.java:433)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.loadEntity(CachedConnectionInterceptor.java:352)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:239)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
      at org.jboss.ejb.plugins.EntityReentranceInterceptor.invoke(EntityReentranceInterceptor.java:114)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:163)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:89)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:54)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
      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:489)
      at org.jboss.ejb.Container.invoke(Container.java:700)
      at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:375)
      at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:38)
      at $Proxy469.getData(Unknown Source)
      at entities.PersonModel.local2Model(PersonModel.java:94)
      at sessions.PersonReader.findByName(PersonReader.java:97)
      at sessions.PersonFacadeBean.findByName(PersonFacadeBean.java:71)
      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.ejb.StatefulSessionContainer$ContainerInterceptor.invoke(StatefulSessionContainer.java:948)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
      at org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invoke(StatefulSessionInstanceInterceptor.java:269)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.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.StatefulSessionContainer.internalInvoke(StatefulSessionContainer.java:416)
      at org.jboss.ejb.Container.invoke(Container.java:700)
      at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:375)
      at org.jboss.ejb.plugins.local.StatefulSessionProxy.invoke(StatefulSessionProxy.java:41)
      at $Proxy481.findByName(Unknown Source)
      at businessDelegates.PersonDelegate.findByName(PersonDelegate.java:87)
      at test.cilent.ClientPersonBean.findByName(ClientPersonBean.java:120)
      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.ejb.StatefulSessionContainer$ContainerInterceptor.invoke(StatefulSessionContainer.java:948)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
      at org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invoke(StatefulSessionInstanceInterceptor.java:269)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
      ... 20 more



        • 1. Re: Problems if i try to access the members
          jual

          i just forgot to wrote
          that i don't understand what happens ??

          Can somebody help me ??

          regards jual

          • 2. Re: Problems if i try to access the members
            ironbird

            Your bean seems to be a BMP one, and I suspect a transaction issue in your NPE, like your beans are not yet loaded at the end of the finder.

            • 3. Re: Problems if i try to access the members
              jual

              Hello ironbird

              it is a BMP that uses a DAO-Class to access the DB.
              If i have understand it, I don't thing that it's a transaction issue because i use this code

               try
               {
               ...
               }
               catch(FinderException fe)
               {
               context.setRollbackOnly();
               throw new EJBException("Could not find specified Destination. " +
               "Exception is " + fe.getMessage());
               }
               catch(NamingException ne)
               {
               context.setRollbackOnly();
               throw new EJBException(
               "Could not lookup the Destination ejb. Exception is " + ne.getMessage());
               }
              


              Thank You for helping me

              regards

              Jual

              • 4. Re: Problems if i try to access the members
                ironbird

                OK for the naming and finder exceptions.
                As your bean is a BMP, what are you doing in the finder ?
                How is filled the collection. This is the start point of the problem I think, or just in the first getID method ?

                • 5. Re: Problems if i try to access the members
                  jual

                  Hello ironbird

                  I found the (my) mistake.
                  You were just right as you said "the beans are not yet loaded at the end of the finder. ".
                  Every entity bean has a PK-Class, and in this case i returned just the wrong object type in the DAO-Class.
                  Than it is clear that it is just impossible to load the bean with the wrong type of the PK-Class.
                  My imbacility

                  I just thank You again for your help

                  regards
                  jual