Multiple JBoss on same machine

From Initq

Jump to: navigation, search

Contents

Introduction

Many times we have come across issues where we need to run two applications on jboss. JBoss runs on port 8080 and if you run another instance of jboss it will probably not even start and also from down the first one. We will show you how to change all the ports in jboss so you can run another copy of jboss on a higher port and still have 8080 running. We will be changing to 18080 so
1098 changes to 11098
8080 changes to 18080
1099 changes to 11099

Make sure you do not go beyond 65535. We normally add a number in the beginning of the jboss port to add another instance. If you follow this scheme then the most servers you can have on one machine will be 5.

Versions

As of this writing the most current JBoss is 4.2.3. We also used jdk 1.5.0_09 and ant 1.6.5. We will not be dealing with ant in our setup but it's always good to have it installed. We also use absolute links to jdk in our start up files so we can experiment with different versions with different apps.

Server Folders

We normally use the default server for all our deployment so we will copy this folder to another. We will use apptricityerm40 as our fictitious application.

copy jboss/server/default jboss/server/apptricityerm40

We will only be concerned with the conf and deploy folder within apptricityerm40 server.

conf folder

  • \jboss\server\apptricityerm40\conf\jboss-service.xml
8083
      <attribute name="BindAddress">${jboss.bind.address}</attribute>      
      <attribute name="Port">8083</attribute>
1099 and 1098
      <!-- The listening port for the bootstrap JNP service. Set this to -1
         to run the NamingService without the JNP invoker listening port.
      -->
      <attribute name="Port">1099</attribute>
      <!-- The bootstrap JNP server bind address. This also sets the default
         RMI service bind address. Empty == all addresses
      -->
      <attribute name="BindAddress">${jboss.bind.address}</attribute>
      <!-- The port of the RMI naming service, 0 == anonymous -->
      <attribute name="RmiPort">1098</attribute>
4444
      <!-- RMI/JRMP invoker -->
      <mbean code="org.jboss.invocation.jrmp.server.JRMPInvoker"
      name="jboss:service=invoker,type=jrmp">
      <attribute name="RMIObjectPort">4444</attribute>
      <attribute name="ServerAddress">${jboss.bind.address}</attribute>
4445
      <attribute name="ServerBindAddress">${jboss.bind.address}</attribute>
      <attribute name="ServerBindPort">4445</attribute>
      <attribute name="ClientConnectAddress">${jboss.bind.address}</attribute>
4446
      <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
      <attribute name="serverBindPort">4446</attribute>

deploy folder

  • \jboss\server\apptricityerm40\deploy\ejb3.deployer\META-INF\jboss-service.xml
3873
      <depends>jboss.aop:service=AspectDeployer</depends>
      <attribute name="InvokerLocator">socket://${jboss.bind.address}:3873</attribute>
      <attribute name="Configuration">

      <attribute name="serverBindAddress">${jboss.bind.address}</attribute>
      <attribute name="serverBindPort">3873</attribute>
  • \jboss\server\apptricityerm40\deploy\http-invoker.sar\META-INF\jboss-service.xml
8080
     <attribute name="InvokerURLPrefix">http://</attribute>
     <attribute name="InvokerURLSuffix">:8080/invoker/EJBInvokerServlet</attribute>

     <attribute name="InvokerURLPrefix">http://</attribute>
     <attribute name="InvokerURLSuffix">:8080/invoker/JMXInvokerServlet</attribute>

     <attribute name="InvokerURLPrefix">http://</attribute>
     <attribute name="InvokerURLSuffix">:8080/invoker/readonly/JMXInvokerServlet</attribute>
  • \jboss\server\apptricityerm40\deploy\jboss-web.deployer\server.xml
8080 8443 8009
         <Connector port="8080" address="${jboss.bind.address}"    
         maxThreads="250" maxHttpHeaderSize="8192"
         emptySessionPath="true" protocol="HTTP/1.1"
         enableLookups="false" redirectPort="8443" acceptCount="100"
         connectionTimeout="20000" disableUploadTimeout="true" />

         <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />

         <Connector port="8009" address="${jboss.bind.address}" protocol="AJP/1.3"
         emptySessionPath="true" enableLookups="false" redirectPort="8443" />
  • \jboss\server\apptricityerm40\deploy\jms\jms-ds.xml
1100
       java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
       java.naming.provider.url=localhost:1100
  • \jboss\server\apptricityerm40\deploy\jms\uil2-service.xml
8093
    <!-- The bind port -->
    <attribute name="ServerBindPort">8093</attribute>
  • \jboss\server\apptricityerm40\deploy\cache-invalidation-service.xml
1099
    <attribute name="ProviderUrl">MyOtherNode:1099</attribute>

JBoss Start up

To start our new application you will need to do the following:

  • cp run.* to runapptricity.*

Create a new file and call it runapp.sh or runapp.bat if you use windows. put the following in that file:

start runapp.bat -c apptricityerm40 -Djboss.bind.address=0.0.0.0

Test

Try to access the jmx-console. Make sure to replace the port with your port number.

Personal tools