Olá, estou tentando criar classes para fazer teste unitário em EJB no JBOSS…
Classe JUnit eh a seguinte:
(...)
protected void setUp() {
try {
Context ctx = getInitialContext();
Object ref = ctx.lookup("ejb/FornecedorFacade");
f = (FornecedorFacadeHome) PortableRemoteObject.narrow(ref,
FornecedorFacadeHome.class);
System.out.println("Fornecedor found");
} catch (javax.naming.NamingException e) {
System.out.println(e);
}
}
protected Context getInitialContext() throws javax.naming.NamingException {
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
p.put(Context.PROVIDER_URL, "jnpl://localhost:1099");
return new InitialContext(p);
}
(...)
jboss.xml
(...)
<session>
<ejb-name>FornecedorFacade</ejb-name>
<jndi-name>ejb/FornecedorFacade</jndi-name>
<local-jndi-name>ejb/FornecedorFacade</local-jndi-name>
</session>
(...)
Ao tentar fazer o lookup no nome jndi está gerando java.lang.NullPointerException, mas pelo descritor o nome está certo.
Alguma dica?
obrigado