当前位置: 代码迷 >> Java Web开发 >> 高难度,拜师,该怎么处理
  详细解决方案

高难度,拜师,该怎么处理

热度:203   发布时间:2016-04-17 13:38:07.0
高难度,拜师
org.apache.jasper.JasperException:   Exception   in   JSP:   /sql_test.jsp:4

1:   <%@   page   import= "java.lang.*,   java.io.*,   java.sql.*,   java.util.* "   contentType= "text/html;charset=gb2312 "   %>
2:   <html>
3:   <body>
4:   <%   Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver ").newInstance();
5:   String   url= "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=pubs ";
6:   //pubs   为你的数据库的
7:   String   user= "sa ";


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:506)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root   cause  

javax.servlet.ServletException:   com.microsoft.jdbc.sqlserver.SQLServerDriver
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:843)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:776)
org.apache.jsp.sql_005ftest_jsp._jspService(sql_005ftest_jsp.java:84)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root   cause  

java.lang.ClassNotFoundException:   com.microsoft.jdbc.sqlserver.SQLServerDriver
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1355)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1201)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:127)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:65)
java.lang.ClassLoader.loadClassInternal(Unknown   Source)
java.lang.Class.forName0(Native   Method)
java.lang.Class.forName(Unknown   Source)
org.apache.jsp.sql_005ftest_jsp._jspService(sql_005ftest_jsp.java:49)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


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



------解决方案--------------------
java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
是你的jdbc驱动没有吧,起码你得把你得驱动包放到你得classpath里面
------解决方案--------------------
典型的驱动没有装阿,是用tomcat的吗,是的话把sql驱动放到tomcat的文件夹下去
------解决方案--------------------
好象是个jar包
放在tomcat的Tomcat\common\lib下
  相关解决方案