You might want to run more than one instance of a Spring container on a single host. This allows you to load balance between multiple containers and also allows you to separate applications. Setting up multiple Spring containers to run on a single host requires you to modify each container's configuration so that there are no resource clashes.
If you want to run more than one Spring container on the same host, you must do the following:
Make a copy of the container.wsdl
file, which is located in the
InstallDir
/containers/spring_container/etc/wsdl
directory.
In your new copy, my_container.wsdl
, change the port on which the Web service interface listens from 2222
to
another port by changing the address property as shown below:
<service name="ContainerService"> <port name="ContainerServicePort" binding="tns:ContainerServiceBinding"> <soap:address location="http://localhost:2222/AdminContext/AdminPort"/> </port> </service>
Make a copy of the spring_container.xml
file, which is located in the
directory.InstallDir
/containers/spring_container/etc
Make the following changes to your new copy,
:my_spring_container
.xml
Container repository location—change the container's containerRepository
property to point to a new repository.
For example, you change:
<container:container id="container"
containerRepository="c:\iona\fuse-services-framework/containers/spring_container/repository"
scanInterval="5000"/>
To:
<container:container id="container"
containerRepository="MyNewContainerRepository/spring_container/repository
"
scanInterval="5000"/>
Change the port on which the Web service interface listens by changing the address
property as follows:
<jaxws:endpoint id="ContainerService" implementor="#ContainerServiceImpl" address=" http://localhost:2222/AdminContext/AdminPort">
Change the JMX port from 1099
to a new port as show in the following line:
<bean id="serverConnector"
class="org.springframework.jmx.support.ConnectorServerFactoryBean"
depends-on="registry">
<property name="serviceUrl" value="service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi/server"/>
</bean>
Change the RMI registry port from 1099
to a new port as shown in the following snipit:
<bean id="registry" class="org.springframework.remoting.rmi.RmiRegistryFactoryBean">
<property name="port" value="1099"/>
</bean>
Make a copy of the JMX console launch script, jmx_console_start.bat
, which is located in the
directory.InstallDir
/bin
Change the following line in the copy of the JMX console launch script to point to the JMX port that is specified above:
service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi/server
Start the new container by passing the URL, or file location of its configuration file, my_spring_container.xml
, to the
start_container
script as follows:
InstallDir
/bin/spring_container -config my_spring_container.xml start
To view the new container using the JMX console, run the JMX console launch script created in steps 5 and 6.
Stop the new container by passing the URL or file location of its WSDL file, my_container.wsdl
, to the spring_container command.
For example, if the my_container.wsdl
file has been saved to the InstallDir
/containers/spring_container/wsdl
directory, run the following command:
InstallDir
/bin/spring_container -wsdl ..\containers\spring_container\wsdl\my_container.wsdl stop