1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
Properties props = new Properties();
props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
props.setProperty("java.naming.provider.url", "jnp://localhost:1099");
props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
try{
Context ctx = new InitialContext(props);
Object obj = ctx.lookup("ejb/MyBean");
MyBeanHome home = (MyBeanHome)PortableRemoteObject.narrow(obj, MyBeanHome.class);
MyBean mb = home.create();
}
catch(NamingException e){
.....
} |