0 Replies Latest reply on Jan 27, 2004 11:10 AM by noa

    AOP / Remoting problem with DR2

    noa Newbie

       

      "noa" wrote:
      I have had some difficulty getting remote communication to work with DR2. I will try soon with the latest code to see if that helps. I would simply like to have a client in one java process that executes a method on a regular java class that is deployed within jboss. I have an mbean contained within a deployed .sar file that registers a plain java object with the Dispatcher, as indicated in the aop documentation with the following syntax:

      POJO pojo = new POJO();
      Dispatcher.singleton.registerTarget("myobj", pojo);

      The mbean also creates the proxy and performs a jndi binding, similar to:

      POJO proxy = (POJO)Remoting.createRemoteProxy("myobj", pojo.getClass(), "socket://servername:8084");
      new InitialContext().bind("YourOwnObjectId", proxy);

      This all seems to work just fine.

      I have tried a couple of approaches towards attempting to communicate with the pojo outside of jboss. I attempt to create the proxy object in the client and invoke a method, as in the following:

      POJO me = (POJO) Remoting.createRemoteProxy("myobj", POJO.class, "socket://localhost:8084");
      me.talk();

      This results in the following error on the client:

      java.lang.SecurityException: Prohibited package name: java.lang
      at java.lang.ClassLoader.defineClass(ClassLoader.java:488)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:431)
      at org.jboss.remoting.loading.ClassByteClassLoader.addClass(ClassByteClassLoader.jav a:196)
      at org.jboss.remoting.AbstractInvoker.addClass(AbstractInvoker.java:192)
      at org.jboss.remoting.AbstractInvoker.unmarshal(AbstractInvoker.java:279)
      at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:161)
      at org.jboss.remoting.Client.invoke(Client.java:144)
      at org.jboss.aop.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.jav a:41)
      at org.jboss.aop.Invocation.invokeNext(Invocation.java:61)
      at org.jboss.aop.remoting.MergeMetaDataInterceptor.invoke(MergeMetaDataInterceptor.j ava:60)
      at org.jboss.aop.Invocation.invokeNext(Invocation.java:61)
      at org.jboss.aop.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:33)
      at org.jboss.aop.Invocation.invokeNext(Invocation.java:61)
      at org.jboss.aop.proxy$test.POJO._added_m$0(POJO.java)
      at org.jboss.aop.proxy$test.POJO.talk(POJO.java)
      at test.MyClient.main(MyClient.java:53)

      Checking out the jboss logs, I see the following server-side error:

      11:31:35,486 ERROR [STDERR] org.jboss.remoting.SubsystemNotSupported: Subsystem
      'AOP' not supported on target VM (InvokerLocator [socket://{ip_addr}:8084/])
      11:31:35,486 ERROR [STDERR] at org.jboss.remoting.ServerInvoker.invoke(Serve
      rInvoker.java:310)
      11:31:35,486 ERROR [STDERR] at org.jboss.remoting.ServerInvoker.invoke(Serve
      rInvoker.java:250)
      11:31:35,486 ERROR [STDERR] at org.jboss.remoting.transport.socket.SocketSer
      verInvoker$Client.run(SocketServerInvoker.java:208)

      And if I give up on this approach, and try instead to retrieve the POJO proxy from JNDI, I receive the following error upon execution of the lookup:

      javax.naming.CommunicationException. Root exception is java.lang.ClassNotFoundException: org.jboss.aop.proxy$test.POJO
      at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:217)
      at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:427)
      at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:161)
      at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:631)
      at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:257)
      at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:200)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1513)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
      at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
      at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:30)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:522)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:479)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at test.MyClient.main(MyClient.java:45)

      I did notice that if instead of the proxy I bind the POJO itself into JNDI (now object type is simply test.POJO, not org.jboss.aop.proxy$test.POJO), the context lookup works just fine.

      I suspect I am neglecting some basic configuration requirement in one or both of these approaches. Any help would be appreciated -- or should I give up this entirely and work with the latest code?

      Thanks