请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

测试报错

启动服务器没有报错,在http://localhost:8080/下也访问到了index.jsp的内容。测试的时候就报这个500的服务器错误

图片描述
图片描述

这些是body里面返回的信息
BODY
pretty

Apache Tomcat/7.0.75 - Error report

HTTP Status 500 - Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException:


type Exception report

message Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException:

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: 
### Error querying database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: FUNCTION mmall_learning.count does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
### The error may exist in file [D:\360\workspace2\maven_web\target\mmall\WEB-INF\classes\mappers\UserMapper.xml]
### The error may involve com.mmall.dao.UserMapper.checkUsername-Inline
### The error occurred while setting parameters
### SQL: select count (1) from mmall_user     where username=?
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: FUNCTION mmall_learning.count does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: FUNCTION mmall_learning.count does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:943)
	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:833)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:807)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)

root cause

org.springframework.jdbc.BadSqlGrammarException: 
### Error querying database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: FUNCTION mmall_learning.count does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
### The error may exist in file [D:\360\workspace2\maven_web\target\mmall\WEB-INF\classes\mappers\UserMapper.xml]
### The error may involve com.mmall.dao.UserMapper.checkUsername-Inline
### The error occurred while setting parameters
### SQL: select count (1) from mmall_user     where username=?
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: FUNCTION mmall_learning.count does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: FUNCTION mmall_learning.count does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
	org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:95)
	org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
	org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
	org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75)
	org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:447)
	com.sun.proxy.$Proxy18.selectOne(Unknown Source)
	org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:167)
	org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:82)
	org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53)
	com.sun.proxy.$Proxy19.checkUsername(Unknown Source)
	com.mmall.service.impl.UserServiceImpl.login(UserServiceImpl.java:32)
	com.mmall.controller.portal.UserController.login(UserController.java:39)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	java.lang.reflect.Method.invoke(Method.java:606)
	org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:214)
	org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
	org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:748)
	org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689)
	org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
	org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945)
	org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876)
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:931)
	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:833)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:807)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)

正在回答

2回答

到UserMapper.xml下,找到<select id="checkUserName" 标签里面的sql语句,把下面图我选中的空格删掉

https://img1.sycdn.imooc.com//szimg/5cfd9e020001ae0707630204.jpg

0 回复 有任何疑惑可以回复我~
  • 提问者 肥羊Fly #1
    非常感谢!
    回复 有任何疑惑可以回复我~ 2019-06-10 09:46:39
  • 提问者 肥羊Fly #2
    还有就是想问一下,前面用mybatis的插件生成实体类和xml文件的时候都可以连接到数据库,测试的时候报了一个  Cannot load JDBC driver class 'com.mysql.jdbc.Driver'  错误,,,使用的是jdk9和tomcat7 mysql的驱动是8.0
    回复 有任何疑惑可以回复我~ 2019-06-10 09:49:03
geelylucky 2019-05-14 17:34:51

同学,你这个信息不是报错信息,你要把错误信息给我看。这个是DEBUG级别的信息,你拿错了。

500说明你的代码逻辑存在问题。

0 回复 有任何疑惑可以回复我~
  • 提问者 肥羊Fly #1
    上面补充了一些错误的提示信息,麻烦您帮忙看看
    回复 有任何疑惑可以回复我~ 2019-05-14 18:21:55
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信