I am using Weblogic 11g, EJB3.0.
I am trying to do simple look up from one deployment to another in the same machine. But no success.
This is the code:
In one deployment this is the target class:
@CallByReference
@Stateless (mappedName = "ejb/SyncOperatorsBean")
@Local ({SyncOperatorsBeanLocal.class})
@Remote ({SyncOperatorsBeanRemote.class})
@JNDIName("ejb/SyncOperatorsBean") //added
public class SyncOperatorsBean implements SyncOperatorsBeanLocal,SyncOperatorsBeanRemote
...
Now in the second deployment, this is how I do the lookup in order to reach the first deployment:
SyncOperatorsBeanRemote SyncOperatorsBean = (SyncOperatorsBeanRemote) context
.lookup("ejb/SyncOperatorsBean#com.mirs.sbngenerate.beans.SyncOperatorsBeanRemote");
SyncOperatorsBean.executeSyncOperation();
That's the exception:
javax.naming.NameNotFoundException: While trying to lookup 'ejb.SyncOperatorsBean#com.mirs.sbngenerate.beans.SyncOperatorsBeanRemote' didn't find subcontext 'SyncOperatorsBean#com'. Resolved 'ejb'; remaining name 'SyncOperatorsBean#com/mirs/sbngenerate/beans/SyncOperatorsBeanRemote'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
Now I can see the bean SyncOperatorsBean in the console's JNDI TREE. But still have the above exception.
I can't use Injection
since the calling class is out of the container (inside quartz job).
Any idea?
I have fixed the problem by taking off the @JNDI annotation. and adjust the lookup command like that:
SyncOperatorsBeanRemote SyncOperatorsBean =
(SyncOperatorsBeanRemote) context
.lookup("ejb/SyncOperatorsBean#com.mirs.sbnsync.beans.SyncOperatorsBeanRemote");
SyncOperatorsBean.executeSyncOperation();
more over I had to add the target class jar to the server lib dir.(weird but thats what I had to do)