5 Using WebLogic Server Clustering

Spring applications can take advantage of WebLogic Server's clustering features. Because most Spring applications are packaged as Web applications (.war files), you need do not need to do anything special in order to take advantage of WebLogic Server clusters; all you need to do is deploy your Spring application to the servers in a WebLogic Server cluster.

The certification of Spring 1.2.8, and 2.0, and 2.5.3 on WebLogic Server extends the Spring JndiRmiProxyFactoryBean and its associated service exporter so that it supports proxying with any J2EE RMI implementation. To use the extension to the JndiRmiProxyFactoryBean and its exporter:

  1. Configure client support by implementing code such as the following:

    <bean id="proProxy" 
        class="org.springframework.remoting.rmi.JndiRmiProxyFactoryBean">
      <property name="jndiName" value="t3://${serverName}:${rmiPort}/order"/>
      </property>
      <property name="jndiEnvironment">
        <props>
          <prop key="java.naming.factory.url.pkgs">weblogic.jndi.factories</prop>
        </props>
      </property>
      <property name="serviceInterface" 
        value="org.springframework.samples.jpetstore.domain.logic.OrderService"/>
    </bean>
    
  2. Configure the service exporter by implementing code such as the following:

    <bean id="order-pro" 
        class="org.springframework.remoting.rmi.JndiRmiServiceExporter">
      <property name="service" ref="petStore"/>
      <property name="serviceInterface" 
        value="org.springframework.samples.jpetstore.domain.logic.OrderService"/>
      <property name="jndiName" value="order"/>
    </bean>