JSP连接数据库,报Unable to compile class for JSP

先看一下报错原因:

HTTP Status 500 - Unable to compile class for JSP:

type Exception report

message Unable to compile class for JSP:

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: [16] in the generated java file: [F:\apache-tomcat-7.0.70\work\Catalina\localhost\LibrarySystem\org\apache\jsp\frameOne_jsp.java]
Only a type can be imported. com.mysql.jdbc.Driver resolves to a package Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:490)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:379)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:341)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:662)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:364)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731) note The full stack trace of the root cause is available in the Apache Tomcat/7.0.70 logs.
Apache Tomcat/7.0.70

然后我的解决办法是:因为我使用的MyEclipse编译器是32位,里面自带的是32位的JDK1.6版本,而我的电脑是64位的WIN10系统,安装的是64位的Tomcat7.0,结果在Tomcat中部署时,出现了上面的错误。随后,我下载安装配置了一个32位的Tomcat7.0,结果问题顺利解决~

(PS:当时我是参照这一篇博客而解决了问题,具体链接地址如下:http://blog.csdn.net/zwk626542417/article/details/38421839)

上一篇:as3 代码优化之pmd


下一篇:Web.config中设置启用webservice远程调试訪问