[jboss-user] [EJB 3.0] - EJB3 Bean Access

ia96herz do-not-reply at jboss.com
Wed Mar 18 04:41:44 EDT 2009


Hi JBoss Users

I was not sure if I should place this question within the JNDI or EJB3 part.

I am currently moving from Weblogic/Spring1/EJB2 to JBoss4/EJB3/Spring2.

I have created a small application which I will deploy on JBoss. The application consits a stateless bean:


  | @Stateless(name = "ExperimentServiceEJB")
  | public class ExperimentServiceEJB implements ExperimentService {
  | ...
  | }
  | 
  | 

After the deployment I have the following entry in the JNDI View of JBoss:


  | +- project (class: org.jnp.interfaces.NamingContext)
  |   |   +- ExperimentServiceEJB (class: org.jnp.interfaces.NamingContext)
  |   |   |   +- remote (proxy: $Proxy68 implements interface com.roche.research.theraps.service.ExperimentService,interface org.jboss.ejb3.JBossProxy)
  | 

Now I would like to access the EJB with a small client application:


  | Properties properties = new Properties();
  | properties.put(Context.INITIAL_CONTEXT_FACTORY,
  |         "org.jnp.interfaces.NamingContextFactory");
  | properties.put(Context.PROVIDER_URL,
  |         "jnp://hostname:port");
  | properties.put(Context.URL_PKG_PREFIXES,
  |         "org.jboss.naming:org.jnp.interfaces");
  | try {
  |         InitialContext ctx = new InitialContext(properties);
  |         ExperimentService service = (ExperimentService)
  |             ctx.lookup("projects/ExperimentServiceEJB/remote");
  | }
  | 

I tried many things but I always get a javax.naming.NameNotFoundException. Does anybody of you have some ideas what is going wrong? Is this the right way to implement such an application? Do I have to add something?

Many thanks in advance.

Dave

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

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



More information about the jboss-user mailing list