运行jsp文件时出现这种错误。我使用MySQL连接器连接。
HTTP状态500 - javax.servlet.ServletException:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:未知数据库' / test' 类型异常报告
message javax.servlet.ServletException:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:未知数据库' / test'
说明服务器遇到内部错误,导致无法完成此请求。
例外
org.apache.jasper.JasperException:javax.servlet.ServletException:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:未知数据库' / test' org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:555) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:461) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 根本原因
javax.servlet.ServletException:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:未知数据库' / test' org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:908) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:837) org.apache.jsp.reg1_jsp._jspService(reg1_jsp.java:126) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 根本原因
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:未知数据库' / test' sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法) sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) java.lang.reflect.Constructor.newInstance(Unknown Source) com.mysql.jdbc.Util.handleNewInstance(Util.java:400) com.mysql.jdbc.Util.getInstance(Util.java:383) com.mysql.jdbc.SQLError.createSQLException(SQLError.java:980) com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3847) com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3783) com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:871) com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4292) com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1259) com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2249) com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2280) com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2079) com.mysql.jdbc.ConnectionImpl。(ConnectionImpl.java:794) com.mysql.jdbc.JDBC4Connection。(JDBC4Connection.java:44) sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法) sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) java.lang.reflect.Constructor.newInstance(Unknown Source) com.mysql.jdbc.Util.handleNewInstance(Util.java:400) com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399) com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325) java.sql.DriverManager.getConnection(未知来源) java.sql.DriverManager.getConnection(未知来源) org.apache.jsp.reg1_jsp._jspService(reg1_jsp.java:107) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) note备注根本原因的完整堆栈跟踪在Apache Tomcat / 8.0.23日志中可用。
Apache Tomcat / 8.0.23
答案 0 :(得分:0)
检查您的mysql服务器是否存在数据库名称“ test ”。
如果没有创建然后测试。