Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Executing DBTestRunner from "SCJD Exam with J2SE 5 Platform"

 
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
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • 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
 
It's a beautiful day in this neighborhood - Fred Rogers. Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic