I have created a stateless bean and deployed it to jboss its deployed perfectly.
but when i trying to call its method from one of my standalone application its 
giving me EJB not bound Exception. Please Help

The interface code is:
package poji;

import java.rmi.RemoteException;

import javax.ejb.Remote;

@Remote
public interface Service {

        public String loadLayout(String string) throws RemoteException;
}

the bean class is:package poji;

import java.rmi.RemoteException;

import javax.ejb.Remote;
import javax.ejb.Stateless;

import org.jboss.annotation.ejb.RemoteBinding;



@Stateless
//@Remote( { Service.class })
//@RemoteBinding (jndiBinding="Service")
public class ServiceBean implements Service 
{
        public String loadLayout(String alayout) throws RemoteException
        {
                return alayout;
        }
}


And the client is:
package pojo;

import javax.naming.InitialContext;

import poji.Service;

public class ServiceClient {

public static void main(String[] args) throws Exception {

        InitialContext ctx = new InitialContext();
        Service service = (Service) ctx.lookup(Service.class.getName());
        for (int i = 0; i < 5; i++) {
        String returnedString = service.loadLayout("Hello" + i);
        System.out.println("The received String is: " + returnedString);
        }
}
}


the exception which im getting is:

xception in thread "main" javax.naming.NameNotFoundException: poji.Service 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: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(Unknown Source)
        at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
        at sun.rmi.server.UnicastRef.invoke(Unknown Source)
        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(Unknown Source)
        at pojo.ServiceClient.main(ServiceClient.java:16)


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

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


-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to