I have a Spring application which uses a remote stateless EJB hosted in WebLogic.
<jee:remote-slsb id="itemService"
jndi-name="org.example.ItemService"
business-interface="org.example.ItemService"
cache-home="false" lookup-home-on-startup="false"
home-interface="org.example.ItemServiceHome"
resource-ref="false" refresh-home-on-connect-failure="true">
<jee:environment>
java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
java.naming.provider.url=t3://server1:7101,server2:7101
</jee:environment>
</jee:remote-slsb>
My app gets items from the server thus:
ItemEntry[] itemEntries = itemService.listAvailableItems(criteria);
for(ItemEntry entry: itemEntries) {
Item item = itemService.getItemAccessObject(entry.getKey());
// Do something with item
}
This works fine most of the time.
However, when the item is very new (put in the database in the last couple of seconds), I get intermittent failures when I try to do anything with the Item:
java.rmi.NoSuchObjectException: CORBA OBJECT_NOT_EXIST 1330446337 No; nested exception is:
org.omg.CORBA.OBJECT_NOT_EXIST: vmcid: OMG minor code: 1 completed: No
For new objects, as described, the failures seem to happen approximately 50% of attempts, and within the for() loop there will be a mixture of failures and successes.
If I change the t3:// address to contain only one hostname:port, the problem goes away.
So, my working theory is that the listAvailableItems() call goes to one server in the cluster — where the items in question have arrived, and that the failing getItemAccessObject() calls are going to a different server, where the items are still syncing.
If I bypass Spring and manage the EJB context myself, I can’t reproduce the problem.
Questions:
- Is my working theory realistic? (note that the server cluster is a black box to me)
- How does the Spring SimpleRemoteStatelessSessionProxyBean and/or the WebLogic client divide calls between cluster members?
- Is there a way to make a sequence of calls go to the same cluster member?
Answering my own question, based on empirical evidence.
If you connect to Weblogic using
wlclient.jar, it uses the IIOP implementation in the core Java RTE.If you connect to Weblogic using
wlfullclient.jar, it uses WebLogic’s proprietary T3 protocol.The IIOP implementation round-robins between servers.
The T3 implemetation seems to maintain a session with a single server, at least while it can.