[jboss-user] [EJB/JBoss] - EJB lookup after deploying to Jboss

Richard.luo do-not-reply at jboss.com
Tue Jan 16 07:19:41 EST 2007


Hi everybody,

I'm deploying a simple HelloWorld(Bean) to the jboss as following steps:
1)Declare Remote statless session bean interface HelloWorld
2)Construct a implementation class named HelloWorldBean to implement the Remote interface with annotation @Stateless, and there is a method sayHello
3)Compile and make it jar files and then deploy it to jboss server
4)Start jboss server
5)Code the client class named TestHelloWorld

A error occurred when I used following code:

  |     InitialContext ic = new InitialContext();
  |     HelloWorldBean hwBean = (HelloWorldBean) ic.lookup("HelloWorldBean/remote");
  |     ...
  | 

But, if I used the following code it do not occur again:

  |     Hashtable ht = new Hashtable();
  |     ht.put(Context.PROVIDER_URL, "jnp://localhost:1099");
  |     ht.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
  |     InitialContext ic = new InitialContext(ht);
  |     HelloWorldBean hwBean = (HelloWorldBean) ic.lookup("HelloWorldBean/remote");
  | 

Would somebody help me? It confused me several days. In one word, I want to use Annotation but it seems not working correctly.
Thanks in advance.

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

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



More information about the jboss-user mailing list