Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-30-2009, 01:34 AM
Member
 
Join Date: Mar 2009
Posts: 1
Rep Power: 0
JDPS is on a distinguished road
Default Server app throwin connection refused to host...help
Hi,

I'm trying to use remoting as part of my graduate project and have come across a problem and i was hoping someone could help me out.

When i try to run my runService App. I get the following Error:

Connection refused to host: localHost; nested exception is:
java.net.ConnectException: Connection refused: connect

My runService class is : -



package DAO;
import java.rmi.*;



public class runService {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
try
{Naming.rebind("//localHost:8100/dataAccess", new DataAccessObjectImpl());
System.out.println( "Data Access Server is ready" );

}
catch(Exception e){
System.out.println(e.getMessage());}
}

}



I have trimmed the classes down to three methods as the post can only have 5000
the DataAccessObject interface is : -




package DAO;

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.sql.*;
import com.sun.rowset.CachedRowSetImpl;
import java.rmi.Remote;
import java.rmi.RemoteException;



public interface dataAccessObject extends Remote{





public String generateConnectionString()throws RemoteException ;

public String getUserPassword(String username)throws RemoteException ;

public void ExecuteDML(String username, String sql)throws RemoteException ;

}



the DataAccessObjectImpl class reads as : -


package DAO;

import java.sql.*;
import java.util.Properties;
import java.io.*;
import com.sun.rowset.CachedRowSetImpl;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.*;
import java.rmi.server.*;

public class DataAccessObjectImpl extends UnicastRemoteObject implements dataAccessObject{

Connection conn ;
String driver = "oracle.jdbc.driver.OracleDriver";
CachedRowSetImpl ds ;
String theString;
int theNumber;
Date theDate;
ResultSet rs;
String theConnectionURL;
String thePassword;

public DataAccessObjectImpl() throws RemoteException{

}



public String generateConnectionString() throws RemoteException {
Properties configFile = new Properties();
try {
configFile.load(this.getClass().getClassLoader().g etResourceAsStream("app_config.properties"));
} catch (IOException error) {
throw new RemoteException(error.getMessage());
}
String connection = configFile.getProperty("JTSTORESConnection");
return connection;
}

public String getUserPassword(String username)throws RemoteException {
Properties configFile = new Properties();
try {
configFile.load(this.getClass().getClassLoader().g etResourceAsStream("app_config.properties"));
} catch (IOException error) {
throw new RemoteException(error.getMessage());
}
String pwd = configFile.getProperty(username.toUpperCase() + "_PWD");
return pwd;
}

public void ExecuteDML(String username, String sql) throws RemoteException {


try {
Class.forName(driver); // load Oracle driver
theConnectionURL = generateConnectionString();
thePassword = getUserPassword(username);
conn = DriverManager.getConnection(theConnectionURL, username, thePassword);
Statement s = conn.createStatement();
s.executeUpdate(sql);
conn.commit();
s.close();
conn.close();
} catch (SQLException error) {
throw new RemoteException(error.getMessage());
} catch (ClassNotFoundException error) {
throw new RemoteException(error.getMessage());
}

}




If anyone can enlighten me unto what is happening i would be very grateful



thanks

James
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exception: An established connection was aborted by the software in your host machine vidhya.sk Advanced Java 4 04-26-2009 01:02 PM
Error opening socket: java.net.ConnectException: Connection refused: connect somersst Java Servlet 3 01-26-2009 06:30 PM
"connection refused when attempting to contact localhost katie New To Java 2 11-21-2008 09:36 PM
Socket refused, but applet talking to native server Waccoon Networking 1 12-17-2007 12:13 PM
java.net.ConnectException: Connection refused Albert Advanced Java 2 07-03-2007 05:49 PM


All times are GMT +2. The time now is 09:32 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org