当前位置: 代码迷 >> Java Web开发 >> 实在是连不上数据库了,求救。解决办法
  详细解决方案

实在是连不上数据库了,求救。解决办法

热度:99   发布时间:2016-04-17 14:02:10.0
实在是连不上数据库了,求救。
今天新下载了mysql-5.1.19还下了一个mysql-connector-java-5.1.0(都是mysql.com最新提供的),但是最简单的连库操作都不行了,鼓捣一晚上了,请大家出出主意吧,是哪里的问题呢?报错信息如下:
description   The   server   encountered   an   internal   error   ()   that   prevented   it   from   fulfilling   this   request.

exception  

org.apache.jasper.JasperException:   org/aspectj/lang/Signature
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:476)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:371)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root   cause  

javax.servlet.ServletException:   org/aspectj/lang/Signature
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
org.apache.jsp.web.sqldemo_jsp._jspService(sqldemo_jsp.java:79)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root   cause  

java.lang.NoClassDefFoundError:   org/aspectj/lang/Signature
java.lang.Class.forName0(Native   Method)
java.lang.Class.forName(Unknown   Source)
org.apache.jsp.web.sqldemo_jsp._jspService(sqldemo_jsp.java:62)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


note   The   full   stack   trace   of   the   root   cause   is   available   in   the   Apache   Tomcat/5.5.23   logs.

程序清单:
<%@page   contentType= "text/html;   charset=gb2312 "%>
<%@page   language= "java "%>
<%@page   import= "com.mysql.jdbc.Driver.* "%>
<%@page   import= "java.sql.* "%>
<html>
<head>
<title> sqldemo </title>
</head>
<%!Connection   con;%>
<%!Statement   stmt;%>
<%!ResultSet   rs;%>
<body   bgcolor= "#ffffff ">
<%
    Class.forName( "com.mysql.jdbc.Driver ");
    con   =   DriverManager.getConnection( "jdbc:mysql://127.0.0.1:3306/demo?user=root&password=123 ");
    String   sql   =   "select   *   from   flower ";
    stmt   =   con.createStatement();
    rs   =   stmt.executeQuery(sql);
    rs.next();
    int   id   =   rs.getInt(1);
    out.print( " "   +   id);
%>
</body>
</html>


------解决方案--------------------
  相关解决方案