views:

486

answers:

1

I'm trying to build a basic servlet with scala, but I can't seem to figure out how to get it running under tomcat. I think my scala class is okay, and I included all the libs in scala-2.6.x-final-blah.tgz to my tomcat lib directory, but I still get the odd, generic error below.

Can anyone tell me what's going on?

javax.servlet.ServletException: Error allocating a servlet instance
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    java.lang.Thread.run(Thread.java:636)


root cause 
java.lang.NoClassDefFoundError: scala/ScalaObject
+3  A: 

Some sleuthing revealed that the real tomcat lib directory was in /usr/share, not /var/lib. I added the library to /usr/share and symlinked it to /var/lib, and now everything works! Also, the only scala library required to run under tomcat is scala-library.jar, the scala runtime.

Stefan Kendall