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