SSM:Cause: java.sql.SQLSyntaxErrorException: ORA-00933: SQL 命令未正确结束的解决

QUESTION:SSM:Cause: java.sql.SQLSyntaxErrorException: ORA-00933: SQL 命令未正确结束的解决?

 

ANWSER:

 

一:问题提出:

使用SSM框架做一个权限后台管理项目时,利用PageHelper插件进行分页查询时,突然出现以下异常:

HTTP Status 500 – Internal Server ErrorType Exception ReportMessage Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException:Description The server encountered an unexpected condition that prevented it from fulfilling the request.Exceptionorg.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: 
### Error querying database.  Cause: java.sql.SQLSyntaxErrorException: ORA-00933: SQL 命令未正确结束### The error may exist in com/xy/dao/OrdersDao.java (best guess)
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: select *from orders LIMIT ?
### Cause: java.sql.SQLSyntaxErrorException: ORA-00933: SQL 命令未正确结束; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: ORA-00933: SQL 命令未正确结束org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1013)org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897)javax.servlet.http.HttpServlet.service(HttpServlet.java:635)org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)javax.servlet.http.HttpServlet.service(HttpServlet.java:742)org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)Root Causeorg.springframework.jdbc.BadSqlGrammarException: 
### Error querying database.  Cause: java.sql.SQLSyntaxErrorException: ORA-00933: SQL 命令未正确结束### The error may exist in com/xy/dao/OrdersDao.java (best guess)
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: select *from orders LIMIT ?
### Cause: java.sql.SQLSyntaxErrorException: ORA-00933: SQL 命令未正确结束; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: ORA-00933: SQL 命令未正确结束org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:93)org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)com.sun.proxy.$Proxy90.selectList(Unknown Source)org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230)org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:137)org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75)org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)com.sun.proxy.$Proxy94.findAll(Unknown Source)com.xy.service.impl.OrdersServiceImpl.findAll(OrdersServiceImpl.java:28)sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)java.lang.reflect.Method.invoke(Method.java:498)org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)com.sun.proxy.$Proxy97.findAll(Unknown Source)com.xy.controller.OrdersController.findAll(OrdersController.java:32)sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)java.lang.reflect.Method.invoke(Method.java:498)org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189)org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892)org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897)javax.servlet.http.HttpServlet.service(HttpServlet.java:635)org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)javax.servlet.http.HttpServlet.service(HttpServlet.java:742)org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)Root Causejava.sql.SQLSyntaxErrorException: ORA-00933: SQL 命令未正确结束oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:439)oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:395)oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:802)oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:436)oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186)oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:521)oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:205)oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:861)oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1145)oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1267)oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3449)oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3550)oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1374)com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.execute(NewProxyPreparedStatement.java:989)org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:63)org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63)org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:136)org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)com.sun.proxy.$Proxy108.query(Unknown Source)org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)java.lang.reflect.Method.invoke(Method.java:498)org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)com.sun.proxy.$Proxy90.selectList(Unknown Source)org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230)org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:137)org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75)org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)com.sun.proxy.$Proxy94.findAll(Unknown Source)com.xy.service.impl.OrdersServiceImpl.findAll(OrdersServiceImpl.java:28)sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)java.lang.reflect.Method.invoke(Method.java:498)org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)com.sun.proxy.$Proxy97.findAll(Unknown Source)com.xy.controller.OrdersController.findAll(OrdersController.java:32)sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)java.lang.reflect.Method.invoke(Method.java:498)org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189)org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892)org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897)javax.servlet.http.HttpServlet.service(HttpServlet.java:635)org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)javax.servlet.http.HttpServlet.service(HttpServlet.java:742)org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)Note The full stack trace of the root cause is available in the server logs.

第一次使用Oracle数据库进行项目的开发,检查写的OrdersDao和OrdersServiceImpl都没有语法错误,在OrdersServiceImpl里去掉分页查询语句可以完美运行:

package com.xy.service.impl;import com.github.pagehelper.PageHelper;
import com.xy.dao.OrdersDao;
import com.xy.domain.Orders;
import com.xy.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;import java.util.List;@Service
@Transactional
public class OrdersServiceImpl implements OrdersService {@Autowiredprivate OrdersDao ordersDao;/*** 查询所有订单* @param pageNum* @param pageSize* @return*/@Overridepublic List<Orders> findAll(int pageNum,int pageSize) {PageHelper.startPage(pageNum,pageSize);return  ordersDao.findAll();}
}

二:解决方法:

一开始找了好多相关博客,大部分是说sql语句语法错误。

 

 

 

 

 

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/481958.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Zookeeper默认占用8080端口问题以及常见启动错误的解决

QUESTION:Zookeeper默认占用8080端口问题以及常见启动错误的解决&#xff1f; 在刚接触到zookeeper的时候&#xff0c;linux启动时查看状态出现以下异常: Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg Client port found: 2181. Client address: localhost. Erro…

在弱肉强食的世界里,人类的美德意识为何能够超越其他物种?

来源&#xff1a;混沌巡洋舰本文摘编整理自《人性悖论&#xff1a;人类进化中的美德与暴力》 中信出版集团 2022年6月狭隘利他主义假设&#xff0c;战争可能导致自我牺牲&#xff0c;似乎只适用于其文化效应方面&#xff0c;而不能解释为进化上的选择力量。然而&#xff0c;该理…

IDEA Pycharm 等工具

为防止失效&#xff0c;另在个人博客获取。

一场关于物理学本质的争论:实验是检验科学的唯一标准吗?

来源&#xff1a;本文经公众号“环球科学ScientificAmerican”&#xff08;ID: huanqiukexue&#xff09;撰文&#xff1a;马西莫皮柳奇&#xff08;Massimo Pigliucci&#xff09;翻译&#xff1a;叶宣伽审校&#xff1a;丁家琦为了统一广义相对论和量子力学而建立的弦理论&am…

搭建分布式环境:Dubbo+Zookeeper

QUESTION&#xff1a;搭建分布式环境:DubboZookeeper&#xff1f; ANSWER: 一&#xff1a;官网下载Zookeeper 点击官网:Zookeeper&#xff0c;进行下载。 下载完成&#xff0c;解压缩到文件。 二&#xff1a;配置启动Zookeeper 进入conf目录&#xff0c;复制zoo_sample.cfg一…

AI 界著名「嘴炮」发声:鬼扯,LaMDA 不可能觉醒!

来源&#xff1a;AI科技大本营作者&#xff1a;郑丽媛来源&#xff1a;CSDN因谷歌工程师 Blake Lemoine 坚称谷歌语言模型 LaMDA 已觉醒&#xff0c;这几天 LaMDA 已频繁登上国内外科技网站首页&#xff0c;其相关热门话题无一不是围绕“LaMDA 是否真的觉醒&#xff1f;”、“L…

AI 正在引领一场新型科学革命

来源&#xff1a;AI科技评论作者&#xff1a;Bryan McMahon编译&#xff1a;bluemin编辑&#xff1a;陈彩娴自20世纪50年代DNA被发现以来&#xff0c;生物学家一直试图将基因序列的长度与一系列细胞成分和蛋白质合成过程联系起来&#xff0c;例如&#xff0c;包括为现在著名的m…

分布式系统:SrpingBoot整合Zookeeper和Dubbo的版本匹配问题

QUESTION&#xff1a;SrpingBoot整合Zookeeper和Dubbo的版本匹配问题解决&#xff1f; ANSWER&#xff1a; 历史版本 如果您现在使用的Dubbo版本低于2.7.0&#xff0c;请使用如下对应版本的Dubbo Spring Boot&#xff1a; Dubbo Spring BootDubboSpring Boot0.2.1.RELEASE2.…

西安交大团队开发了一种混合深度学习模型,用于在基因组中识别启动子

来源&#xff1a;ScienceAI编辑&#xff1a;萝卜皮人类的大部分细胞中&#xff0c;每时每刻都在进行着各种复杂的转录过程&#xff1b;这一过程与后续的蛋白质合成息息相关&#xff0c;从而会影响人体中各类酶、抗体、激素、免疫因子等生物分子的产生&#xff0c;最终影响人的身…

分布式系统:SpringBoot中Dubbo以及Zookeeper依赖包冲突 LoggerFactory is not a Logback LoggerContext but Logback

目录 QUESTION:SpringBoot中Dubbo以及Zookeeper依赖包冲突? ANSWER: 导入curator-recipes依赖&#xff1a; 排除依赖: QUESTION:SpringBoot中Dubbo以及Zookeeper依赖包冲突? 出现以下异常&#xff1a; Exception in thread "main" java.lang.IllegalArgument…

在科学史上,“革命”意味着什么?

来源&#xff1a;《科学哲学的历史导论》、思庐哲学&#xff08;siluphilosophy&#xff09;作者&#xff1a;约翰洛西对正统学说的诸多批评有一种累积的效果。许多科学哲学家渐渐认为&#xff0c;用形式逻辑范畴来重建科学时会失去一些至关重要的东西。在他们看来&#xff0c;…

SpringBoot整合Dubbo+Zookeeper进行分布式搭建系统

QUESTIONl:SpringBoot整合DubboZookeeper进行分布式搭建系统&#xff1f; ANSWER&#xff1a; 一&#xff1a;创建项目模块 1.1.创建一个Empty Project 名称:Dubbo 1.2.创建一个Provider模块 这里采用SpringBoot快速搭建。 1.3.创建Consumer模块 创建完成后代码架构: 二&am…

2023年全球前端大技术大会(GMTC北京站2023)-核心PPT资料下载

一、峰会简介 大会以“业务至上&#xff0c;效率为王”为主题&#xff0c;策划了 1 个主会场&#xff0c;10 个技术专场。会议议题包含前端 DevOps 实践、低代码、大前端监控、跨端技术选型、团队可持续发展、IoT 动态应用开发、移动端性能与效率优化、TypeScript、大前端技术…

人工智能并不像你想象的那么迫在眉睫

来源&#xff1a;AI前线作者&#xff1a;Gary Marcus策划&#xff1a;孙瑞瑞如果你仔细观察就会发现&#xff0c;最新的系统&#xff0c;包括 DeepMind 大肆宣传的 Gato&#xff0c;仍然被同样的老问题所困扰。在普通人看来&#xff0c;人工智能&#xff08;AI&#xff09;领域…

@Controller与@RestController的区别以及ircular view path [ad]: would dispatch back to the current handler异常

QUESTION:Controller与RestController的区别以及ircular view path [ad]: would dispatch back to the current handler异常&#xff1f; 在编写SpringBOOT的时候&#xff0c;在启动时出现异常: javax.servlet.ServletException: Circular view path [index]: would dispatch …

从感知机到Transformer,一文概述深度学习简史

来源&#xff1a;机器之心作者&#xff1a;Jean de Dieu Nyandwi这篇文章从感知机开始&#xff0c;按照时间顺序回顾了深度学习的历史。1958 年&#xff1a;感知机的兴起1958 年&#xff0c;弗兰克 罗森布拉特发明了感知机&#xff0c;这是一种非常简单的机器模型&#xff0c;…

Dubbo:com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method 问题的解决

QUESTION:Dubbo&#xff1a;com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method 问题的解决? ANSWER&#xff1a; 一、原因&#xff1a; 1.需要进行序列化的POJO类没有进行序列化。 多是入参中的一些参数实体类。这个原因是最容易发现的&#xff0c;因为未序列…

深度学习的综述的综述

来源&#xff1a;知乎文章来源&#xff1a;https://zhuanlan.zhihu.com/p/85625555“ 综述永远是入门新领域的最快捷径之一&#xff01;”2018年下半年an发的一篇综述类文献&#xff0c;好心的机器之心已经翻译好了&#xff0c;我就直接复制下来修改一下表述的错误和补充&#…

Docker添加或者更改容器的端口映射

QUESTION&#xff1a;Docker添加或者更改容器的端口映射&#xff1f; ANSWER: 初学Docker容器&#xff0c;按照教程的基本命令&#xff0c;拉取创建了几个容器&#xff0c;都是在一开始新建的时候 docker run -p 指定对应的端口&#xff0c;但对于docker start 没有这个功能&…

新书推荐:人工智能通识讲义

中国科学院大学经济与管理学院 副院长 中国科学院虚拟经济与数据科学研究中心 副主任 田英杰 目前&#xff0c;新一代人工智能&#xff08;AI&#xff09;技术处于爆发期之后的深化期&#xff0c;各行业都需要大量的具备AI技术素养的专业人才&#xff0c;人们的日常生活已经和A…