English 中文(简体)
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(HttpServlet.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?





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签