Hello,

I am using JBoss 4.0.2, JDK 1.5.0_03 & Eclipse 3.02 and I have successfully 
deployed the "Fibonaci Computation"-application from the JBoss-Eclipse-Tutorial.

Now I want to connect to the Fibo-EJB from a swing-client with the following 
program:

import java.util.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import tutorial.interfaces.FiboHome;

public class SwingClient {

        public static void main(String[] args) {
        
                try {
                        Hashtable props = new Hashtable();
            props.put("java.naming.factory.initial", 
                      "org.jnp.interfaces.NamingContextFactory");
            props.put("java.naming.provider.url",       
                          "jnp://localhost:1099");
            props.put("java.naming.factory.url.pkgs",
                          "org.jboss.naming:org.jnp.interfaces");
            Context context = new InitialContext(props);
                        Object ref = context.lookup("java:/comp/env/ejb/Fibo");

                } catch (Exception ex) {
            System.err.println("Caught an exception:");
            ex.printStackTrace();
        }
        }
}

After running this program, an exception is occurred:

Caught an exception:
javax.naming.NameNotFoundException: comp not bound
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:491)
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:499)
        at org.jnp.server.NamingServer.getObject(NamingServer.java:505)
        at org.jnp.server.NamingServer.lookup(NamingServer.java:249)
        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:585)
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
        at sun.rmi.transport.Transport$1.run(Transport.java:153)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
        at 
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
        at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
        at java.lang.Thread.run(Thread.java:595)
        at 
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
        at 
sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
        at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
        at javax.naming.InitialContext.lookup(InitialContext.java:351)
        at client.SwingClient.main(SwingClient.java:39)


This line doesn't work:

Object ref = context.lookup("java:/comp/env/ejb/Fibo");

But what's wrong with my code?


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

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


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to