当遇到Exception in thread "main" javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]时
1.首先检查你的Context.PROVIDER_URL配置是否正确,例如Jboss4.0.2中是jnp://localhost:1099,当然这个1099端口也可能换,如果不知道请到%JBOSS_HOME%\server\default\conf\下查找jboss-service.xml在里面找到如下代码:
1 <mbean code="org.jboss.naming.NamingService"
2 name="jboss:service=Naming"
3 xmbean-dd="resource:xmdesc/NamingService-xmbean.xml">
4 <!-- The call by value mode. true if all lookups are unmarshalled using
5 the caller's TCL, false if in VM lookups return the value by reference.
6 -->
7 <attribute name="CallByValue">false</attribute>
8 <!-- The listening port for the bootstrap JNP service. Set this to -1
9 to run the NamingService without the JNP invoker listening port.
10 -->
11 <attribute name="Port">1099</attribute>
12 <!-- The bootstrap JNP server bind address. This also sets the default
13 RMI service bind address. Empty == all addresses
14 -->
15 <attribute name="BindAddress">${jboss.bind.address}</attribute>
16 <!-- The port of the RMI naming service, 0 == anonymous -->
17 <attribute name="RmiPort">1098</attribute>
18 <!-- The RMI service bind address. Empty == all addresses
19 -->
20 <attribute name="RmiBindAddress">${jboss.bind.address}</attribute>
21 <!-- The thread pool service used to control the bootstrap lookups -->
22 <depends optional-attribute-name="LookupPool"
23 proxy-type="attribute">jboss.system:service=ThreadPool</depends>
24 </mbean>
<attribute name="Port">1099</attribute> 看这里的端口号,修改这里的端口号为你provider_url配置的端口号,或着反过来修改你的provider_url的端口号为这里的端口号。
2.如果1中配置沒有问题,请检查你的防火墙,杀毒软件等安全工具是否禁止了端口,我用的mcafee,需要在mcafee的访问保护->属性->用户自定义规则添加一条规则,根据提示写入需要排除的端口号,然后在排除项中添加java.exe和javaw.exe确定即可,在试试,应该就可以了!
posted on 2010-06-12 16:03
天独 阅读(1224)
评论(0) 编辑 收藏