0
votes

Using Jboss AS 7.1.1 Final, I'm trying to invoke a Local EJB(3.1) through JNDI.

My Local EJB is:

@Stateless(mappedName = "Services")
@LocalBean
public class Services implements ServicesLocal {
.....// scary stuffs here
}

My Interface Services is:

@Local
public interface ServicesLocal {
.... // Some powerfull stuffs here
}

I'm trying to invoke this EJB above like this:

private ServicesLocal getLocalEJB() throws NamingException {
        log.info("\n\n\n\n\n\n\n\n ################## Getting the ServicesLocal");
        InitialContext context = new InitialContext();
        return (ServicesLocal) context.lookup("ejb:/global/docs/docs-ejb-0.1/Services!com.mycompany.docs.local.ServicesLocal");
    }

This is the error I'm getting when invoking this code above:

############ Getting the ServicesLocal

15:36:10,437 INFO [org.jboss.ejb.client] (http-localhost-127.0.0.1-8080-1) JBoss EJB Client version 1.0.5.Final 15:36:10,456

ERROR [stderr] (http-localhost-127.0.0.1-8080-1) java.lang.IllegalStateException: No EJB receiver available for handling [appName:,modulename:global,distinctname:docs] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@396f6a24 15:36:10,457 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) ^Iat org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:584)

And this is the JNDI log when the Jboss 7.1.1 Final boot. Having the EJB that I want to invoke:

15:07:07,975 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-7) JNDI bindings for session bean named Services in deployment unit subdeployment "docs-ejb-0.1.jar" of deployment "docs.ear" are as follows:

java:global/docs/docs-ejb-0.1/Services!com.mycompany.docs.local.ServicesLocal
java:app/docs-ejb-0.1/Services!com.mycompany.docs.local.ServicesLocal
java:module/Services!com.mycompany.docs.local.ServicesLocal
java:global/docs/docs-ejb-0.1/Services!com.mycompany.docs.services.Services
java:app/docs-ejb-0.1/Services!com.mycompany.docs.services.Services
java:module/Services!com.mycompany.docs.services.Services

I think my context.lookup("ejb:/global/docs/docs-ejb-0.1/Services!com.mycompany.docs.local.ServicesLocal") is wrong. What I can do to fix that and invoke my Local EJB with JNDI?

1

1 Answers

0
votes

Have you tried to use what JBoss tells you?

context.lookup("java:global/docs/docs-ejb-0.1/Services!com.mycompany.docs.local.ServicesLocal")

Your EJB is stored in java namespace, not in ejb one.