| Author |
Accessing EJBs from an Axis WebService
|
Henrique Ordine
Ranch Hand
Joined: Sep 03, 2004
Posts: 127
|
|
Hi everyone,
I've created a webservice using Axis and I'd like to access an EJB which is in the same EAR as my webservice class.
I've deployed this EAR on JBoss 5.
My EJB:
@Stateless (name="AutorizaAcessoService", mappedName="ejb/AutorizaAcessoService")
public class AutorizaAcessoService implements IAutorizaAcessoService {
...
}
In my WebService class (which is in my war module) I try:
InitialContext context = new InitialContext();
NamingContext nc = (NamingContext) context.lookup("java:comp/env");
IAutorizaAcessoService aaService = (IAutorizaAcessoService)nc.lookup("ejb/AutorizaAcessoService");
There is a context for "java:comp/env" but at the last line I get a
javax.naming.NameNotFoundException: ejb not bound
My web.xml looks like:
<ejb-local-ref>
<ejb-ref-name>AutorizaAcessoService</ejb-ref-name>
<local>br.gov.cgu.ativa.service.autorizaracessosistema.IAutorizaAcessoService</local>
<mapped-name>ejb/AutorizaAcessoService</mapped-name>
</ejb-local-ref>
And my JBoss-web.xml:
<ejb-local-ref>
<ejb-ref-name>AutorizaAcessoService</ejb-ref-name>
<local-jndi-name>ejb/AutorizaAcessoService</local-jndi-name>
</ejb-local-ref>
Could anyone please help me find this EJB?
|
J2EE Architect/Developer
|
 |
Henrique Ordine
Ranch Hand
Joined: Sep 03, 2004
Posts: 127
|
|
Never mind, got it.
I had to add my EAR's name to JNDI.
context.lookup("ativa-ear/AutorizaAcessoService/remote");
Just for the record.
|
 |
 |
|
|
subject: Accessing EJBs from an Axis WebService
|
|
|