[jboss-user] [JNDI/Naming/Network] - InitialContext lookup gives me a

aslan do-not-reply at jboss.com
Mon Sep 10 06:51:41 EDT 2007


Am trying to access a remote EJB from a stand alone java client, but are getting an exception. This is the exception:

javax.naming.NameNotFoundException: aslan.dk.JEJBWebCam.server.beans.RecordingRemote not bound
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
        at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
        at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
        at sun.rmi.transport.Transport$1.run(Transport.java:159)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
        at java.lang.Thread.run(Thread.java:619)
        at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
        at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
        at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at aslan.dk.jejbwebcam.Main.(Main.java:36)
        at aslan.dk.jejbwebcam.Main.main(Main.java:48)



My code looks like this:



  | @Stateless
  | public class RecordingBean implements RecordingRemote{
  |     
  |     /** Creates a new instance of RecordingBean */
  |     public RecordingBean() {
  |     }
  |     public String hello() {
  |         return "Hello Batman";
  |     }
  | }
  | //-----------------------------------------------
  | @Remote
  | public interface RecordingRemote {
  |     public String hello();
  | 
  | }
  | //-----------------------------------------
  | 
  | 
  |     public Main() {
  |         InitialContext ic;
  |         try {
  |             
  |             Hashtable ht = new Hashtable();
  |             ht.put(InitialContext.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
  |             ht.put(InitialContext.PROVIDER_URL,"jnp://localhost:1099");
  |             ht.put(InitialContext.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
  |             
  |             ic = new InitialContext(ht);
  | 
  |             RecordingRemote bean = (RecordingRemote) ic.lookup(RecordingRemote.class.getName());
  |             
  |             System.out.println(bean.hello());
  |         } catch (Exception ex) {
  |             ex.printStackTrace();
  |         }
  |     }
  | 
  | 


Am using jboss-4.2.0.GA and java 1.5. Can anyone help me with this, I have been strugling with it for several days now, without any luck?



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4082551#4082551

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4082551



More information about the jboss-user mailing list