Tomcat Classpath problem...
843836Feb 16 2004 — edited Feb 16 2004I know that this is a hoary old chestnut, but after four days battling with it, I hope somebody will help me.
I have searched tomcat documentation, jakarta, sun java forums and I have read TFM and cannot solve my simple problem.
I am trying to convert a Jrun application to run in Tomcat, and what do you do in these cases?
Answer: you stick your first application in the ROOT application which they have kindly prepared for you and off you go, or so you hope.
But all I kept getting was one of those very unhelpful JasperExceptions, with a root cause a ServletException that gives you no clue as to what has gone wrong.
Example:
root cause
javax.servlet.ServletException: com/villeinitalia/dbInsertion/FieldHolder
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:536)
The FieldHolder class lies inside a method in a class in the CATALINA_HOME/shared classes folder. My application doesn't call this method, and I wouldn't have thought that Tomcat should be worrying about it, there are compilers for this, but anyway better safe than sorry, I suppose.
Well I now am sure that I have some kind of classpath problem (couldn't Tomcat say so to save me time??). But it is a pretty weird classpath problem.
The FieldHolder class lies in the /ROOT/WEB-INF/classes directory so the application should automatically find it - shouldn't it? If I add the /ROOT/WEB-INF/classes directory to the classpath inside setclasspath.sh it finds it ok, but obviously I don't want to jumble all my application classpaths together there, I want Tomcat to find stuff itself in the WEB-INF/classes directory as it should. But anyway after adding the ROOT/WEB-INF/classes directory to the machine environment I got the weirdest root cause:
javax.servlet.ServletException: javax.servlet.ServletRequest
Er, excuse me Mr. Tomcat, but here a javax.servlet class is telling me it can't find something in the same package...
catalina.sh echoes out the following information - rt.jar isn't in the classpath, but then if that was a problem tomcat wouldn't work at all.
Using CATALINA_BASE: /var/jakarta-tomcat-4.1.24
Using CATALINA_HOME: /var/jakarta-tomcat-4.1.24
Using CATALINA_TMPDIR: /var/jakarta-tomcat-4.1.24/temp
Using JAVA_HOME: /var/java
Using CLASSPATH: /var/java/lib/tools.jar:/var/java/jre/lib/FmproProxy.zip:/var/java/jre/lib/fmpjdbc12.jar:/var/jakarta-tomcat-4.1.24/bin/bootstrap.jar
(the two middle jars are Filemaker jdbc drivers my applications need).
Can anybody help?