multi user install problems ClassNotFoundException

Post Reply
henseggs
Posts: 9
Joined: 10 Jun 2014, 11:29

I have followed the multi user guide http://www.enterprise-architecture.org/ ... multi-user twice and I am obviously missing or completing the same step wrong as I keep getting the
ClassNotFoundException: edu.stanford.smi.protege.server.Server_Stub
error when I try to start run_protege_server.sh

I have tried to change the CODEBASE_URL to use http class
CODEBASE_URL=http://localhost:8080/....

My setup:
  • xUbuntu 14.10
    Java (Oracle) java version "1.7.0_60"
    mysql db
Any suggestions?
Charlie
User avatar
jonathan.carter
Posts: 1087
Joined: 04 Feb 2009, 15:44

Hi Charlie,

I'm pretty sure that this issue will be resolved by the CODEBASE_URL thing.

Just to make sure that we haven't missed anything, it's really important that the URL that you specify in that CODEBASE_URL parameter is pointing to an active HTTP server that is running and has the protege.jar file available at the location that you've specified.

The issue is all about how the RMI system connects the client to the server

This thread (which you may have already read, if so apologies) is worth a look through has a trail through fixing this.
Protege server not starting

Jonathan
Essential Project Team
henseggs
Posts: 9
Joined: 10 Jun 2014, 11:29

I've just rechecked CODEBASE_URL.
CODEBASE_URL=http://localhost:8080/protege.jar

As a non root user I've been able to download the file.

curl -o ./Test.jar http://localhost:8080/protege.jar
This results in a the creation of Test.jar that is a copy of the protege.jar servered from my tomcat root.
User avatar
jonathan.carter
Posts: 1087
Joined: 04 Feb 2009, 15:44

I normally put this in the root folder of the Essential Viewer web application as we would expect that to be running, and makes sure that there are no particular non-web app constraints being applied, e.g. by Tomcat,
as per this post.

Although CURL seems to work, it could be that there's something else getting in the way.

According to the Protege team's guidance on this issue with Java 7 , the CODEBASE_URL is the way to resolve this.

Could you post more of the stack trace of the exception to help us understand why CODEBASE_URL is not resolving the issue?

Jonathan
Essential Project Team
henseggs
Posts: 9
Joined: 10 Jun 2014, 11:29

I tried a fresh install (again) this time on Centos.

I am getting the same error message.

This is a more verbose output from the run_protege_server.sh script.

Loaded 80000 instances: essential_prj_CC_v1.4.1_ProjectKB_Instance_10099
Loaded 81000 instances: essential_prj_CC_v1.4.2_ProjectKB_Instance_12700
Set type on 71000 instances: essential_prj_CC_v1.4.1_ProjectKB_Instance_10100
Set type on 72000 instances: essential_prj_CC_v1.4.2_ProjectKB_Instance_15640
Loaded 82000 instances: essential_prj_CC_v1.4.2_ProjectKB_Instance_170137
Set type on 73000 instances: essential_prj_DD_v1.1_ProjectKB_Instance_80117
Loaded 83000 instances: essential_prj_EE_v0.1_ProjectKB_Instance_20086
Set type on 74000 instances: viewer3_dev_12032012_ProjectKB_Class12873
Loaded 84000 instances: viewer3_dev_12032012_ProjectKB_Class13488
Set type on 75000 instances: viewer3_dev_12032012_ProjectKB_Class17791
Loaded 85000 instances: viewer3_devrep_14032012_003_ProjectKB_Class11984
Loading project plugins for project Essential AM Repository
WARNING: Could not find the ChAO KB. -- ChangesProject.initialize()
SEVERE: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: edu.stanford.smi.protege.server.Server_Stub
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:419)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:267)
at sun.rmi.transport.Transport$1.run(Transport.java:177)
at sun.rmi.transport.Transport$1.run(Transport.java:174)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:275)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:252)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:378)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at edu.stanford.smi.protege.server.Server.bindName(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.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: edu.stanford.smi.protege.server.Server_Stub
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:409)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:267)
at sun.rmi.transport.Transport$1.run(Transport.java:177)
at sun.rmi.transport.Transport$1.run(Transport.java:174)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.ClassNotFoundException: edu.stanford.smi.protege.server.Server_Stub
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.rmi.server.LoaderHandler$Loader.loadClass(LoaderHandler.java:1206)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at sun.rmi.server.LoaderHandler.loadClassForName(LoaderHandler.java:1219)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:452)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:185)
at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:637)
at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:264)
at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:214)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1612)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1517)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
... 13 more
User avatar
jonathan.carter
Posts: 1087
Joined: 04 Feb 2009, 15:44

Thanks. I appreciate that there's a lot of trace here.

Does it contain the following statements at any point in that trace?

Code: Select all

SEVERE: server startup failed -- java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: access to class loader denied
Caused by
.....
Caused by: java.security.AccessControlException: access denied (java.io.FilePermission C:\Users\csnyulas\workspace\Protege-core\build\dist\- read)
in particular the bit about "access to class loader denied" and "java.security.AccessControlException: access denied"?

What you are seeing looks very much like this known Java 1.7 RMI issue but I would like to confirm this.

Can I also ask:
- Is the HTTP server running on the same machine as the Protege server?
- Can you confirm that the RMIRegistry is running

Thanks

Jonathan
Essential Project Team
henseggs
Posts: 9
Joined: 10 Jun 2014, 11:29

Thank you Jonathan,

1. No there are no "access to class loader denied" messages at all.

2. Yes the http server is on the same system, that is why I was using local host as opposed to the fqdn or ip address.

3. Yes the Rmi registery is running. I can see the service listening on port 1099 using the netstat utility and I see the following in the protege log file. "BST CONFIG: Server port = 0, registry port = 1099, compressed stream -- RmiSocketFactory.reportPorts()"

Thank you,
Charlie
User avatar
jonathan.carter
Posts: 1087
Joined: 04 Feb 2009, 15:44

Hi Charlie,

I found this on an Oracle Community forum, which may resolve the issue - certainly worth a try.

It concerns how we start the RMIRegistry. Try updating the line in the run_protege_server.sh that starts the RMIRegistry to add the following options:

Code: Select all

rmiregistry -J-Djava.rmi.server.useCodebaseOnly=false
Apparently, in recent versions of Java the default value of java.rmi.server.useCodebaseOnly was changed to true and others have found that setting this to false has resolved the ClassNotFound Exception

Jonathan
Essential Project Team
User avatar
jonathan.carter
Posts: 1087
Joined: 04 Feb 2009, 15:44

Another quick question:

Did you download Protege for Linux with the bundled JVM or without? It's worth confirming that your RMIRegistry is running using the same JVM as the Protege server (it should be from the run_protege_server script but worth checking)

A broader coverage of Client-Server troubleshooting (beyond this Java 1.7 issue - which is down to Protege 3.5 being compiled with Java 6...) is available in this article on the Protege wiki.

Jonathan
Essential Project Team
henseggs
Posts: 9
Joined: 10 Jun 2014, 11:29

I've made the change to the way rmiregistry is started to:

Code: Select all

$JAVA_PATH/rmiregistry -J-Djava.rmi.server.useCodebaseOnly=false $RMI_REG_PORT &
I can see the rmi service start without errors, I can see rmi listening in on port 1099 and I can telnet to rmi on port 1099.

Yes we are using the same jvm

I downloaded and used the Protege without a bundled JVM.

Looking at the "Server port = 0, registry port = 1099, compressed stream" line from the output below, I think (could you confirm?) that Protege is communicating with rmi is it not ?

Latest output from run_protege_server script:

Code: Select all

./run_protege_server.sh
Protege server is starting...
Protege 3.5 Build 663, JVM 1.7.0_55-mockbuild_2014_04_16_12_11-b00, memory=506M, Linux, encoding=UTF-8, language=en, country=US
Server port = 0, registry port = 1099, compressed stream
Using metaproject from: file:/opt/Protege_3.5/essential-server/metaproject.pprj
Server.getAvailableProjectNames()
Loading project Essential AM Repository from file:/EssentialAM/Repository/essential_metamodel/essential_baseline_v4.3.1.pprj
Loaded 5000 instances: essential_baseline_v1.2_ProjectKB_Class1851
Loaded 6000 instances: essential_baseline_v1.2_ProjectKB_Class19560
Loaded 7000 instances: essential_baseline_v3.0.4_ProjectKB_Class15367
Loaded 8000 instances: essential_baseline_v1_ProjectKB_Instance_21327
....  <A load of stuff loaded here >
Loaded 85000 instances: viewer3_devrep_14032012_003_ProjectKB_Class11984
Loading project plugins for project Essential AM Repository
WARNING: Could not find the ChAO KB. -- ChangesProject.initialize()
SEVERE: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
        java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
        java.lang.ClassNotFoundException: edu.stanford.smi.protege.server.Server_Stub
        at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:419)
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:267)
        at sun.rmi.transport.Transport$1.run(Transport.java:177)
        at sun.rmi.transport.Transport$1.run(Transport.java:174)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)
        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:744)
        at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:275)
        at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:252)
        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:378)
        at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
        at edu.stanford.smi.protege.server.Server.bindName(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.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
        java.lang.ClassNotFoundException: edu.stanford.smi.protege.server.Server_Stub
        at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
Thank you,
Charlie
User avatar
jonathan.carter
Posts: 1087
Joined: 04 Feb 2009, 15:44

What we're seeing on this trace is Protege loading the metaproject (which tells the server which projects to serve) successfully. Those bits of trace are likely to be information about which ports Protege is going to use, rather than an indication of success.

The key statement to look for in the logs / console messages from the server is that the server is ready and waiting for connections. This confirms that it has started up successfully.

I notice in your start RMIRegistry line that there's a $RMI_REG_PORT variable. I don't have this in my Protege 3.5 run_protege_server.sh. Is this something that you've added?

By default Protege will look for the RMIRegistry on port 1099 but you can configure this. In run_protege_server.sh, the commented out PORTOPTS variable defines these and tells Protege which ports to use. This is required where clients will connect to Protege Server through a firewall as we have to tell the RMI environment to use specific ports (it normally allocates a range of ports)

Jonathan
Essential Project Team
henseggs
Posts: 9
Joined: 10 Jun 2014, 11:29

Got this working now.
The problem was a combination of the CODEBASE_URL needing to use http class as well as specifying a server port for rmi.

See my full startup script.

Code: Select all

#!/bin/sh

# ------------------- Where is Java? -------------------

# Change to the script' working directory, should be the Protege root directory
cd $(dirname $0)

DARWIN="false"

if [  -x /usr/bin/uname ]
then
  if [ "x`/usr/bin/uname`" = "xDarwin" ]
  then
    DARWIN="true"
  fi
fi

if [ ${DARWIN} = "true" ]
then
  JAVA_PATH=/usr/bin
else
  # Attempt to use the bundled VM if none specified
  if [ "$JAVA_HOME" = "" ]; then
        JAVA_HOME=.
  fi

  JAVA_PATH=$JAVA_HOME/jre/bin
fi

# Check if the Java VM can be found
if [ ! -e $JAVA_PATH/java ]; then
        echo Java VM could not be found. Please check your JAVA_HOME environment variable.
        exit 1
fi
# ------------------- Where is Java? -------------------


CLASSPATH=protege.jar:looks.jar:driver.jar:driver0.jar:driver1.jar:driver2.jar
MAINCLASS=edu.stanford.smi.protege.server.Server


# ------------------- JVM Options -------------------
MAX_MEMORY=-Xmx500M
HEADLESS=-Djava.awt.headless=true
#CODEBASE_URL=file:$PWD/protege.jar
CODEBASE_URL=http://localhost:8080/essential_viewer/protege.jar

curl -o /tmp/protege.jar $CODEBASE_URL
echo "Return Code " $?
echo $CODEBASE_URL
sleep 2



CODEBASE=-Djava.rmi.server.codebase=$CODEBASE_URL
#HOSTNAME_PARAM=-Djava.rmi.server.hostname=`hostname`
HOSTNAME_PARAM=-Djava.rmi.server.hostname=10.228.112.80
RMI_REG_PORT=1099
RMI_SERV_PORT=5200
TX="-Dtransaction.level=READ_COMMITTED"
LOG4J_OPT="-Dlog4j.configuration=file:log4j.xml"

OPTIONS="$MAX_MEMORY $HEADLESS $CODEBASE $HOSTNAME_PARAM ${TX} ${LOG4J_OPT}"

#
# Instrumentation debug, delay simulation,  etc
#
#PORTOPTS="-Dprotege.rmi.server.port=5200 -Dprotege.rmi.registry.port=5100"
PORTOPTS="-Dprotege.rmi.server.port=${RMI_SERV_PORT} -Dprotege.rmi.registry.port=${RMI_REG_PORT}"
#DEBUG_OPT="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"

OPTIONS="${OPTIONS} ${PORTOPTS} ${DEBUG_OPT}"
# ------------------- JVM Options -------------------

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

#METAPROJECT=examples/server/metaproject.pprj
METAPROJECT=essential-server/metaproject.pprj

$JAVA_PATH/rmiregistry -J-Djava.rmi.server.useCodebaseOnly=false ${RMI_REG_PORT} &
$JAVA_PATH/java -cp $CLASSPATH $TX $OPTIONS $MAINCLASS $SAVE_INTERVAL $METAPROJECT
User avatar
jonathan.carter
Posts: 1087
Joined: 04 Feb 2009, 15:44

Great work!

Really appreciate your efforts and posting back the resolution.

Keep us posted with your progress

Jonathan
Essential Project Team
Post Reply