照着黎活明老师的视频搞了个EJB3的HelloWorld,竟然怎么也搞不成功,今天终于无意中搞出来了,原因也很简单,单词拼错了,结果报了下面的错误!
把java.naming.provider.url给拼成java.naming.privoder.url了!唉,千不该,万不该啊!还好我在Google中搜“java.naming.privoder.url”提示找不到,才发现错误!!
- javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]
- at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1465)
- at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1594)
- at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:634)
- at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
- at javax.naming.InitialContext.lookup(InitialContext.java:392)
- at cn.itcast.ejb3.test.EJBClient.main(EJBClient.java:21)
- Caused by: java.net.SocketTimeoutException: Receive timed out
- at java.net.PlainDatagramSocketImpl.receive0(Native Method)
- at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:136)
- at java.net.DatagramSocket.receive(DatagramSocket.java:712)
- at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1435)
- ... 5 more
jndi.properties:
- java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
- java.naming.provider.url=127.0.0.1:1099
转载于:https://blog.51cto.com/huqianhao/955283