首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

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

2013-09-11 
实在是连不上数据库了,求救。今天新下载了mysql-5.1.19还下了一个mysql-connector-java-5.1.0(都是mysql.co

实在是连不上数据库了,求救。
今天新下载了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>


------解决方案--------------------


从java.lang.Class.forName0(Native Method),java.lang.Class.forName(Unknown Source)
看貌似是没有找到驱动程序,确认一下你的mysql驱动程序是否放置在WEB-INF/lib 文件夹下

[解决办法]
我用的mysql-5.0.15-win32.zip mysql-connector-java-3.1.13-bin.jar这两个东东.你GOOGLE一下.
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html

热点排行