Lately I was trying to use remote ejb component which is part of .ear application in my .ear application. The exception I get is "No object bound to name java:comp/env/ejb/omNotifierDao" (stacktrace below the post).

So the conclusion from this is that ejb is visible as remote ejb and its name is omNotifierDao. Moreover in JNDI tree browser on the cluster-3 I see it is avaliable and its JNDI name is ejb/omNotifierDao (in the ejb implementation mapped name is set to ejb/omNotifierDao).

When I try to use it in my ejb using lookup the problem arisies. Some code sample:

@Remote
@Stateless(mappedName = "ejb/myApp/Service")

public class Service implements MyService {

InitialContext ic;....

try {
Object omNotifier;

omNotifier = getResource("ejb/omNotifierDao");

}......

private Object getResource(String name) throws NamingException {

if (this.ic == null) {
this.ic = new InitialContext();
}

return ic.lookup("java:comp/env/" + name);

}

When I try lookup from standalone client everything is ok, for example:

I tried to use annotations and configurating remote ejb in ejb-jar.xml. Everytime there is "No object bound to name java:comp/env/ejb/omNotifierDao exception".

Anyone has the idea what can be wrong or how to eliminate this? Maybe some glassfish v2.1 patch?

Thanx in advance for help or advice.

The stacktrace below:

[#|2011-07-12T14:41:48.804+0200|INFO|sun-appserver2.1|javax.enterprise.system.container.ejb|_ThreadID=84;_ThreadName=p: thread-pool-1; w: 24;|
javax.ejb.EJBException: No object bound to name java:comp/env/ejb/omNotifierDao
at pl.centertel.vas.isep.services.myApp.ejb.Service.notifyOM(Service.java:922)
at pl.centertel.vas.isep.services.myApp.ejb.Service.deactivate(Service.java:384)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1011)
at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:175)
at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2920)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:4011)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:203)
at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:77)
at $Proxy384.deactivate(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:154)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:687)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:227)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1846)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1706)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1088)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:223)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:806)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:563)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2567)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)