5 Replies Latest reply on May 26, 2006 5:22 AM by Jussi Pyörre

    Same JNDI Lookup from different MBeans (but same ClassLoader

    Jussi Pyörre Newbie

      Hello,


      I'm trying to perform a JNDI lookup for an EJB3 stateless session bean (local interface) from an MBean. This works OK from one MBean, but when I create another MBean (the MBean creation routine is executed by the first MBean) by

      this.getServer().createMBean(myClassName, myObjectName);

      and run exactly the same JNDI lookup routine from the created MBean, I get:


      ...
      Caused by: javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: myproject.myClass (no security manager: RMI class loader disabled)]
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:728)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
       at javax.naming.InitialContext.lookup(InitialContext.java:351)
       ... 37 more
      Caused by: java.lang.ClassNotFoundException: myproject.myClass (no security manager: RMI class loader disabled)
       at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:531)
       at java.rmi.server.RMIClassLoader$2.loadProxyClass(RMIClassLoader.java:628)
       at org.jboss.system.JBossRMIClassLoader.loadProxyClass(JBossRMIClassLoader.java:82)
       at java.rmi.server.RMIClassLoader.loadProxyClass(RMIClassLoader.java:294)
       at sun.rmi.server.MarshalInputStream.resolveProxyClass(MarshalInputStream.java:238)
       at java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1494)
       at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1457)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
       at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
       at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:72)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:652)
       ... 41 more
      


      I checked that both MBeans use the same ClassLoader (org.jboss.mx.loading.UnifiedClassLoader3) instance so this can't be the issue. Both MBeans extend ServiceMBeanSupport.

      What is the significant difference between these two MBeans as they both run in the same ClassLoader and execute the same JNDI lookup?


      Regards,

      Jussi Pyörre