第二部分——项目中针对JBoss配置文件修改的详细介绍
根据如上的介绍,为了使JBoss支持IPv6,我们需要修改JBoss的两个配置文件。其一,修改standalone.xml中接口声明部分和socket端口绑定;其二,修改standalone.conf里面的JVM stack和address preferences。
1. standalone.xml,文件路径:$JBOSS-HOME/standalone/configuration
打开后可看到接口声明部分(interfaces)和socket端口绑定部分(socket-binding-group—)初始状态如下。接口声明中management、public、unsecure都指定的是jboss的本地回环地址,socket绑定默认接口就是public,前三个指定的是management接口,unsecure接口未使用。
为满足JBoss能够支持IPv4和IPv6双栈环境,则要将接口的选择条件修改为绑定到通配符状态,即,而socket绑定部分可不做修改,
接口声明部分修改后如下:
2. standalone.conf.bat,文件路径:$JBOSS-HOME/bin
注意这里修改的不是standalone.conf文件,因为修改该文件并没有使IPv6 address生效,亲测只有修改standalone.conf.bat文件才会生效。修改方法和第一部分里面Stack and address preference小节介绍一样,就是将-DJava.net.preferIPv4Stack=true修改为-Djava.net.preferIPv4Stack=false -Djava.net.preferIPv6Addresses=true即可,这样JVM启动的时候默认的是IPv6格式的地址,查看打印输出即可验证正确与否。
Calling "K:\jboss-as-7.1.1.Final\bin\standalone.conf.bat"
===============================================================================
JBoss Bootstrap Environment
JBOSS_HOME: K:\jboss-as-7.1.1.Final
JAVA: C:\Program Files (x86)\Java\jdk1.7.0_79\bin\java
JAVA_OPTS: -XX:+TieredCompilation -Dprogram.name=standalone.bat -Xms64M -Xmx51
2M -XX:MaxPermSize=256M -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.se
rver.gcInterval=3600000 -Djava.net.preferIPv4Stack=false -Djava.net.preferIPv6Ad
dresses=true -Dorg.jboss.resolver.warning=true -Djboss.modules.system.pkgs=org.j
boss.byteman -Djboss.server.default.config=standalone.xml
===============================================================================
22:39:47,729 信息 [org.jboss.modules] JBoss Modules version 1.1.1.GA
22:39:48,182 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA
22:39:48,322 INFO [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" sta
rting
22:39:50,572 INFO [org.xnio] XNIO Version 3.0.3.GA
22:39:50,572 INFO [org.jboss.as.server] JBAS015888: Creating http management se
rvice using socket-binding (management-http)
22:39:50,604 INFO [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA
22:39:50,619 INFO [org.jboss.remoting] JBoss Remoting version 3.2.3.GA
22:39:50,666 INFO [org.jboss.as.logging] JBAS011502: Removing bootstrap log han
dlers
22:39:50,682 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Po
ol -- 31) JBAS010280: Activating Infinispan subsystem.
22:39:50,729 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 38) JBAS0
11800: Activating Naming Subsystem
22:39:50,744 INFO [org.jboss.as.configadmin] (ServerService Thread Pool -- 26)
JBAS016200: Activating ConfigAdmin Subsystem
22:39:50,776 INFO [org.jboss.as.connector] (MSC service thread 1-1) JBAS010408:
Starting JCA Subsystem (JBoss IronJacamar 1.0.9.Final)
22:39:50,776 INFO [org.jboss.as.security] (ServerService Thread Pool -- 44) JBA
S013101: Activating Security Subsystem
22:39:50,807 INFO [org.jboss.as.mail.extension] (MSC service thread 1-1) JBAS01
5400: Bound mail session [java:jboss/mail/Default]
22:39:50,791 INFO [org.jboss.as.naming] (MSC service thread 1-8) JBAS011802: St
arting Naming Service
22:39:50,885 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 48)
JBAS015537: Activating WebServices Extension
22:39:51,010 INFO [org.jboss.as.osgi] (ServerService Thread Pool -- 39) JBAS011
940: Activating OSGi Subsystem
22:39:51,010 INFO [org.jboss.as.connector.subsystems.datasources] (ServerServic
e Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Dr
iver (version 1.3)
22:39:51,026 INFO [org.jboss.as.security] (MSC service thread 1-2) JBAS013100:
Current PicketBox version=4.0.7.Final
22:39:51,385 INFO [org.jboss.ws.common.management.AbstractServerConfig] (MSC se
rvice thread 1-8) JBoss Web Services - Stack CXF Server 4.0.2.GA
22:39:52,135 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread
1-4) Starting Coyote HTTP/1.1 on http--0_0_0_0_0_0_0_0-8080
22:39:52,526 INFO [org.jboss.as.remoting] (MSC service thread 1-1) JBAS017100:
Listening on /0:0:0:0:0:0:0:0:4447
22:39:52,526 INFO [org.jboss.as.remoting] (MSC service thread 1-5) JBAS017100:
Listening on /0:0:0:0:0:0:0:0:9999
22:39:52,526 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread
1-8) JBAS015012: Started FileSystemDeploymentService for directory K:\jboss-as-7
.1.1.Final\standalone\deployments
22:39:52,838 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service
thread 1-8) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
22:39:53,073 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin con
sole listening on http://[0:0:0:0:0:0:0:0]:9990
22:39:53,073 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS
7.1.1.Final "Brontes" started in 6079ms - Started 133 of 209 services (75 servic
es are passive or on-demand)
p.s. 如有错误还恳请大神们批评指正,非常感谢!