Setting up multiple ports on a single JBoss instance?
Asked Answered
P

2

1

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>  
Ptomaine answered 2/3, 2011 at 17:26 Comment(0)
O
7

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.

Olwen answered 2/3, 2011 at 17:32 Comment(5)
I don't see a jbossweb-tomcat55.sar, only a jbossweb.sar. There I already have a connector for each port. Is there a specific option I may be missing?Ptomaine
Yes, in JBoss 5 it's jbossweb.sar. Add the ports, then restart APP SERVER. See with netstat if ports are listening...Olwen
@Adam: check out updated answer and look for that on the LOG.Olwen
The initializing messages are there. I was able to make a workaround in our case, but I'll leave this question open in case others figure out a solution or have a similar problem. I think it has something to do with how JBoss is handling the wsdl request because the webservices themselves are able to use the ports successfully.Ptomaine
I'm going to mark this as complete since it contains some useful debugging info and I'm past the problem myself.Ptomaine
R
0

One doubt, since all the connections are redirected to 8443, what is the point in giving multiple configuration? will it avoid port congestion?

Roberson answered 22/11, 2011 at 8:33 Comment(1)
Welcome to SO Mohammed. The goal was to simulate many host addresses using a single instance of JBoss. By the way, questions like yours work best as comments on the original question at the top. Welcome again and keep asking those questions!Ptomaine

© 2022 - 2024 — McMap. All rights reserved.