weixin_44949209
难过怪
2020-09-16 22:02

HTTP状态 500 - 内部服务器错误

  • tomcat
  • jar
  • intellij-idea
  • java-ee

求教,要怎么链接数据库啊?gao'bu'ming'bai

类型 异常报告

消息 在 [32] 行处理 [/index.jsp] 时发生异常

描述 服务器遇到一个意外的情况,阻止它完成请求。

例外情况

org.apache.jasper.JasperException: 在 [32] 行处理 [/index.jsp] 时发生异常

29: %>
30: <%
31:
32: Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
33: Connection conn = DriverManager.getConnection("jdbc:sqlserver://127.0.0.1:1433;databaseName=LinkTest;integratedSecurity=true");
34: Statement stat = conn.createStatement();
35: String sql = "SELECT Tname FROM Teachers WHERE Tno <> 0";

Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:626)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:500)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
根本原因。

javax.servlet.ServletException: java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:666)
org.apache.jsp.index_jsp._jspService(index_jsp.java:237)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:71)
javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:477)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
根本原因。

java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1365)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1188)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:122)
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:59)
java.base/java.lang.Class.forName0(Native Method)
java.base/java.lang.Class.forName(Class.java:332)
org.apache.jsp.index_jsp._jspService(index_jsp.java:155)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:71)
javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:477)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
):注意 主要问题的全部 stack 信息可以在 server logs 里查看

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答