1 Reply Latest reply on Aug 21, 2003 5:11 AM by Adrian Brock

    Client with custom class loader

    stefanfreyr Newbie

      Hello.

      I don't know if I'm asking this in the right forum. If not could you please direct me to the correct one?

      I have an application that loads up plugins using a custom class loader (a descendant of URLClassLoader that exposes a public addURL( URL ) method so that the class path can be appended dynamically). These plugins sometimes use a JBoss EJB connection.

      Now the custom class loader has all the Home/Remote interfaces in its class path but the System class loader doesn't know about them.

      So my problem is that when I try to perform a lookup from within a plugin, you'd expect that the plugin class loader should be used but for some odd reason it always seems to be using the System class loader. This results in the following exception being thrown:

      javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: is.althingi.embla.ejbservice.sessionregistration.ParliamentSessionHome (no security manager: RMI class loader disabled)]
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:616)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:471)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at is.althingi.embla.clientframework.openapi.Framework.serverComponentLookup(Framework.java:70)
      at is.althingi.embla.client.parliamentarysession.ParliamentarianRegistrationPanel.getCardinal(ParliamentarianRegistrationPanel.java:153)
      at is.althingi.embla.client.parliamentarysession.ParliamentarianRegistrationPanel.(ParliamentarianRegistrationPanel.java:105)
      at is.althingi.embla.client.parliamentarysession.ParliamentarianRegistrationAction.actionPerformed(ParliamentarianRegistrationAction.java:23)
      at is.althingi.embla.clientframework.openapi.hook.ActionAgent.actionPerformed(ActionAgent.java:38)
      at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
      at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
      at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
      at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
      at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
      at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
      at java.awt.Component.processMouseEvent(Component.java:5100)
      at is.althingi.swing.sidebar.ActionButton.processMouseEvent(Unknown Source)
      at java.awt.Component.processEvent(Component.java:4897)
      at java.awt.Container.processEvent(Container.java:1569)
      at java.awt.Component.dispatchEventImpl(Component.java:3615)
      at java.awt.Container.dispatchEventImpl(Container.java:1627)
      at java.awt.Component.dispatchEvent(Component.java:3477)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
      at java.awt.Container.dispatchEventImpl(Container.java:1613)
      at java.awt.Window.dispatchEventImpl(Window.java:1606)
      at java.awt.Component.dispatchEvent(Component.java:3477)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
      at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
      Caused by: java.lang.ClassNotFoundException: is.althingi.embla.ejbservice.sessionregistration.ParliamentSessionHome (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:639)
      at java.rmi.server.RMIClassLoader.loadProxyClass(RMIClassLoader.java:309)
      at sun.rmi.server.MarshalInputStream.resolveProxyClass(MarshalInputStream.java:241)
      at java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1469)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1432)
      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:514)
      ... 32 more

      Although I don't know for sure, I believe that this is being caused because the lookup method in the InitialContext is somehow mixing up the class loaders and using the System class loader. I've tried to find a way to "make" it use my own class loader but I haven't been successful.

      Can anybody help me out here?

      Kind regards, Stefan Freyr.