[jboss-user] [JNDI/Naming/Network] - Accessing an EJB with jndi

mporhel do-not-reply at jboss.com
Mon Jul 28 06:29:55 EDT 2008


Hello !

I'm doing some tests to acces EJBs from the Tuscany, the Apache's SCA Runtime. 

I would like to acces an ejb deployed in JBoss, from a pojo client, I am using the following code : 

 Properties properties = new Properties();
  | properties.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
  | properties.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
  | properties.put("java.naming.provider.url", "jnp://127.0.0.1:1099");
  | properties.put("jnp.disableDiscovery", "true");            
  |        
  | InitialContext jndiContext = new InitialContext(properties);
  | 
  | // Get a reference to the VegetablesCatalogEJB Bean
  | Object o = jndiContext.lookup("VegetablesCatalogEJB");
  | 
  | // Get a reference to the Bean's Home interface
  | CatalogEJBHome home=(CatalogEJBHome)PortableRemoteObject.narrow(o, CatalogEJBHome.class);

If the same ejb is deployed in Apache Geronimo, I can access from tuscany thanks to the following uri :
 corbaname:iiop:1.2 at localhost:1050#VegetablesCatalogEJB
and from a java client : 
 InitialContext context = new InitialContext();
  | Object o = context.lookup("corbaname:iiop:1.2 at localhost:1050#VegetablesCatalogEJB");
  | CatalogEJBHome home = (CatalogEJBHome)PortableRemoteObject.narrow(o, CatalogEJBHome.class);

I would like to know if I can access my ejb deployed in JBoss with an uri, like I do in the pojo client for Geronimo.

I think that if this is not possible, it comes from the "java.naming.initial" factory, isn't it ?
  
Thanks

Maxime Porhel

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

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



More information about the jboss-user mailing list