Discussion:
scala/Serializable NoClassDefFoundError (RMI w/ Scala)
adelbertc
2012-10-03 06:39:58 UTC
Permalink
Also cross posted to StackOverflow if you'd like to answer it
there: http://stackoverflow.com/questions/12703061/scala-serializable-noclassdeffounderror-rmi-w-scala

Been following this tutorial<http://docs.oracle.com/javase/tutorial/rmi/index.html> on
RMI for Java, trying to translate it to Scala. Instead of interface I use
trait, and I annotate methods to indicate the throwing of the
RemoteException.

Got everything implemented, and got to the compilation step<http://docs.oracle.com/javase/tutorial/rmi/compiling.html> and
followed it exactly, except instead ofjavac I used scalac.

Finally at the exciting last step<http://docs.oracle.com/javase/tutorial/rmi/running.html>,
running it, and I setup the security policies, start the rmiregistry, go to
startup my server and get hit with this:

java.rmi.ServerError: Error occurred in server thread; nested exception is:
java.lang.NoClassDefFoundError: scala/Serializable

What could be causing this? I changed their command from java to scala, but
everything else is the same (modulo the usernames and file paths).. how is
it not finding scala/Serializable?

Potentially relevant:

$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.4) (rhel-1.49.1.11.4.el6_3-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

$ scala -version
Scala code runner version 2.9.2 -- Copyright 2002-2011, LAMP/EPFL


Thanks!
Josh Suereth
2012-10-03 07:06:15 UTC
Permalink
You may want to use java command line and put scala on the regular class
path rather than the boot class path as the scala script does.

Basically, it should be able to find the class file if the class paths are
correct.
Post by adelbertc
http://stackoverflow.com/questions/12703061/scala-serializable-noclassdeffounderror-rmi-w-scala
Been following this tutorial<http://docs.oracle.com/javase/tutorial/rmi/index.html> on
RMI for Java, trying to translate it to Scala. Instead of interface I use
trait, and I annotate methods to indicate the throwing of the
RemoteException.
Got everything implemented, and got to the compilation step<http://docs.oracle.com/javase/tutorial/rmi/compiling.html> and
followed it exactly, except instead ofjavac I used scalac.
Finally at the exciting last step<http://docs.oracle.com/javase/tutorial/rmi/running.html>,
running it, and I setup the security policies, start the rmiregistry, go
java.lang.NoClassDefFoundError: scala/Serializable
What could be causing this? I changed their command from java to scala,
but everything else is the same (modulo the usernames and file paths).. how
is it not finding scala/Serializable?
$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.4) (rhel-1.49.1.11.4.el6_3-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
$ scala -version
Scala code runner version 2.9.2 -- Copyright 2002-2011, LAMP/EPFL
Thanks!
adelbertc
2012-10-03 07:28:24 UTC
Permalink
So the Java call stated on the website is this:

java -cp /home/ann/src:/home/ann/public_html/classes/compute.jar
-Djava.rmi.server.codebase=http://mycomputer/~ann/classes/compute.jar
-Djava.rmi.server.hostname=mycomputer.example.com
-Djava.security.policy=server.policy
engine.ComputeEngine


Should I simply change it to something like:


java -cp /home/ann/src:/home/ann/public_html/classes/compute.jar
-Djava.rmi.server.codebase=http://mycomputer/~ann/classes/compute.jar
-Djava.rmi.server.hostname=mycomputer.example.com
-Djava.security.policy=server.policy

$SCALA_HOME/lib/scala-library.jar
engine.ComputeEngine


? Modulo the folder names, etc.


I got the error pasted here: http://pastie.org/private/u5qisrkdjcf55pnql6yog
Post by Josh Suereth
You may want to use java command line and put scala on the regular class
path rather than the boot class path as the scala script does.
Basically, it should be able to find the class file if the class paths are
correct.
Post by adelbertc
http://stackoverflow.com/questions/12703061/scala-serializable-noclassdeffounderror-rmi-w-scala
Been following this tutorial<http://docs.oracle.com/javase/tutorial/rmi/index.html> on
RMI for Java, trying to translate it to Scala. Instead of interface I use
trait, and I annotate methods to indicate the throwing of the
RemoteException.
Got everything implemented, and got to the compilation step<http://docs.oracle.com/javase/tutorial/rmi/compiling.html> and
followed it exactly, except instead ofjavac I used scalac.
Finally at the exciting last step<http://docs.oracle.com/javase/tutorial/rmi/running.html>,
running it, and I setup the security policies, start the rmiregistry, go
java.lang.NoClassDefFoundError: scala/Serializable
What could be causing this? I changed their command from java to scala,
but everything else is the same (modulo the usernames and file paths).. how
is it not finding scala/Serializable?
$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.4) (rhel-1.49.1.11.4.el6_3-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
$ scala -version
Scala code runner version 2.9.2 -- Copyright 2002-2011, LAMP/EPFL
Thanks!
adelbertc
2012-10-03 07:31:35 UTC
Permalink
Scratch that above, I made an error, let me try again...
Post by adelbertc
java -cp /home/ann/src:/home/ann/public_html/classes/compute.jar
-Djava.rmi.server.codebase=http://mycomputer/~ann/classes/compute.jar
-Djava.rmi.server.hostname=mycomputer.example.com
-Djava.security.policy=server.policy
engine.ComputeEngine
java -cp /home/ann/src:/home/ann/public_html/classes/compute.jar
-Djava.rmi.server.codebase=http://mycomputer/~ann/classes/compute.jar
-Djava.rmi.server.hostname=mycomputer.example.com
-Djava.security.policy=server.policy
$SCALA_HOME/lib/scala-library.jar
engine.ComputeEngine
? Modulo the folder names, etc.
I got the error pasted here: http://pastie.org/private/u5qisrkdjcf55pnql6yog
Post by Josh Suereth
You may want to use java command line and put scala on the regular class
path rather than the boot class path as the scala script does.
Basically, it should be able to find the class file if the class paths
are correct.
Post by adelbertc
http://stackoverflow.com/questions/12703061/scala-serializable-noclassdeffounderror-rmi-w-scala
Been following this tutorial<http://docs.oracle.com/javase/tutorial/rmi/index.html> on
RMI for Java, trying to translate it to Scala. Instead of interface I
usetrait, and I annotate methods to indicate the throwing of the
RemoteException.
Got everything implemented, and got to the compilation step<http://docs.oracle.com/javase/tutorial/rmi/compiling.html> and
followed it exactly, except instead ofjavac I used scalac.
Finally at the exciting last step<http://docs.oracle.com/javase/tutorial/rmi/running.html>,
running it, and I setup the security policies, start the rmiregistry,
java.lang.NoClassDefFoundError: scala/Serializable
What could be causing this? I changed their command from java to scala,
but everything else is the same (modulo the usernames and file paths).. how
is it not finding scala/Serializable?
$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.4) (rhel-1.49.1.11.4.el6_3-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
$ scala -version
Scala code runner version 2.9.2 -- Copyright 2002-2011, LAMP/EPFL
Thanks!
adelbertc
2012-10-03 07:34:22 UTC
Permalink
Ran this:

java -cp
"./:~/public_html/src/server/classes/compute.jar:/cs/mutant/adelbert_chang/scala-2.9.2/lib/scala-library.jar"
-Djava.rmi.server.codebase=http://cs.ucsb.edu/~adelbert_chang/src/server/classes/compute.jar
-Djava.rmi.server.hostname=blackbird.cs.ucsb.edu
-Djava.security.policy=server.policy system.ComputerImpl

Still same error, can't find the Serializable class.

Loading...