[jboss-user] [EJB 3.0] - Re: How to access an EJB (3.0) in Jboss from a Client in Web

klejs do-not-reply at jboss.com
Thu Nov 30 16:34:20 EST 2006


Hi,

You need something like this;

Properties p = new Properties( );
  | //Specify the JNDI properties specific to the vendor.
  | p.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
  | p.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
  | p.put("java.naming.provider.url","jboss_host_name");
  | Context ctx = new InitialContext(p);
  | 
  | Object ref = context.lookup("path_to_ejb_in_jndi");
  | BeanRemoteInterface bean = (BeanRemoteInterface)
  |                 PortableRemoteObject.narrow(ref,BeanRemoteInterface.class);

And you will need the remote interface on your classpath and the jboss client lib.

/klejs



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

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



More information about the jboss-user mailing list