0

I am using spring portlet mvc as my front end and connecting to some remote EJB running on a WAS. Now in my configuration file for the portlet where I specify the remote EJB lookup url, I have specified the url(s) as a cluster since the EJB is deployed in a clustered WAS. So the url looks like :iiop://server1:port,iiop://server2:port.

Now to save resources, spring mvc caches the initial context.Now I am noticing that spring is always able to make a connection to the remote ejb so long as one of the servers is up.

This is confusing to me since the cluster is resolved(for lack of a better word) at the time of lookup of the initial context and after that if the cluster member goes down, there should be a connection exception. So how does spring know when it should automatically refresh its initial context because the old context has become stale?

Victor
  • 15,091
  • 64
  • 201
  • 364

1 Answers1

1

I found that in the applicationContext.xml file, there is the declaration:

<jee:remote-slsb id="remoteService" jndi-name="com.business.ejb.ServiceSLRemote" business-interface="com.business.ejb.ServiceSLRemote" cache-home="true" lookup-home-on-startup="false" resource-ref="false" refresh-home-on-connect-failure="true">
<jee:environment>
java.naming.factory.initial=${JAVA.NAMING.FACTORY.INITIAL}
java.naming.provider.url=${JAVA.NAMING.PROVIDER.URL}
</jee:environment>
</jee:remote-slsb>

It is the refresh-home-on-connect-failure="true" that tells the spring container that if the initial context has become stale, then it should refresh the connection. That is how it can work so long as one cluster member is active.

Victor
  • 15,091
  • 64
  • 201
  • 364