I use Jboss eap 6.4. I'd like to have those ears deployed simultaneously but on different ports. If I just put 2 ears into deployments I got: DuplicateServiceException: Service /app already registered.
To configure JBoss for App1.war on port 8080 and App2.war on port 8543, you should implement the following steps:
<socket-binding name="http2" port="8543"/>
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http" />
<connector name="http2" protocol="HTTP/1.1" scheme="http" socket-binding="http2" />
<virtual-server name="host1" enable-welcome-root="false" default-web-module="App1.war">
<alias name="first.com"/>
</virtual-server>
<virtual-server name="host2" enable-welcome-root="false" default-web-module="App2.war">
<alias name="second.com"/>
</virtual-server>
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http">
<virtual-server name="host1"/>
</connector>
<connector name="http2" protocol="HTTP/1.1" scheme="http" socket-binding="http2">
<virtual-server name="host2"/>
</connector>
- For App1.war
<jboss-web>
<virtual-host>host1</virtual-host>
</jboss-web>
- For App2.war
<jboss-web>
<virtual-host>host2</virtual-host>
</jboss-web>
Now each application can be accessed by following the urls:
For App1.war - http://first.com:8080/App1/index.jsp
For App2.war - http://second.com:8543/App2/index.jsp
Please bear in mind that in /etc/hosts
of the system, you must add the corresponding virtual-server alias names:
127.0.0.1 localhost.localdomain localhost first.com second.com