同一台机器启动多个JBOSS的设置
同一台机器启动多个JBoss不像Tomcat,Tomcat只需要修改两三个端口即可,而JBoss默认发布的服务端口包括http协议的8080、AJP协议的8009、JNP服务的1099、RMI命名服务的1098、RMI/JRMP invoker的4444端口等,而且不是在同一个文件中配置的,有些在server.xml中,有些在配置下的jboss-service.xml文件中。
以下是本人修改成功的设置步骤:
1) 更改webservice的端口信息,\server\default\conf\jboss-service.xml文件
<mbean code="org.jboss.web.WebService" name="jboss:service=WebService"> <attribute name="Port">8083</attribute> <!-- Should non-EJB .class files be downloadable --> <attribute name="DownloadServerClasses">true</attribute> <!-- Should resources other than .class files be downloadable. Both DownloadServerClasses and DownloadResources must be true for resources to be downloadable. This is false by default because its generally a bad idea as server configuration files that container security information can be accessed. --> <attribute name="DownloadResources">false</attribute> <attribute name="Host">${jboss.bind.address}</attribute> <attribute name="BindAddress">${jboss.bind.address}</attribute> <!-- Use the default thread pool for dynamic class loading --> <depends optional-attribute-name="ThreadPool" proxy-type="attribute">jboss.system:service=ThreadPool</depends> </mbean>
2) 更改JNDI的端口信息,\server\default\conf\jboss-service.xml文件
<mbean code="org.jboss.naming.NamingService" name="jboss:service=Naming" xmbean-dd="resource:xmdesc/NamingService-xmbean.xml"> <!-- The call by value mode. true if all lookups are unmarshalled using the caller's TCL, false if in VM lookups return the value by reference. --> <attribute name="CallByValue">false</attribute> <!-- 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> <!-- The RMI service bind address. Empty == all addresses --> <attribute name="RmiBindAddress">${jboss.bind.address}</attribute> <!-- The thread pool service used to control the bootstrap lookups --> <depends optional-attribute-name="LookupPool" proxy-type="attribute">jboss.system:service=ThreadPool</depends> </mbean>
3) 更改RMI端口信息,\server\default\conf\jboss-service.xml文件
<!-- 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> <!-- <attribute name="RMIClientSocketFactory">custom</attribute> <attribute name="RMIServerSocketFactory">custom</attribute> <attribute name="RMIServerSocketAddr">custom</attribute> <attribute name="SecurityDomain">ssl-domain-name</attribute> --> <depends>jboss:service=TransactionManager</depends> </mbean> <mbean code="org.jboss.invocation.local.LocalInvoker" name="jboss:service=invoker,type=local"> <depends>jboss:service=TransactionManager</depends> </mbean> <mbean code="org.jboss.invocation.pooled.server.PooledInvoker" name="jboss:service=invoker,type=pooled"> <attribute name="NumAcceptThreads">1</attribute> <attribute name="MaxPoolSize">300</attribute> <attribute name="ClientMaxPoolSize">300</attribute> <attribute name="SocketTimeout">60000</attribute> <attribute name="ServerBindAddress">${jboss.bind.address}</attribute> <attribute name="ServerBindPort">4445</attribute> <attribute name="ClientConnectAddress">${jboss.bind.address}</attribute> <attribute name="ClientConnectPort">0</attribute> <attribute name="ClientRetryCount">1</attribute> <attribute name="EnableTcpNoDelay">false</attribute>
4) 更改JMS端口, \server\default\deploy\jms\uil2-service.xml文件
<mbean code="org.jboss.mq.il.uil2.UILServerILService" name="jboss.mq:service=InvocationLayer,type=UIL2"> <!-- The server chain --> <depends optional-attribute-name="Invoker">jboss.mq:service=Invoker</depends> <!-- JNDI binding --> <attribute name="ConnectionFactoryJNDIRef">ConnectionFactory</attribute> <!-- JNDI binding for XA --> <attribute name="XAConnectionFactoryJNDIRef">XAConnectionFactory</attribute> <!-- The bind address --> <attribute name="BindAddress">${jboss.bind.address}</attribute> <!-- The bind port --> <attribute name="ServerBindPort">8093</attribute>
5) 修改EJB服务地址,\server\default\deploy\iPegasusWEB.war\WEB-INF\classes\ipegasus.properties文件
EJB_SERVER_URL = localhost:1099 //填写步骤2中修改后的Port IMG_REMOTE_URL = http://localhost:9999/ipegasus/UploadFile/ REPLACE_URL = /ipegasus/UploadFile/
6) 更改jboss启动端口,\server\default\deploy\jbossweb-tomcat55.sar\server.xml文件
<!-- A HTTP/1.1 Connector on port 8080 --> <Connector port="8800" address="${jboss.bind.address}" maxThreads="350" strategy="ms" maxHttpHeaderSize="8192" emptySessionPath="true" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="GBK"/>
7) 修改Jconsole监控端口,\jboss \bin\run.bat文件
set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.port=8950 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintTenuringDistribution -XX:+PrintClassHistogram -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCApplicationStoppedTime