Could not obtain connection to any of these urls:

错误:
Exception in thread "main" javax.naming.CommunicationException: Could not obtain connection to any of these urls: 192.168.17.105:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server /192.168.17.105:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server /192.168.17.105:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]]
    at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1725)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:689)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at test.Client.main(Client.java:29)
处理:
在本文中将编写一个简单的无状态SessionBean。在发布EJB时,一般需要将EJB程序以jar文件的形式进行发布。这些jar文件将被放在<JBoss安装目录>/server/default/deploy目录中。如果在Eclipse中开发EJB程序,需要进行一些配置。首选需要在首选项(Preferences)对话框中设置JBoss的安装目录(如D:/jboss5)。然后在运行配置对话框中添加jboss的运行项。在jboss4.2及以后的版本中,默认情况下jboss只接收来自localhost或127.0.0.1的请求,也就是只接收本地的访问。为了使jboss接收来自其他地址的请求,在启动jboss时需要使用-b命令行参数进行设置。如下面的启动命令所示:

run.bat -b  200.200.200.123
run.bat -b 
0.0.0.0


    上面的第一行命令表示jboss可以接收来自200.200.200.123的请求。第二条命令表示jboss可以接收来自任意地址的请求。如果不设置-b参数,以非本机方式访问EJB时,JBoss会抛出如上异常:

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值