Problem Context
Here's the situation. We are running a simulator servlet from a war. The servlet we are simulating has many instances on a single machine differentiated by port number. We would like to only deploy a single war which can be accessed by many ports.
What We Have So Far
Using a java Filter
(see below for web.xml) we are able to forward to each servlet implementation based on port number (ports were added by adding extra connectors to deploy/jbossweb.sar/server.xml
). This works for all web service calls, but not for wsdl requests like http://localhost:8092/simulator/sim?wsdl
where 8092 is the desired version of the simulator out of many (8091, 8092, 8093, 8094). On that request the wsdl is returned correctly (each simulator implementation is slightly different) except that the URL soap:address
tag always uses port 8091.
Note: We are using JBoss 5.0
relevant parts of web.xml:
<filter>
<filter-name>SimFilter</filter-name>
<filter-class>com.example.filter.MyFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>SimFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
You need to modify Tomcat's configuration (JBoss uses an embedded version of Tomcat).
Relevant file is:
$ $JBOSS_HOME/server/default/deploy/jbossweb-tomcat55.sar/server.xml
There is a portion where you configure the binding ports. This is what comes by default:
<!-- A HTTP/1.1 Connector on port 8080 -->
<Connector port="8080" address="${jboss.bind.address}"
maxThreads="250" strategy="ms" maxHttpHeaderSize="8192"
emptySessionPath="true"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"/>
You can add several "connectors". One for each port you need.
Then restart your JBoss.
You will see something like this on the LOG:
16:29:13,803 INFO [Http11BaseProtocol] Initializing Coyote HTTP/1.1 on http-0.0.0.0-8080
16:29:13,804 INFO [Http11BaseProtocol] Initializing Coyote HTTP/1.1 on http-0.0.0.0-8091
16:29:13,805 INFO [Http11BaseProtocol] Initializing Coyote HTTP/1.1 on http-0.0.0.0-8092
16:29:13,805 INFO [Http11BaseProtocol] Initializing Coyote HTTP/1.1 on http-0.0.0.0-8093
16:29:13,805 INFO [Http11BaseProtocol] Initializing Coyote HTTP/1.1 on http-0.0.0.0-8094
This is what you need to add on your server.xml
file:
<Connector port="8091" address="${jboss.bind.address}"
maxThreads="250" strategy="ms" maxHttpHeaderSize="8192"
emptySessionPath="true"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"/>
<Connector port="8092" address="${jboss.bind.address}"
maxThreads="250" strategy="ms" maxHttpHeaderSize="8192"
emptySessionPath="true"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"/>
....
One XML tag for each new port.