Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Executing DBTestRunner from "SCJD Exam with J2SE 5 Platform"

 
John Huntingdon
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get the following error when trying to execute DBTestRunner from "SCJD Exam with J2SE 5 Platform":

Exception in thread "main" java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at sampleproject.sockets.DvdSocketClient.initialize(DvdSocketClient.java:300)
at sampleproject.sockets.DvdSocketClient.<init>(DvdSocketClient.java:70)
at sampleproject.sockets.DvdConnector.getRemote(DvdConnector.java:37)
at sampleproject.test.DBTester.<init>(DBTester.java:50)
at sampleproject.test.DBTestRunner.startClients(DBTestRunner.java:54)
at sampleproject.test.DBTestRunner.<init>(DBTestRunner.java:41)
at sampleproject.test.DBTestRunner.main(DBTestRunner.java:29)

Any comments would be appreciated; I have tried a number of things to fix this. I get this running in Eclipse or from the command line.

Thanks in advance!

John
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi John,

Running only the DBTestRunner class is not enough. Because the DBTestRunner tries to connect with the server (using RMI or sockets as a protocol, depending on the import statement in DBTester) you have to make sure your server is up and running on the appropriate machine and port number.

According to these lines in DBTester (and

you have to make sure your RMI-server is running on the same machine you are running the DBTestRunner from and on port 1099 (the default RMI port).

To start the RMI server of Denny's DVD you should take a look at RegDvdDatabase and change the code in the main method to

If the server is successfully started and running you should be able to run DBTestRunner.

Kind regards,
Roel
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic