post请求发生错误500错误

来源:2-1 环境搭建

慕姐8417444

2018-06-04 19:33

https://img1.mukewang.com/5b1522850001ae1917921326.jpg

1. http://localhost:8080/Imooc/访问正常

https://img.mukewang.com/5b15230f0001e4c317920302.jpg


2. mysql服务已启,除了配置文件的数据库root密码和老师的不一样其他都是一样的。

3. 为什么请求的时候会报500的错误?


写回答 关注

2回答

  • 莫名路过
    2018-08-30 14:22:56

    不如去百度一下500错误的意思,代码出错了

  • 慕姐8417444
    2018-06-04 19:36:09

    Mon Jun 04 19:35:38 CST 2018

    HTTP/1.1 500 Internal Server Error

    <html><head><title>Apache Tomcat/7.0.88 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - org.hibernate.exception.GenericJDBCException: Cannot open connection</h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u>org.hibernate.exception.GenericJDBCException: Cannot open connection</u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection

    org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614)

    org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:202)

    com.imooc.DAO.StudentDAO.findStudent(StudentDAO.java:27)

    com.imooc.DAO.StudentDAO.find(StudentDAO.java:69)

    com.imooc.service.StudentService.doPost(StudentService.java:69)

    javax.servlet.http.HttpServlet.service(HttpServlet.java:650)

    javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

    </pre></p><p><b>root cause</b> <pre>org.hibernate.exception.GenericJDBCException: Cannot open connection

    org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)

    org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)

    org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)

    org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)

    org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426)

    org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)

    org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)

    org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)

    org.hibernate.loader.Loader.doQuery(Loader.java:673)

    org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)

    org.hibernate.loader.Loader.loadEntity(Loader.java:1860)

    org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)

    org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)

    org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3049)

    org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:399)

    org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:375)

    org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:139)

    org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:195)

    org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103)

    org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)

    org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)

    org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)

    org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:182)

    com.imooc.DAO.StudentDAO.findStudent(StudentDAO.java:27)

    com.imooc.DAO.StudentDAO.find(StudentDAO.java:69)

    com.imooc.service.StudentService.doPost(StudentService.java:69)

    javax.servlet.http.HttpServlet.service(HttpServlet.java:650)

    javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

    </pre></p><p><b>root cause</b> <pre>java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)

    com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)

    com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597)

    com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529)

    com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:935)

    com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4101)

    com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1300)

    com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2337)

    com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2370)

    com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2154)

    com.mysql.jdbc.ConnectionImpl.&lt;init&gt;(ConnectionImpl.java:792)

    com.mysql.jdbc.JDBC4Connection.&lt;init&gt;(JDBC4Connection.java:47)

    sun.reflect.GeneratedConstructorAccessor10.newInstance(Unknown Source)

    sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

    java.lang.reflect.Constructor.newInstance(Constructor.java:423)

    com.mysql.jdbc.Util.handleNewInstance(Util.java:411)

    com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381)

    com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)

    java.sql.DriverManager.getConnection(DriverManager.java:664)

    java.sql.DriverManager.getConnection(DriverManager.java:208)

    org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)

    org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)

    org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)

    org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)

    org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)

    org.hibernate.loader.Loader.doQuery(Loader.java:673)

    org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)

    org.hibernate.loader.Loader.loadEntity(Loader.java:1860)

    org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)

    org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)

    org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3049)

    org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:399)

    org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:375)

    org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:139)

    org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:195)

    org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:103)

    org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)

    org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)

    org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)

    org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:182)

    com.imooc.DAO.StudentDAO.findStudent(StudentDAO.java:27)

    com.imooc.DAO.StudentDAO.find(StudentDAO.java:69)

    com.imooc.service.StudentService.doPost(StudentService.java:69)

    javax.servlet.http.HttpServlet.service(HttpServlet.java:650)

    javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

    </pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/7.0.88 logs.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.88</h3></body></html>



使用java构建和维护接口自动化测试框架

初识接口自动化框架

25748 学习 · 36 问题

查看课程

相似问题