fixed bug that would check for another server running on the default rmi port
even if helma was using only the embedded webserver.
This commit is contained in:
parent
4b35b3bf2c
commit
b4595a2a29
1 changed files with 9 additions and 4 deletions
|
@ -203,7 +203,12 @@ import org.mortbay.util.*;
|
|||
dbSources = new Hashtable ();
|
||||
|
||||
try {
|
||||
checkRunning (); // check if a server is already running with this db
|
||||
// check if servers are already running on the given ports
|
||||
if (websrvPort==0)
|
||||
checkRunning (rmiPort);
|
||||
else
|
||||
checkRunning (websrvPort);
|
||||
checkRunning (xmlrpcPort);
|
||||
} catch (Exception running) {
|
||||
System.out.println (running.getMessage ());
|
||||
System.exit (1);
|
||||
|
@ -383,14 +388,14 @@ import org.mortbay.util.*;
|
|||
/**
|
||||
* A primitive method to check whether a server is already running on our port.
|
||||
*/
|
||||
private void checkRunning () throws Exception {
|
||||
private void checkRunning (int portNumber) throws Exception {
|
||||
try {
|
||||
java.net.Socket socket = new java.net.Socket ("localhost", rmiPort);
|
||||
java.net.Socket socket = new java.net.Socket ("localhost", portNumber);
|
||||
} catch (Exception x) {
|
||||
return;
|
||||
}
|
||||
// if we got so far, another server is already running on this port and db
|
||||
throw new Exception ("Error: Server already running on this port");
|
||||
throw new Exception ("Error: Server already running on this port: " + portNumber);
|
||||
}
|
||||
|
||||
public String getProperty( String key ) {
|
||||
|
|
Loading…
Add table
Reference in a new issue