JSP exception - class not found (tomcat)
I'm setting up an existing application on a new Tomcat 5.5 server connecting to a Postgres database (running on Debian Lenny). When I access it I get a series of stack traces with the following root cause:
java.lang.ClassNotFoundException: java.sql.SQLClientInfoException
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1363)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1209)
java.lang.Class.forName(libgcj.so.90)
java.lang.Class.initializeClass(libgcj.so.90)
java.lang.Class.initializeClass(libgcj.so.90)
org.postgresql.Driver.makeConnection(Driver.java:382)
org.postgresql.Driver.connect(Driver.java:260)
java.sql.DriverManager.getConnection(libgcj.so.90)
jof.DBConnection.getConnection(DBConnection.java:81)
jof.BeanInterfaceBase.db(BeanInterfaceBase.java:263)
jof.BeanInterfaceBase.getStatement(BeanInterfaceBase.java:613)
jof.HelpInterface.findByNaturalId(HelpInterface.java:81)
jof.HelpInterface.findByNaturalId(HelpInterface.java:128)
org.apache.jsp.index_jsp.getHelp(index_jsp.java:162)
org.apache.jsp.index_jsp._jspService(index_jsp.java:369)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(Htt开发者_运维技巧pServlet.java:802)
java.lang.reflect.Method.invoke(libgcj.so.90)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
java.security.AccessController.doPrivileged(libgcj.so.90)
javax.security.auth.Subject.doAsPrivileged(libgcj.so.90)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
What's missing?
java.lang.ClassNotFoundException: java.sql.SQLClientInfoException
What's missing?
To be precise: the mentioned class is missing in the runtime classpath. It must be in the runtime classpath as a standalone class file (*.class
) or packaged in a JAR file (*.jar
). Alternatively you can also add its actual path to the runtime classpath.
By default the webapp's Webapp/WEB-INF/lib
and Webapp/WEB-INF/classes
folders are covered by the runtime classpath, as is appserver's Appserver/lib
folder and the Java's JRE/lib
.
Any 3rd party webapp-specific JAR files ought to be placed in Webapp/WEB-INF/lib
. Any webapp-specific classes (servlets, etc..) ought to be placed in Webapp/WEB-INF/classes
. Any appserver-specific (or webapp-common) JAR files ought to be placed in Appserver/lib
. The Java's JRE/lib
folder must be left untouched.
Hope this helps.
Edit: the actual problem is worse: this is indeed a Java 6 only class. Tomcat is apparently running on a Java 5. Review your JAVA_HOME
environment variable. It must at least point to root installation folder of Java 6 JRE.
This is a guess, but I see that java.sql.SQLClientInfoException is a class that was introduced in Java6. What version of Java is being used to launch your Tomcat server? Maybe you are developing under Java6 but then deploying to a Tomcat running Java5?
精彩评论