Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Check your CLASSPATH environment variable contains the path to your scala-library.jar file, before you start tomcat.

share|improve this answer
    
Really? I thought just putting it in the lib directory was enough. If this works, you're the champion of the trilogy overflow sites. –  Stefan Kendall Sep 28 '09 at 20:18

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.