在JBoss7.1目录jboss-as-7.1.1.Final/standalone/configuration下找到standalone.xml,找到以下的节点,在尝试了以下两种方法:
1.
<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>
把127.0.0.1这台机器的真实IP或者域名
我尝试用这种方法不成功,第二种方法是我推荐的
2.在第一点到节点下面再增加下面到节点
<!-- add a new interface add by czh 2013-04-20 -->
<interface name="any">
<any-ipv4-address/>
</interface>
接着,修改以下节点default-interface为any
<socket-binding-group name="standard-sockets" default-interface="any" port-offset="${jboss.socket.binding.port-offset:0}">
<socket-binding name="management-native" interface="management" port="${jboss.management.native.port:9999}"/>
<socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
<socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9443}"/>
<socket-binding name="ajp" port="8009"/>
<socket-binding name="http" port="8080"/>
<socket-binding name="https" port="8443"/>
<socket-binding name="osgi-http" interface="management" port="8090"/>
<socket-binding name="remoting" port="4447"/>
<socket-binding name="txn-recovery-environment" port="4712"/>
<socket-binding name="txn-status-manager" port="4713"/>
<outbound-socket-binding name="mail-smtp">
<remote-destination host="localhost" port="25"/>
</outbound-socket-binding>
</socket-binding-group>
修改完后,重启JBoss7.1就可以用外网的IP来访问了,而且不用固定IP的。第一种需要固定IP