JBOSS 点滴

丰丰的博客

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会抛出如上异常:

posted on 2009-06-02 17:22 半导体 阅读(5621) 评论(6)  编辑  收藏 所属分类: EJB

评论

# re: Could not obtain connection to any of these urls: 2009-06-25 14:11 DB

补充下:刚学时候容易把端口写成8080,那是TOMCAT的端口,JNDI应该设成1099  回复  更多评论   

# 非常好 2010-11-22 22:35 farseer

太感谢了,找了好久才找到怎么解决,谢谢楼主  回复  更多评论   

# re: Could not obtain connection to any of these urls: 2010-12-28 14:35

太感谢了,困扰了我一下午,觉都没睡好  回复  更多评论   

# re: Could not obtain connection to any of these urls: 2011-01-13 12:00 半导体

@DB
恩,补充得是!  回复  更多评论   

# re: Could not obtain connection to any of these urls: [未登录] 2012-05-11 23:38 java

问题得意解决、感谢楼主!!!  回复  更多评论   

# re: Could not obtain connection to any of these urls: 2013-12-31 13:24

请问可以吧在哪里改具体说清楚吗  回复  更多评论   


只有注册用户登录后才能发表评论。


网站导航: