4 Replies Latest reply on Feb 17, 2009 6:56 AM by Wolfgang Knauf

    Problem with new InitialContext().lookup(

    Boris Godunov Newbie

      Hi everybody,

      i try to build a client that uses an EJB3.0. This EJB is deployed on JBOSS 5.0.0

      the following code creates an exception

      Context context = new InitialContext();
      Object ref = context.lookup("HelloBean/remote");
      


      the exception


      javax.naming.NamingException: Could not dereference object [Root exception is java.lang.reflect.UndeclaredThrowableException]
      at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1463)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:809)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:673)
      at javax.naming.InitialContext.lookup(InitialContext.java:392)
      at client.Client.doSomething(Client.java:20)
      at client.Client.main(Client.java:36)
      Caused by: java.lang.reflect.UndeclaredThrowableException
      at $Proxy0.createProxyBusiness(Unknown Source)
      at org.jboss.ejb3.proxy.objectfactory.session.SessionProxyObjectFactory.createProxy(SessionProxyObjectFactory.java:129)
      at org.jboss.ejb3.proxy.objectfactory.session.stateless.StatelessSessionProxyObjectFactory.getProxy(StatelessSessionProxyObjectFactory.java:79)
      at org.jboss.ejb3.proxy.objectfactory.ProxyObjectFactory.getObjectInstance(ProxyObjectFactory.java:156)
      at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
      at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1438)
      at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1455)
      ... 5 more
      Caused by: java.lang.ClassNotFoundException: beanpackage.HelloBeanRemote
      at org.jboss.remoting.serialization.ClassLoaderUtility.loadClass(ClassLoaderUtility.java:103)
      at org.jboss.remoting.loading.RemotingClassLoader.loadClass(RemotingClassLoader.java:86)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:247)
      at org.jboss.remoting.loading.ObjectInputStreamWithClassLoader.resolveProxyClass(ObjectInputStreamWithClassLoader.java:250)
      at java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1531)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1493)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
      at org.jboss.aop.joinpoint.InvocationResponse.readExternal(InvocationResponse.java:119)
      at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1792)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1947)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1871)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
      at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObjectVersion2_2(JavaSerializationManager.java:238)
      at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:138)
      at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:123)
      at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.versionedRead(MicroSocketClientInvoker.java:1215)
      at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:845)
      at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:160)
      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.ejb3.proxy.remoting.IsLocalProxyFactoryInterceptor.invoke(IsLocalProxyFactoryInterceptor.java:72)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
      at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
      at $Proxy0.createProxyBusiness(Unknown Source)
      at org.jboss.ejb3.proxy.objectfactory.session.SessionProxyObjectFactory.createProxy(SessionProxyObjectFactory.java:129)
      at org.jboss.ejb3.proxy.objectfactory.session.stateless.StatelessSessionProxyObjectFactory.getProxy(StatelessSessionProxyObjectFactory.java:79)
      at org.jboss.ejb3.proxy.objectfactory.ProxyObjectFactory.getObjectInstance(ProxyObjectFactory.java:156)
      at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
      at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1438)
      at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1455)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:809)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:673)
      at javax.naming.InitialContext.lookup(InitialContext.java:392)
      at client.Client.doSomething(Client.java:20)
      at client.Client.main(Client.java:36)
      at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:72)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
      at org.jboss.ejb3.proxy.remoting.IsLocalProxyFactoryInterceptor.invoke(IsLocalProxyFactoryInterceptor.java:72)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
      at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)
      ... 12 more


      The "JMX MBean Operation View" of JBOSS says
      +- HelloBean (class: org.jnp.interfaces.NamingContext)
       | +- remote-beanpackage.HelloBeanRemote (class: Proxy for: beanpackage.HelloBeanRemote)
       | +- remote (class: Proxy for: beanpackage.HelloBeanRemote)
      

      I suppose there is somewhere a problem with beanpackage.HelloBeanRemote, but where. Someone an idea?