Jboss7常用操作
1、linux下jboss启动、关闭jboss-home/bin/standalone.sh & // 后台运行,窗口关闭,jboss不退出jboss-home/bin/jboss-cli.sh --connect command=:shutdown // 停止jboss
·
1、linux下jboss启动、关闭
jboss-home/bin/standalone.sh & // 后台运行,窗口关闭,jboss不退出
JBOSS_HOME/bin/standalone.sh --server-config=standalone-ha.xml >/dev/null 2>/dev/null &
jboss-home/bin/jboss-cli.sh --connect command=:shutdown // 停止jboss
<jboss_home>/bin/jboss-cli.sh --connect --command=:shutdown
<jboss_home>/bin/jboss-cli.sh --connect controller=ip:port --command=:shutdown
controller的ip:port指的是management-http指定的ip和port
<socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
其中ip来自:
<interface name="management">
<inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
port来自:
port="${jboss.management.http.port:9990}"
port-offset="${jboss.socket.binding.port-offset:100}"
也就是port+port-offset=9990+100=10090
<jboss_home>/bin/jboss-cli.sh --user=commu --password=88390809 --connect controller=ip:port --command=:shutdown
2、开启远程调试
jboss-home/bin/
standalone.conf(Unix or Linux) 或者standalone.conf.bat (Windows).
# Sample JPDA settings for remote socket debugging
#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n" // 去掉#,即可开启远程调试
如果是windows
rem # Sample JPDA settings for remote socket debugging
rem set "JAVA_OPTS=%JAVA_OPTS% -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n" // 去掉rem,即可开启远程调试
3、其他机器也可访问jboss 8080端口
除了本机可以通过127.0.0.1:8080访问之外,还可以通过本机实际ip访问,例如:192.168.1.2:8080,其他机器也要能访问jboss-home/bin/standalone.sh -b 192.168.1.2
这样就可以通过实际ip访问了
还可以修改配置文件,推荐用这个方法:
jboss-home/standalone/configuration/standalone.xml
搜索socket-binding-group找到
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
如果default-interface用的是public,则修改这里
<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>
改为
<interface name="public">
<inet-address value="${jboss.bind.address:0.0.0.0}"/>
</interface>
4、绑定本机实际ip
只能通过本机实际ip访问jboss下的应用,不能通过127.0.0.1或localhost等访问。以windows为例:
编辑standalone.conf.bat,增加
set "JAVA_OPTS=%JAVA_OPTS% -Djboss.bind.address.management=192.168.1.123 -Djboss.bind.address=192.168.1.123"
如果改完重启不起作用,尝试改下standalone.xml和standalone-ha.xml的这里:
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>
<interface name="unsecure">
<inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
</interface>
</interfaces>
全都改为127.0.0.1再重启试试。bt jboss
5、直接通过域名访问
直接通过域名访问应用例如www.abc.com,而不用www.abc.com/myapp。调整war为ROOT.war。
6、支持自动部署war目录
编辑standalone-ha.xml或者standalone.xml,找到对应内容,改为如下即可。适用于wildfly8、9
<deployment-scanner scan-interval="5000" relative-to="jboss.server.base.dir"
path="deployments" auto-deploy-zipped="true" auto-deploy-exploded="false"/>
path="deployments" auto-deploy-zipped="true" auto-deploy-exploded="false"/>
7、java.lang.ClassNotFoundException: org.infinispan.manager.CacheContainer from [Module "deployment.**.war:main" from Service Module Loader]
找到standalone-ha.xml,添加
<subsystem xmlns="urn:jboss:domain:ee:3.0">
<global-modules>
<module name="org.apache.log4j" slot="main"/>
<module name="org.javassist" slot="main"/>
<module name="asm.asm" slot="main"/>
<module name="org.springframework" slot="main"/>
<module name="org.apache.commons.lang" slot="main"/>
<module name="org.apache.commons.io" slot="main"/>
<module name="org.infinispan" slot="main"/>
</global-modules>
<global-modules>
<module name="org.apache.log4j" slot="main"/>
<module name="org.javassist" slot="main"/>
<module name="asm.asm" slot="main"/>
<module name="org.springframework" slot="main"/>
<module name="org.apache.commons.lang" slot="main"/>
<module name="org.apache.commons.io" slot="main"/>
<module name="org.infinispan" slot="main"/>
</global-modules>
可以不用在jboss-deployment-structure.xml单独添加依赖
更多推荐
已为社区贡献2条内容
所有评论(0)