Win a copy of Learning Java by Building Android Games this week in the Android 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
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Urgent Help...Connection refused to host  RSS feed

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am creating application in Java. My application is connecting to SQL server 2000. It connects properly for couple of minutes and then I am getting following error.
java.rmi.ConnectException: Connection refused to host: xxx.xx.xxx.xxx; nested exception is:
java.net.ConnectException: Connection refused: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source)
at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at circdatabase.client.StatusFrame_Stub.callRefresh(Unknown Source)
at circdatabase.loanServices.LoanServiceImpl.callRefresh(Unknown Source)
at circdatabase.loanServices.LoanServiceImpl$Schedule$RemindTask.run(Unk
nown Source)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
Caused by: 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.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 sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown S
ource)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown S
ource)
... 9 more
-----------------------------------
Can anyone please help me out?
Thanks,
AJT
 
author and iconoclast
Sheriff
Posts: 24220
40
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi "AJT"
Welcome to JavaRanch!
Before I answer your question: we ain't got many rules here at the Ranch, but we do have our naming policy. Most of us here just use our real names; please head over to here and change your display name to follow the rules. Thanks, pardner!
Now, as to your question: my guess is that you're opening new connections, but not closing the old ones. Eventually, you're going to run out and get errors like the above. Be sure you close all your Connections and Statements when you're through using them!
 
Ajay Thacker
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Thank you for your quick response.
I am closing my connections.
I am running like ten java RMI Servers. Each of them are connecting to database server (SQL server 2000). I have five different databases on server and each RMI server is connecting to five databases using different connections. I am not sure how many connections sql server allows at a time. Though My app works fine for couple of minutes and then it starts throwing this exceptions. I don't know why.
Do I need to reduce number of connections that i am making?
Can you please guide me?
Thank you,
Ajay Thacker.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!