This content has been marked as final.
Show 1 reply
-
1. Re: How to access an EJB (3.0) in Jboss from a Client in Web
klejs Nov 30, 2006 4:34 PM (in response to websphere_lover)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