我有一个在localhost:8085上运行的wildfly 10,其中包含一个servlet,当客户端发送请求时,它将返回一些结果数据。当我在我的本地计算机上使用我的Web浏览器进行测试时,它运行正常。现在我想使用外部设备,例如RaspberryPi向此servlet发送请求。如何将Wildfly服务器的IP地址从localhost更改为我的计算机的IP地址,以便我的RaspberryPi可以发送请求。谢谢
答案 0 :(得分:2)
直接在wildfly配置中更改IP(standalone.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>
....
</interfaces>
或将绑定地址指定为启动参数:
standalone.sh -b=0.0.0.0
或standalone.sh -Djboss.bind.address=0.0.0.0
请注意0.0.0.0
将强制JBoss绑定到所有网络适配器,您也可以指定确切的IP,如192.168.0.23
有关详细信息,请查看Wildfly docs