大家好,小弟初学JSP,在连接数据库的时候遇到了一个奇怪的问题,希望大家能帮我解决一下,在这儿,先谢过大家了:
我用的一些工具的版本如下:
Tomcat 5.0.28
MySQL 5.0.27
MySQL 的驱动 mysql-connector-java-5.0.4
这是我环境变量的配置:
Classpath=
D:\Program Files\Java\mysqljdbc\mysql-connector-java-5.0.4-bin.jar;
%JAVA_HOME%\lib\mysql-connector-java-5.0.4-bin-g.jar;.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar;E:\ServletAndJSPDev;
另外我把Mysql的 驱动程序版本是:mysql-connector-java-5.0.4
安装到了%JAVA_HOME%\lib\mysql-connector-java-5.0.4-bin-g.jar;
和 D:\Program Files\Java\mysqljdbc\mysql-connector-java-5.0.4-bin.jar;
还有我把 驱动程序的两个 .jar 文件拷贝到了 tomcat 安装目录的commmon\lib\
这样之后我启动 Tomcat
在我的test.jsp 中只有这样的几行代码:
<%@ page language= "java " contentType= "text/html; charset=utf-8 "%>
<%@ page info= "database handler " %>
<%@ page import= "java.io.* " %>
<%@ page import= "java.sql.* " %>
<%@ page import= "javax.servlet.* " %>
<%@ page import= "javax.servlet.http.* " %>
<%
Class.forName( "org.gjt.mm.mysql.Driver ").newInstance();
%>
可是在运行的时候却报告这么一个错误:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: org/aspectj/lang/Signature
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.dd_jsp._jspService(dd_jsp.java:64)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NoClassDefFoundError: org/aspectj/lang/Signature
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:164)
org.apache.jsp.dd_jsp._jspService(dd_jsp.java:57)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.