照着黎活明老师的视频搞了个EJB3的HelloWorld,竟然怎么也搞不成功,今天终于无意中搞出来了,原因也很简单,单词拼错了,结果报了下面的错误!

把java.naming.provider.url给拼成java.naming.privoder.url了!唉,千不该,万不该啊!还好我在Google中搜“java.naming.privoder.url”提示找不到,才发现错误!!

 
  
  1. javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]  
  2. at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1465)  
  3. at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1594)  
  4. at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:634)  
  5. at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)  
  6. at javax.naming.InitialContext.lookup(InitialContext.java:392)  
  7. at cn.itcast.ejb3.test.EJBClient.main(EJBClient.java:21)  
  8. Caused by: java.net.SocketTimeoutException: Receive timed out 
  9. at java.net.PlainDatagramSocketImpl.receive0(Native Method)  
  10. at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:136)  
  11. at java.net.DatagramSocket.receive(DatagramSocket.java:712)  
  12. at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1435)  
  13. ... 5 more 

jndi.properties:

 
  
  1. java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory  
  2. java.naming.provider.url=127.0.0.1:1099