`
wxb880114
  • 浏览: 681024 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

SSI异常处理

 
阅读更多
  ### The error occurred while setting parameters
### SQL: insert   into SYS_SECURITY_RIGHT_SYSTEM(      SYSRIGHT_ID,   SYS_ORDER,   SYS_NAME,   SYS_MEMO   ) values (      ?,   ?,   ?,   ?   )
### Cause: java.sql.SQLException: ORA-01400: 无法将 NULL 插入 ("SMARTCITY"."SYS_SECURITY_RIGHT_SYSTEM"."SYSRIGHT_ID")

]


在使用Mybatis主键自增长时,其要求使用Integer,使用〈selectKey〉时需要数据库中存在一条数据,不然回报上述错误。


 2013-06-19 09:27:56,109 [http-bio-8080-exec-1] DEBUG [org.mybatis.spring.SqlSessionUtils] - Registering transaction synchronization for SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1681460]
 2013-06-19 09:27:56,119 [http-bio-8080-exec-1] DEBUG [org.mybatis.spring.transaction.SpringManagedTransaction] - JDBC Connection [org.apache.commons.dbcp.PoolableConnection@a1e9b0] will be managed by Spring
 2013-06-19 09:27:56,119 [http-bio-8080-exec-1] DEBUG [dci.smartcity.operationsmanagement.dao.IOrgDAO.update] - ooo Using Connection [org.apache.commons.dbcp.PoolableConnection@a1e9b0]
 2013-06-19 09:27:56,129 [http-bio-8080-exec-1] DEBUG [dci.smartcity.operationsmanagement.dao.IOrgDAO.update] - ==>  Preparing: update SYS_SECURITY_ORG SET ORG_NAME= ?, ORG_PID=?, ORG_ORDER=?, ORG_MEMO=?, ORG_CREATETIME=?, ORG_CREATEUSER=? where ORG_ID = ? 
 2013-06-19 09:27:56,129 [http-bio-8080-exec-1] DEBUG [dci.smartcity.operationsmanagement.dao.IOrgDAO.update] - ==> Parameters: xx                                                                                                                                                                                                                                                  (String), 1(Integer), 2(Integer), dfd                                                                                                                                                                                                                                                     (String), 20121111(Integer), ???????                                      (String), 3(Integer)
 2013-06-19 09:27:56,156 [http-bio-8080-exec-1] DEBUG [org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator] - Unable to translate SQLException with Error code '12899', will now try the fallback translator
 2013-06-19 09:27:56,159 [http-bio-8080-exec-1] DEBUG [org.springframework.jdbc.support.SQLStateSQLExceptionTranslator] - Extracted SQL state class '72' from value '72000'
 2013-06-19 09:27:56,161 [http-bio-8080-exec-1] DEBUG [org.mybatis.spring.SqlSessionUtils] - Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1681460]

在更新时出现如上错误,
错误原因:由于oracle数据库中设置字符串长度为255时,当插入数据aaaaa未满时会以空格填充,在更新时,我们直接在字符串aaaaa后添加时,其位数超过255,在更新时不能成功,并报以上错误。






Exception in thread "main" org.springframework.jdbc.BadSqlGrammarException: SqlMapClient operation; bad SQL grammar []; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in entity/TabB.xml. 
--- The error occurred while applying a parameter map. 
--- Check the tab_b.insert-InlineParameterMap. 
--- Check the statement (update failed). 
--- Cause: java.sql.SQLException: ORA-00942: 表或视图不存在

环境:数据库oracle11g,
    ibatis的TabB.xml中对应数据库中的表,在运行时不能自动创建,所以只能手动在Oracle中创建表。


  java.lang.ExceptionInInitializerError
	at tools.Test.<clinit>(Test.java:10)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext-all.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\eclipsejuno\eclipse\workspaces\smartcity\smartcity-mybatis\target\classes\org\smartcity\db1\entity\TabAMapper.xml]'; nested exception is java.lang.RuntimeException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for db1.taba.insert
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1422)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:518)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
	at tools.ApplicationContextUtils.rebuildApplicationContext(ApplicationContextUtils.java:21)
	at tools.ApplicationContextUtils.<clinit>(ApplicationContextUtils.java:12)
	... 1 more
Caused by: org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\eclipsejuno\eclipse\workspaces\smartcity\smartcity-mybatis\target\classes\org\smartcity\db1\entity\TabAMapper.xml]'; nested exception is java.lang.RuntimeException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for db1.taba.insert
	at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:462)
	at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:336)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1479)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1419)
	... 14 more
Caused by: java.lang.RuntimeException: Error parsing Mapper XML. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for db1.taba.insert
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:113)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:88)
	at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:460)
	... 17 more
Caused by: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for db1.taba.insert
	at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:760)
	at org.apache.ibatis.session.Configuration$StrictMap.put(Configuration.java:732)
	at org.apache.ibatis.session.Configuration.addMappedStatement(Configuration.java:562)
	at org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement(MapperBuilderAssistant.java:307)
	at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:109)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:128)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:121)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:111)
	... 19 more



有个错误一直很郁闷,搞了半天才搞定。错误如下:

java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for

原来是命名空间没写对,如果使用mapper
,则

<mapper namespace="com.sitech.mapper.StudentMapper">

空间中一定要写上Mapper的名称,否则就会报错

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext-all.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config_A.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException: Attribute "type" is required and must be specified for element type "resultMap".
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1422)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:518)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
	at tools.ApplicationContextUtils.rebuildApplicationContext(ApplicationContextUtils.java:21)
	at tools.ApplicationContextUtils.<clinit>(ApplicationContextUtils.java:12)
	... 1 more
Caused by: org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config_A.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException: Attribute "type" is required and must be specified for element type "resultMap".
	at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:430)
	at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:336)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1479)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1419)
	... 14 more
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException: Attribute "type" is required and must be specified for element type "resultMap".
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:106)
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:89)
	at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:424)
	... 17 more
Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException: Attribute "type" is required and must be specified for element type "resultMap".
	at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:253)
	at org.apache.ibatis.parsing.XPathParser.<init>(XPathParser.java:122)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.<init>(XMLMapperBuilder.java:74)
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:316)
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:104)
	... 19 more
Caused by: org.xml.sax.SAXParseException: Attribute "type" is required and must be specified for element type "resultMap".
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
	at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.addDTDDefaultAttrsAndValidate(XMLDTDValidator.java:1193)
	at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDValidator.java:1940)
	at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:764)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1363)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2756)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
	at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:232)
	at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
	at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:251)
	... 23 more

resultMap标签中的type元素是必须要指定的。

  java.lang.ExceptionInInitializerError
	at tools.Test.<clinit>(Test.java:10)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory_1' defined in class path resource [applicationContext-all.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config_B.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException: Attribute "resultType" must be declared for element type "insert".
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1422)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:518)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
	at tools.ApplicationContextUtils.rebuildApplicationContext(ApplicationContextUtils.java:21)
	at tools.ApplicationContextUtils.<clinit>(ApplicationContextUtils.java:12)
	... 1 more
Caused by: org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config_B.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException: Attribute "resultType" must be declared for element type "insert".
	at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:430)
	at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:336)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1479)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1419)
	... 14 more
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException: Attribute "resultType" must be declared for element type "insert".
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:106)
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:89)
	at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:424)
	... 17 more
Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException: Attribute "resultType" must be declared for element type "insert".
	at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:253)
	at org.apache.ibatis.parsing.XPathParser.<init>(XPathParser.java:122)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.<init>(XMLMapperBuilder.java:74)
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:316)
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:104)
	... 19 more
Caused by: org.xml.sax.SAXParseException: Attribute "resultType" must be declared for element type "insert".
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
	at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.addDTDDefaultAttrsAndValidate(XMLDTDValidator.java:1275)
	at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDValidator.java:1940)
	at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:764)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1363)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2756)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
	at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:232)
	at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
	at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:251)
	... 23 more

insert 语句没有返回值,删除 resultType与resultMap

Exception in thread "main" org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): org.smartcity.yw.dao.TabADAO.saveTabA
	at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:178)
	at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:38)
	at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:49)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:42)
	at $Proxy1.saveTabA(Unknown Source)
	at org.smartcity.yw.services.StuJotmServiceImpl.saveAB(StuJotmServiceImpl.java:21)
	at tools.Test.test_(Test.java:22)
	at tools.Test.main(Test.java:27)
Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for org.smartcity.yw.dao.TabADAO.saveTabA
	at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:775)
	at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:615)
	at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:608)
	at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:176)
	... 7 more

在TabAMapper.xml文件中的namespace是制定了Mapper接口.

java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool异常的解决办法
今天做了webwork+spring+hibernate框架的集成,
一启动Tomcat服务器就出了一大堆异常
报的错误是java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
在网上查找错误的原因,说是缺少了一个commons-pool.jar文件
在myeclipse的安装目录下搜索,得到这个文件.放进lib文件夹.
问题解决!

  org.jboss.resteasy.spi.UnhandledException: org.springframework.jdbc.BadSqlGrammarException: 
### Error querying database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3
### The error may exist in org/smartcity/dao/zygl/TabBMapper.xml
### The error may involve org.smartcity.dao.zygl.TabBDAO.findTabBById-Inline
### The error occurred while setting parameters
### SQL: select *   from tab_b   where id = #value#
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3
; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3
	at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:80)
	at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:220)
	at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:146)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:351)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:177)
	at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)
Caused by: org.springframework.jdbc.BadSqlGrammarException: 
### Error querying database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3
### The error may exist in org/smartcity/dao/zygl/TabBMapper.xml
### The error may involve org.smartcity.dao.zygl.TabBDAO.findTabBById-Inline
### The error occurred while setting parameters
### SQL: select *   from tab_b   where id = #value#
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3
; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3
	at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:233)
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
	at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:71)
	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:364)
	at $Proxy17.selectOne(Unknown Source)
	at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:159)
	at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:63)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:43)
	at $Proxy20.findTabBById(Unknown Source)
	at org.smartcity.services2.HelloWorldService2Impl.sayHello(HelloWorldService2Impl.java:22)
	at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
	at $Proxy22.sayHello(Unknown Source)
	at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
	at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:344)
	at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:296)
	at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:285)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:336)
	... 21 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
	at com.mysql.jdbc.Util.getInstance(Util.java:386)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4187)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4119)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2570)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2731)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2815)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155)
	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1379)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:256)
	at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:56)
	at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:70)
	at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:57)
	at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:259)
	at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:132)
	at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:105)
	at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:81)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:104)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:98)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:62)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:354)
	... 45 more


在ibatis改成mybatis时,mapper.xml文件中写错,
在ibatis中获取输入值采用

:  where id=#value#
而mybatis中,换成 where id=#{value}





 Caused by: org.apache.ibatis.binding.BindingException: Mapper method 'org.smartcity.dao.yw.TabADAO.saveTabA' has an unsupported return type: class org.smartcity.db1.entity.TabA

原因是返回对象与mapper.xml中定义的不一致,一个返回空,一个返回TabA。


org.jboss.resteasy.spi.UnhandledException: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): dci.smartcity.operationsmanagement.dao.IUserDAO.findById
	at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:80)
	at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:220)
	at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:146)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:351)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:177)
	at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): dci.smartcity.operationsmanagement.dao.IUserDAO.findById
	at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:178)
	at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:38)
	at org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:49)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:42)
	at $Proxy19.findById(Unknown Source)
	at dci.smartcity.operationsmanagement.service.UserServiceImpl.findById(UserServiceImpl.java:52)
	at dci.smartcity.operationsmanagement.business.UserBizImpl.findAllUser(UserBizImpl.java:117)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:196)
	at $Proxy23.findAllUser(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
	at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:344)
	at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:296)
	at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:285)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:336)
	... 21 more
Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for dci.smartcity.operationsmanagement.dao.IUserDAO.findById
	at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:775)
	at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:615)
	at org.apache.ibatis.session.Configuration.getMappedStatement(Configuration.java:608)
	at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:176)
	... 43 more
分享到:
评论

相关推荐

    基于单片机的SSI信号处理设计.pdf

    此外,要重视系统在异常情况下的处理能力,以防因特殊情况导致系统运行异常。 文章还提出,基于单片机的信号处理方法还停留在传统的层面上,需要进一步采用新的理念和方法来提升设计水平。在实际工作中,基于单片机...

    ssi实现了增删改查 分页 异常捕获log日志 md5加密等功能

    3. **异常捕获**:异常处理是编程中的关键部分,用于确保程序在遇到错误时不会崩溃。在SSI中,可以使用条件语句和错误处理函数来捕获和处理可能出现的异常情况,比如文件不存在、语法错误等,确保程序的稳定运行。 ...

    SSI_read.rar_SSI verilog_SSI 11bit read_SSI_read_ssi verilog_v

    这可能包括不同的输入序列、异常条件等。 7. **综合与实现**:最后,将Verilog代码综合为门级网表,并在FPGA或ASIC上实现,进行实际硬件验证。 综上所述,这个项目涉及了Verilog编程、数字逻辑设计、同步串行通信...

    ssi项目整合

    在SSI项目整合中,我们通常会将SSI技术与其他Web开发框架或服务进行结合,以提升网站的动态内容处理能力。 在描述中提到的"ssi整合",可能是指将SSI功能集成到某个特定的Web应用项目中,比如Spring框架。Spring是...

    SSI设备管理系统源码

    - 异常处理和安全性:检查系统如何处理错误和异常,以及用户输入验证等安全措施。 - 性能优化:如果源码中有相关代码,可以学习如何提高查询效率、减少服务器负载。 总的来说,"SSI设备管理系统源码"是一个宝贵的...

    ssi权限管理

    1. 文件权限:在服务器上,需要确保SSI处理的文件具有适当的读取和执行权限。通常,这涉及到修改文件的权限位,例如在Linux系统中,使用`chmod`命令设置文件为可读可执行。 2. 用户和组:在服务器环境中,通常会...

    基于spring 的ssi-uploader的多图片上传

    5. **错误处理**:SSI-Uploader提供了异常处理机制,当文件上传过程中出现错误时,如文件大小超过限制,可以通过捕获异常来给出相应的错误提示。 6. **前端交互**:前端页面需要使用HTML的`...

    SSI框架可直接用

    Struts2通过拦截器机制实现业务逻辑和表示层的解耦,提供灵活的数据绑定,以及强大的验证和异常处理功能。它与Spring框架结合,可以实现更高效的控制流程和更丰富的用户界面。 【MyBatis框架】 MyBatis原名为...

    ssi框架入门详解

    Struts2还支持多种视图技术,如JSP,以及各种插件和拦截器,用于增强功能和处理异常。 **Spring**是全面的框架,提供依赖注入(DI)和面向切面编程(AOP)等功能,使得对象的创建和管理变得更加简单。Spring容器...

    ssi的jar包

    8. **错误处理与日志记录**:理解如何处理异常情况,以及如何利用日志系统(如Log4j)来记录运行时信息和错误。 9. **性能优化**:在处理大量请求时,了解如何优化SSI处理过程,减少不必要的I/O操作,提高响应速度...

    ssi权限管理系统架构

    Spring MVC简化了数据绑定、视图渲染、异常处理等任务,使得开发者可以更专注于业务逻辑,而无需关心底层细节。 3. **Hibernate**:这是一个流行的Java对象关系映射(ORM)工具,它可以将数据库操作转化为对Java...

    ssi集成+全注解

    6. **异常处理**:Struts2和Spring都可以处理异常,可以通过注解或配置文件定义全局的异常处理器。 7. **测试与调试**:全注解方式使得测试更加方便,可以使用JUnit和Mockito等工具进行单元测试。 在实际项目中,...

    ssi框架项目实力(初学者)

    6. 错误处理和日志记录:了解如何在程序中捕获和处理异常,以及如何记录运行日志以辅助调试。 在实际操作中,你可能需要使用开发工具,如Visual Studio、Notepad++或Sublime Text,以及数据库管理工具,如SQL ...

    输出SSI串行信号介绍.rar

    3. **传输过程**:详细描述了数据传输的步骤,如时钟同步、数据发送、接收确认等,以及如何处理错误和异常情况。 4. **应用实例**:可能列举了一些实际应用案例,比如在伺服控制系统中的编码器接口,或者在分布式...

    ssi2(struts2+spring+ibatis)整合加用户增加改查操作

    在实际开发中,通常还会涉及异常处理、权限控制、页面验证等环节,以确保应用的安全性和用户体验。 总的来说,"ssi2(struts2+spring+ibatis)整合加用户增加改查操作"是一个完整的Java Web开发实践,涵盖了MVC框架的...

    SSi(Struts2+Spring+iBatis)实现文件上传下载功能

    9. **异常处理**:在编写代码时,需要捕获并处理可能出现的异常,如文件读写错误、数据库操作失败等,确保良好的用户体验。 通过学习和实践这个SSi实现的文件上传下载功能,你可以深入理解这三大框架的集成,以及...

    SSI实现 excel 与ORACLE 之间的导入导出

    6. **错误处理**:在处理过程中,必须捕获和处理可能出现的异常,如文件不存在、数据格式错误、数据库连接失败等。 7. **导出数据**:另一方面,从Oracle导出数据到Excel也需要类似的流程。可以使用SQL查询从数据库...

    ssi空框架自我练习

    7. **错误处理和日志记录**:学习如何处理服务器端的异常,并记录调试信息,这对于排查问题至关重要。 8. **性能优化**:理解何时使用SSI和何时应该转向更复杂的服务器端技术,如PHP、ASP.NET或Java的Spring MVC,...

    SSI300系列光伏并网逆变器用户手册.zip

    如有异常,应按照手册中的故障排查指南进行处理。 五、故障诊断与处理 当逆变器出现故障警告时,用户可以通过查看显示屏的错误代码或查阅手册来识别问题。常见的故障可能涉及过热、电网异常、通信问题等。按照手册...

Global site tag (gtag.js) - Google Analytics