Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error executing Head First EJB first example

 
Shouvanik Haldar
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I am following Head First EJB. I know it has EJB 2.0 which is old as now EJB 3.1 is in. But I consider Head first book a good book for learning for amateurs like us.

I am using J2ee 1.3.1 RI and jdk 1.4. I ran the "deploy" tool to deploy by EJB and now I have a ejb client JAVA program given below:








Following the book, I compiled the program. The "Properties" part is something not mentioned in the example. I got it from some other examples on the web. Now, that when I am executing the client, am getting the following error:


F:\EJBProject\advice>java -classpath AdviceAppClient.jar;. AdviceClient
javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:

java.net.SocketTimeoutException: Read timed out]
at com.sun.jndi.rmi.registry.RegistryContext.lookup(Unknown Source)
at com.sun.jndi.rmi.registry.RegistryContext.lookup(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)
at AdviceClient.go(AdviceClient.java:26)
at AdviceClient.main(AdviceClient.java:11)
Caused by: java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
java.net.SocketTimeoutException: Read timed out
at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
at sun.rmi.server.UnicastRef.newCall(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
... 5 more
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at java.io.DataInputStream.readByte(Unknown Source)

Please help. I am stuck up badly here. I wanted to sit for the OCBCD exam!

Regards, Shouvanik
 
Shouvanik Haldar
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am surprised. I thought this forum is very active. Still I did not get a reply. Anyone who had this running in the past, please share the steps
 
Shouvanik Haldar
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you hit a roadblock while running the first EJB example simply follow these steps
to run the first example of HeadFirst EJB.

Softwares
1. j2sdk1.4.1 - jdk
2. j2sdkee1.3.1 - j2ee RI
3. CMD (command prompt)

Compile all the classes using c:\j2sdkee1.3.1\lib\j2ee.jar library.
Now, create a App and deploy EJB inside RI. download the application client as shown in the book.

Now, comes the tricky part.

Compile client class using the following jars

javac -classpath AdviceAppClient.jar;c:\j2sdkee1.3.1\lib\j2ee.jar AdviceClient.java

Next, run the client as follows

java -cp AdviceAppClient.jar;c:\j2sdkee1.3.1\lib\j2ee.jar;c:\j2sdk1.4.1\jre\lib\rt.jar;. AdviceClient
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic