Salve a tutti. Ho creato un EJB e ho fatto il deploy sotto JBoss e funziona tutto perfettamente. I prrblemi nascono con il client. Vi posto il codice:
codice:
public class ClientBean {
public static void main(String[] args) {
Properties prop = new Properties();
prop.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
prop.put(Context.PROVIDER_URL, "jnp://localhost:1099");
try {
// ottiene riferimento a JNDI
//InitialContext ctx = new InitialContext();
InitialContext ctx = new InitialContext(prop);
// ottiene riferimento alla home interface
Object ref = ctx.lookup("AdderBean");
// casting
if ( ref != null ){
AdderHome home = (AdderHome)PortableRemoteObject.narrow(ref, AdderHome.class);
Adder adder = home.create();
System.out.println(adder.add(2, 5));
}
} catch (Exception e) { System.out.println(e.getMessage()); }
}
}
Quando mando in esecuzione il client mi dice:
AdderBean not bound
Dove è il è problema???