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) 开发者_Go百科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?
Take a look at the JNDI tree for the managed server(s) where the EJB is deployed and see if you can find it. Also, are you using the URL of the Admin Server or the managed server where the EJB is deployed?
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)
精彩评论