Connection Refused Error when running run_protege_server

Post Reply
MichaelDunn
Posts: 5
Joined: 31 May 2011, 09:12

I have a new installation of Essential running on Windows Server 2008 R2 64 bit, with the following software versions:

Protege 3.4.6 (Build 613)
Java VM 6.0.250.6
Apache Tomcat/6.0.32

Any help with the problem below would be appreciated.

I can run successfully in standalone mode but when I try to start a serve process using run_protege_server.bat I get an RMI Error (see very end of post)

The text of my batch file is as follows:
-----------------BEGIN----------------------------
set JDKBIN="C:\Program Files\Java\jre6\bin"

rem Note that a space character in the following path must be replaced with '%%20' in
rem a batch file. If you are typing directly on the command line, a space must be
rem replaced with '%20'.

set CODEBASE_URL=file:/c:/program%%20files/protege_3.4.6/protege.jar

start /D%JDKBIN% /min rmiregistry.exe

set CLASSPATH=protege.jar;looks.jar;unicode_panel.jar;driver.jar;driver0.jar;driver1.jar
set MAINCLASS=edu.stanford.smi.protege.server.Server
set METAPROJECT=/D:/EssentialAm/Repository/essential_metamodel/essential_baseline_v1.2.pprj

set MAX_MEMORY=-Xmx500M
set HEADLESS=-Djava.awt.headless=true
set CODEBASE=-Djava.rmi.server.codebase=%CODEBASE_URL%
set LOG4J_OPT=-Dlog4j.configuration=file:log4j.xml

rem --- Optional arguments; uncomment if necessary ---
set HOSTNAME=-Djava.rmi.server.hostname=localhost
set "PORTOPTS=-Dprotege.rmi.server.port=5200 -Dprotege.rmi.registry.port=5100"
rem TX=-Dtransaction.level=READ_COMMITTED
rem "DEBUG_OPT=-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"

set OPTIONS=%MAX_MEMORY% %CODEBASE% %HEADLESS% %LOG4J_OPT% %HOSTNAME% %PORTOPTS% %TX% %DEBUG_OPT%

rem ------------------- Cmd Options -------------------
rem If you want automatic saving of the project,
rem setup the number of seconds in SAVE_INTERVAL_VALUE
rem set SAVE_INTERVAL=-saveIntervalSec=120
rem ------------------- Cmd Options -------------------


%JDKBIN%\java %OPTIONS% -cp %CLASSPATH% %MAINCLASS% %SAVE_INTERVAL% %METAPROJECT%

----------------END---------------------------
Protege server is starting...
Protege 3.4.6 Build 613, JVM 1.6.0_25-b06, memory=506M, Windows Server 2008 R2,
encoding=UTF-8, language=en, country=GB
WARNING: Is the registry running? -- java.rmi.ConnectException: Connection refus
ed to host: 10.36.6.55; 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.newCall(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.list(Unknown Source)
at edu.stanford.smi.protege.server.Server.checkRegistry(Unknown Source)
at edu.stanford.smi.protege.server.Server.startServer(Unknown Source)
at edu.stanford.smi.protege.server.Server.main(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.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 sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown S
ource)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown S
ource)
... 8 more

SEVERE: server startup failed -- java.io.IOException: Could not connect to the r
mi registry task
at edu.stanford.smi.protege.server.Server.checkRegistry(Unknown Source)
at edu.stanford.smi.protege.server.Server.startServer(Unknown Source)
at edu.stanford.smi.protege.server.Server.main(Unknown Source)
User avatar
jonathan.carter
Posts: 1087
Joined: 04 Feb 2009, 15:44

Hi,

This looks like a fairly simple configuration issue. As the Protege server starts, it must register itself with the Java RMI Registry so that clients can find and connect to it. The exception message you've included suggests that the RMI Registry is not running.

Looking at your 'run_protege_server.bat' that you posted, it looks like there's a line missing just before the '%JDKBIN%\java %OPTIONS%' line.
There should be (and I've just checked my Protege 3.4.6 'run_protege_server.sh' file and there it is...) a line just before this that starts the RMI Registry. Something like:

Code: Select all

start %JDKBIN%\rmiregistry
You can run the 'run_protege_server.bat' file many times without explicitly stopping RMI Registry and the 'start rmiregistry' command will just report a warning and be ignored.

If you've edited the 'run_protege_server.bat' file, it's worth having a look at the original installed version. Alternatively, if (for some reason) the Protege team have separated the RMI Registry starter into another file, have a look in the <PROTEGE_INSTALL> folder for a likely BAT file to run and start the RMI Registry.

By the way, we've got a ticket open with the Protege team at the moment about version 3.4.6. For an as-yet unknown reason, the initial open of a project by a client from the Protege server takes an unexpectedly long time (e.g. 1 minute 40 seconds) which clearly isn't right. Once you've got past this all seems well. If you can work around the time delay, carry on using Protege 3.4.6 but if this delay is a problem for you or your users (it doesn't create a good impression...) then we recommend that you revert to Protege 3.4.4. This can be installed alongside 3.4.6 and will be able to work with your existing metaproject and Essential repository project files/database.

Let me know how you get on with starting the RMI Registry.

Jonathan
Essential Project Team
MichaelDunn
Posts: 5
Joined: 31 May 2011, 09:12

Advice was spot on server process in now running, many thanks for prompt response.
JeffDG
Posts: 4
Joined: 11 Jun 2018, 20:55

I'm having a similar issue right now.

Here's the startup run:

Code: Select all

D:\Essential\Protege>run_protege_server.bat

D:\Essential\Protege>set JDKBIN=D:\JAVA\bin

D:\Essential\Protege>rem Note that a space character in the following path must be replaced with '%20' in

D:\Essential\Protege>rem a batch file.  If you are typing directly on the command line, a space must be

D:\Essential\Protege>rem replaced with '0'.

D:\Essential\Protege>set CODEBASE_URL=file:/D:/Essential/Protege/protege.jar

D:\Essential\Protege>start /DD:\JAVA\bin /min rmiregistry

D:\Essential\Protege>set CLASSPATH=protege.jar;looks.jar;unicode_panel.jar;driver.jar;driver0.jar;driver1.jar

D:\Essential\Protege>set MAINCLASS=edu.stanford.smi.protege.server.Server

D:\Essential\Protege>set METAPROJECT=examples\server\metaproject.pprj

D:\Essential\Protege>set MAX_MEMORY=-Xmx2048M

D:\Essential\Protege>set HEADLESS=-Djava.awt.headless=true

D:\Essential\Protege>set CODEBASE=-Djava.rmi.server.codebase=file:/D:/Essential/Protege/protege.jar

D:\Essential\Protege>set LOG4J_OPT=-Dlog4j.configuration=file:log4j.xml

D:\Essential\Protege>rem --- Optional arguments; uncomment if necessary ---

D:\Essential\Protege>rem set HOSTNAME=-Djava.rmi.server.hostname=127.0.0.1

D:\Essential\Protege>rem set "PORTOPTS=-Dprotege.rmi.server.port=5200 -Dprotege.rmi.registry.port=5100"

D:\Essential\Protege>REM TX=-Dtransaction.level=READ_COMMITTED

D:\Essential\Protege>rem "DEBUG_OPT=-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"

D:\Essential\Protege>set OPTIONS=-Xmx2048M  -Djava.rmi.server.codebase=file:/D:/Essential/Protege/protege.jar -Djava.awt.headless=true -Dlog4j.configuration=file:log4j.xml -Djava.rmi.server.hostname=127.0.0.1 -Dprotege.rmi.server.port=5200 -Dprotege.rmi.registry.port=5100

D:\Essential\Protege>rem ------------------- Cmd Options -------------------

D:\Essential\Protege>rem If you want automatic saving of the project,

D:\Essential\Protege>rem setup the number of seconds in SAVE_INTERVAL_VALUE

D:\Essential\Protege>rem set SAVE_INTERVAL=-saveIntervalSec=120

D:\Essential\Protege>rem ------------------- Cmd Options -------------------

D:\Essential\Protege>D:\JAVA\bin\java -Xmx2048M  -Djava.rmi.server.codebase=file:/D:/Essential/Protege/protege.jar -Djava.awt.headless=true -Dlog4j.configuration=file:log4j.xml -Djava.rmi.server.hostname=127.0.0.1 -Dprotege.rmi.server.port=5200 -Dprotege.rmi.registry.port=5100   -cp protege.jar;looks.jar;unicode_panel.jar;driver.jar;driver0.jar;driver1.jar edu.stanford.smi.protege.server.Server  examples\server\metaproject.pprj
Protege server is starting...
Protege 3.5 Build 663, JVM 1.8.0_181-b13, memory=1908M, Windows Server 2016, encoding=UTF-8, language=en, country=US
WARNING: Is the registry running? -- java.rmi.ConnectException: Connection refused to host: 172.30.1.166; 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.newCall(Unknown Source)
        at sun.rmi.registry.RegistryImpl_Stub.list(Unknown Source)
        at edu.stanford.smi.protege.server.Server.checkRegistry(Unknown Source)
        at edu.stanford.smi.protege.server.Server.startServer(Unknown Source)
        at edu.stanford.smi.protege.server.Server.main(Unknown Source)
Caused by: java.net.ConnectException: Connection refused: connect
        at java.net.DualStackPlainSocketImpl.connect0(Native Method)
        at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
        at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
        at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
        at java.net.AbstractPlainSocketImpl.connect(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 sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source)
        at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source)
        ... 8 more

SEVERE: server startup failed -- java.io.IOException: Could not connect to the rmi registry task
        at edu.stanford.smi.protege.server.Server.checkRegistry(Unknown Source)
        at edu.stanford.smi.protege.server.Server.startServer(Unknown Source)
        at edu.stanford.smi.protege.server.Server.main(Unknown Source)


D:\Essential\Protege>

The RMIServer seems to start without issue.
User avatar
jonathan.carter
Posts: 1087
Joined: 04 Feb 2009, 15:44

The RMI registry will start up without much trouble but what you're seeing is a failure to connect to it.

I think this is all related to this post which will describe how to tweak the ports on which the RMI Registry and the Protege Server will communicate, which is important if you need to access them across a firewall, which block the RMI Ports. (RMI opens a very wide range of ports dynamically!)

Jonathan
Essential Project Team
Post Reply