• Post Reply Bookmark Topic Watch Topic
  • New Topic

Accessing EJBs from an Axis WebService

 
Henrique Ordine
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Henrique Ordine
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never mind, got it.
I had to add my EAR's name to JNDI.
context.lookup("ativa-ear/AutorizaAcessoService/remote");

Just for the record.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!