I'm trying to run scala applications under tomcat, and whenever I use standard java stuff, I seem okay. However, when I do things like string concatenation or sequence generation, I get weird errors for NoClassDefFound...
My first thoughts are that I'm not putting the required scala-library jar in the correct directories, or I need to do some additional configuration to make my servlet aware of the external dependency. I've tried putting scala-library.jar in both the tomcat6 "lib" directory and under ROOT/WEB-INF/lib, but neither seem to allow my servlets to use classes in the jar. What's going on?
Check your CLASSPATH environment variable contains the path to your scala-library.jar file, before you start tomcat.
If you put the scala-library.jar into the JRE/lib/ext directory, that should work. This of course, is the JRE that is running Tomcat. This places scala in the "default classloader" instead of within Tomcats classloader... and in theory, should solve your issue. In effect, this is the same as Tom O'Connors answer except I am telling you why you got the class not found error: because of the custom classloader.