I have an application deployed at localhost on JBoss 6.0 AS. This application has one remote EJB bean called ExampleEJB. Now I'm trying to code a simple client application that consumes ExampleEJB. This client application will not be deployed at any application server. The idea is to code a simple Java SE client program. I've written the following trying to perform a lookup:
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL,"localhost:1099");
env.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
InitialContext ic = new InitialContext(env);
At this point, I've tried two approaches The first one was to perform a direct lookup like examplified at Java EE 6 Tutorial (http://docs.oracle.com/javaee/6/tutorial/doc/gipjf.html):
ExampleEJB exampleEJB = (ExampleEJB) ic.lookup("java:global/myApp/ExampleEJB");
The second attempt was to try to get the JNDI context enviroment and then get the desired bean from this enviroment:
Context envContext = (Context)ic.lookup("java:/comp/env");
envContext.lookup(...)
The problem is that I'm receiving the following exceptions: "javax.naming.NameNotFoundException: global not bound" and "javax.naming.NameNotFoundException: comp not bound" respectively. I'm unable to perform the lookup as desired.
Does someone have a clue?