Hello. 
I have created a stateless session bean, and deployed it to jboss.
But, when I trying to call it's bean from my client application,
jboss giving me javax.naming.NameNotFoundException: sample.Sample not bound.
Please help me.

Environment: 
JBOSS4.0.3 + jboss-EJB-3.0_RC5-PFD 
jdk1.5.0_06 

Remote Interface: 
package sample; 
import javax.ejb.Remote; 

@Remote 
public interface Sample{ 
    void func(); 
} 


Stateless Session Bean Class: 
package sample; 
import javax.ejb.Stateless; 

@Stateless 
public class SampleBean implements Sample{ 
    public void func() { 
    System.out.println("execute func."); 
    } 
}

Client Application:
import javax.naming.*;
import java.util.*;
import java.lang.*;
import sample.*;

public class Client {
    public static void main(String[] args) throws Exception {
        Context ctx = new InitialContext();
        Sample ejb = (Sample)ctx.lookup(Sample.class.getName());
        ejb.func();
    }
}

jndi.properties (classpath is passed):
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=localhost:1099


Error from Jboss:
Exception in thread "main" javax.naming.NameNotFoundException: sample.Sample 
not  bound
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:514)
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:522)
        at org.jnp.server.NamingServer.getObject(NamingServer.java:528)
        at org.jnp.server.NamingServer.lookup(NamingServer.java:281)
        at sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
        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 
un.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.main(Client.java:10)



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

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


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to