1 Reply Latest reply on Jul 26, 2006 7:48 AM by Chris Hembrow

    ClassNotFoundException talking to remote EJB

    Chris Hembrow Newbie


      I am trying to access a remote stateless session bean, which returns an interface. The interface is IStringWrapper which is an interface to StringWrapper, which has a single method, getString().

      The bean looks like this:

      public void ejbCreate() throws CreateException {
      public IStringWrapper getStringWrapper() {
       Log.debug( this, "Returning new StringWrapper with \"hello\"" );
       return new StringWrapper( "hello" );

      when I include the StringWrapper class in my client, everything works as expected, and I get the String "hello". If I leave out the StringWrapper class, and just include the IStringWrapper interface in the client, I get the following exception:
      Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
       at $Proxy1.getStringWrapper(Unknown Source)
       at ejb.client.TestClient.getStringWrapper(TestClient.java:43)
       at Test.main(Test.java:25)
      Caused by: java.lang.ClassNotFoundException: ejb.results.containers.StringWrapper
       at java.net.URLClassLoader$1.run(URLClassLoader.java:199)

      initially I got a reference to "(no security manager: RMI class loader disabled)" which I fixed with a security policy, but I still get the ClassNotFoundException.

      Am I being a complete noob here, and misunderstanding the process. I thought that the ejb could return an interface, so that the client doesn't need the actual class. Is this not the case, or have I messed up something else fundamental. I know I am hitting the server, as the debug messages are showing up.