4 Replies Latest reply on Apr 12, 2009 12:38 AM by Andrew Rubinger

    Errors When Passing A Generic Object To A Stateless Session

    K Nielsen Newbie

      Hello, I'm a n00b learning EJB3 and have a simple question. I have a stateless session bean that I'm using to learn. It's an FTP bean -> you send it hostname, user, pass, etc and it will FTP stuff to the site. The bean explodes to JBoss 5 just fine, and runs perfect, if I hard code some FTP instructions within the bean itself.

      Now that I got that working, my next step is I want to be able to pass an object to the bean from a caller POJO app that is essentially a list of FTP actions to be performed. The bean would receive this object, cast it into the my object type, and then loop over the list of files, sending each one to the FTP site. Easy enough and a good app for training wheels.

      The problem is, originally I tried sending the specific object type to the bean directly ie ftpBean.doWork(String host, String username, String password, ListOfFTPItems ftpFilePackage). That threw a bunch of interceptor errors.

      Next I tried making a more generic argument list -> ftpBean.doWork(String host, String username, String password, Object ftpFilePackage), and then casting the Object into a ListOfFTPItems inside the bean. I thought since it was a generic object, I should be able to go back and forth just fine without having to touch anything else. What am I missing?

      A couple of the guys were great at answering a question I had earlier this week about JNDI lookup. I promised I would write a great tutorial that is completely step by step and I am. Helping me will help out all the other newcomers!

      PS -> My plan is to make this bean into an MDB so that I can run it asynchronously, but I want to get the object passing figured out first before attempting to turn it into an MDB.

      Thanks in advance.

      Error message:

      Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundException: com.acmeco.serverapp.test.fileStuff.FilePackage (no security manager: RMI class loader disabled)
       at org.jboss.aop.joinpoint.MethodInvocation.getArguments(MethodInvocation.java:318)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:481)
       at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:908)
       at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:742)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:695)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:522)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:230)
      Caused by: java.lang.ClassNotFoundException: com.acmeco.serverapp.test.fileStuff.FilePackage (no security manager: RMI class loader disabled)
       at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:375)
       at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
       at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
       at org.jboss.system.JBossRMIClassLoader.loadClass(JBossRMIClassLoader.java:91)
       at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
       at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
       at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
       at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
       at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1667)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1323)
       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
       at java.rmi.MarshalledObject.get(MarshalledObject.java:142)
       at org.jboss.aop.joinpoint.MethodInvocation.getArguments(MethodInvocation.java:309)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:481)
       at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:908)
       at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:742)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:695)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:522)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:230)
       at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:206)
       at org.jboss.remoting.Client.invoke(Client.java:1708)
       at org.jboss.remoting.Client.invoke(Client.java:612)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:60)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
       at $Proxy3.invoke(Unknown Source)
       at org.jboss.ejb3.proxy.handler.ProxyInvocationHandlerBase.invoke(ProxyInvocationHandlerBase.java:261)
       at org.jboss.ejb3.proxy.handler.session.SessionSpecProxyInvocationHandlerBase.invoke(SessionSpecProxyInvocationHandlerBase.java:101)
       at $Proxy2.doWork(Unknown Source)
       at com.acmeco.serverapp.ftpDoer.client.HelloClientPOJO.doWork(HelloClientPOJO.java:41)
       at com.acmeco.serverapp.ftpDoer.client.HelloClientPOJO.main(HelloClientPOJO.java:47)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:72)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
       at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
       at $Proxy3.invoke(Unknown Source)
       at org.jboss.ejb3.proxy.handler.ProxyInvocationHandlerBase.invoke(ProxyInvocationHandlerBase.java:261)
       at org.jboss.ejb3.proxy.handler.session.SessionSpecProxyInvocationHandlerBase.invoke(SessionSpecProxyInvocationHandlerBase.java:101)
       at $Proxy2.doWork(Unknown Source)
       at com.acmeco.serverapp.ftpDoer.client.HelloClientPOJO.doWork(HelloClientPOJO.java:41)
       at com.acmeco.serverapp.ftpDoer.client.HelloClientPOJO.main(HelloClientPOJO.java:47)
      




        • 1. Re: Errors When Passing A Generic Object To A Stateless Sess
          K Nielsen Newbie

          PS I also simplified even further, but testing to see if I receive a generic Object without an error and it still burps:

          Caller:

          Object thisObject = new Object();
          System.out.println(ftpbean.doWork(thisObject));


          Interface:
          public String doWork(Object object);


          Bean:
          public String doWork(Object object){
           return "I'm here!";
          }




          • 2. Re: Errors When Passing A Generic Object To A Stateless Sess
            Andrew Rubinger Master

             

            Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundException: com.acmeco.serverapp.test.fileStuff.FilePackage (no security manager: RMI class loader disabled)


            Is FilePackage not in your JAR/EAR alongside your EJB?

            S,
            ALR

            • 3. Re: Errors When Passing A Generic Object To A Stateless Sess
              K Nielsen Newbie

              ALR,

              Thanks for replying on a Saturday. As I said in my second post in this thread, I went super generic using basic Java Objects and still got burps:


              javax.naming.NamingException: Could not dereference object [Root exception is java.lang.RuntimeException: Could not find InvokerLocator URL at JNDI address "FTPBean/local"; looking up local Proxy from Remote JVM?]
               at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1472)
               at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:818)
               at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)
               at javax.naming.InitialContext.lookup(Unknown Source)
               at com.acmeco.serverapp.ftpDoer.client.HelloClientPOJO.<init>(HelloClientPOJO.java:20)
               at com.acmeco.serverapp.ftpDoer.client.HelloClientPOJO.main(HelloClientPOJO.java:48)
              Caused by: java.lang.RuntimeException: Could not find InvokerLocator URL at JNDI address "FTPBean/local"; looking up local Proxy from Remote JVM?
               at org.jboss.ejb3.proxy.objectfactory.ProxyObjectFactory.createProxyFactoryProxy(ProxyObjectFactory.java:185)
               at org.jboss.ejb3.proxy.objectfactory.ProxyObjectFactory.getObjectInstance(ProxyObjectFactory.java:146)
               at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
               at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1447)
               at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1464)
               ... 5 more
              Exception in thread "main" java.lang.NullPointerException
               at com.acmeco.serverapp.ftpDoer.client.HelloClientPOJO.doWork(HelloClientPOJO.java:43)
               at com.acmeco.serverapp.ftpDoer.client.HelloClientPOJO.main(HelloClientPOJO.java:49)
              


              • 4. Re: Errors When Passing A Generic Object To A Stateless Sess
                Andrew Rubinger Master

                 

                javax.naming.NamingException: Could not dereference object [Root exception is java.lang.RuntimeException: Could not find InvokerLocator URL at JNDI address "FTPBean/local"; looking up local Proxy from Remote JVM?]


                To ask the obvious question, is your client (where the JNDI lookup is performed) in the same JVM as your EJB?

                If not, look up "FTPBean/remote".

                S,
                ALR