Reputation: 4994
I'm running WebLogic 12c and have several beans deployed as part of an EAR file. I also have a standalone client which I'm running from Eclipse that is trying to access the remote EJBs. I'm using annotations and therefore the global, portable JNDI names from EJB 3.1 (e.g. java:global/ifactory/ifactory-ejb-4.0.0/BomServiceBean!com.icumed.ifactory3.service.BomServiceRemote).
However, when the remote client tries to call the EBJ, I get the following exception:
11:45:03,400 ERROR [com.icumed.ifactory3.service.RemoteServiceFactoryImpl] [getService('java:global/ifactory/ifactory-ejb-4.0.0/BomServiceBean!com.icumed.ifactory3.service.BomServiceRemote')] Context may not be null
java.lang.AssertionError: Context may not be null
at weblogic.j2eeclient.SimpleContext.checkForNameUnderRemoteNode(SimpleContext.java:103)
at weblogic.j2eeclient.SimpleContext.internalLookup(SimpleContext.java:68)
at weblogic.j2eeclient.SimpleContext.lookup(SimpleContext.java:39)
at weblogic.jndi.SimpleContext.lookup(SimpleContext.java:86)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at com.icumed.ifactory3.service.RemoteServiceFactoryImpl.getService(RemoteServiceFactoryImpl.java:323)
The bean looks like this:
@Stateless
public class BomServiceBean extends AbstractSessionBean implements LocalBomService, BomServiceRemote
{
...
}
Further information: this error occurs when wlthint3client.jar and then wlclient.jar are on the classpath.
When only wlthint3client.jar is on the classpath, the exception is
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Long
at weblogic.rmi.internal.StubInfo.getEnvQueriedJNDITimeout(StubInfo.java:256)
at weblogic.rmi.internal.StubInfo.setEnvQueriedJNDITimeout(StubInfo.java:242)
at weblogic.rmi.internal.StubInfo.readObject(StubInfo.java:238)
When wlclient.jar and then wlthint3client.jar are on the classpath, WebLogic prints this log message:
The connection attempt was rejected because the incoming protocol iiop is not enabled on channel Default[iiop][12]
How do I correct this?
Upvotes: 0
Views: 353
Reputation: 4994
First, ensure that you only have the wlthint3client.jar in the classpath and not also wlclient.jar. That will get rid of the AssertionError and leave you only with the ClassCastException.
Second, the ClassCastException problem is in the code of wlthint3client.jar (StubInfo.java). The following two properties do not get converted properly from String to Long if you specify them in the jndi.properties file.
Long o = (Long)props.get("weblogic.jndi.responseReadTimeout");
if (o == null) {
o = (Long)props.get("weblogic.rmi.clientTimeout");
}
If you need to set these properties you will have to create a Hashtable in your code and pass that to the InitialContext.
Hashtable<String, Object> env = new Hashtable<String, Object>();
env.put("weblogic.jndi.responseReadTimeout", 15000L);
env.put("weblogic.rmi.clientTimeout", 15000L);
Upvotes: 0