ibatis的春天java.lang.NoSuchMethodError com.ibatis.sq

2019-08-08 16:28发布

我在weblogic的10.3.6使用的弹簧3.2.0与2.3.4的iBatis而在WebLogic部署。

我得到这个的NoSuchMethodError如下:

User defined listener org.springframework.web.context.ContextLoaderListener failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gatewayService' defined in ServletContext resource [/WEB-INF/applicationContext-granite-webservice.xml]: Cannot resolve reference to bean 'daoIPInventory' while setting bean property 'dao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'daoIPInventory' defined in ServletContext resource [/WEB-INF/applicationContext-ip-ibatis-db.xml]: Cannot resolve reference to bean 'sqlMapClient' while setting bean property 'sqlMapClient'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClient' defined in ServletContext resource [/WEB-INF/applicationContext-ip-ibatis-db.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(Ljava/io/InputStream;Ljava/util/Properties;)Lcom/ibatis/sqlmap/client/SqlMapClient;.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gatewayService' defined in ServletContext resource [/WEB-INF/applicationContext-granite-webservice.xml]: Cannot resolve reference to bean 'daoIPInventory' while setting bean property 'dao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'daoIPInventory' defined in ServletContext resource [/WEB-INF/applicationContext-ip-ibatis-db.xml]: Cannot resolve reference to bean 'sqlMapClient' while setting bean property 'sqlMapClient'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClient' defined in ServletContext resource [/WEB-INF/applicationContext-ip-ibatis-db.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(Ljava/io/InputStream;Ljava/util/Properties;)Lcom/ibatis/sqlmap/client/SqlMapClient;
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
        Truncated. see log file for complete stacktrace
Caused By: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'daoIPInventory' defined in ServletContext resource [/WEB-INF/applicationContext-ip-ibatis-db.xml]: Cannot resolve reference to bean 'sqlMapClient' while setting bean property 'sqlMapClient'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClient' defined in ServletContext resource [/WEB-INF/applicationContext-ip-ibatis-db.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(Ljava/io/InputStream;Ljava/util/Properties;)Lcom/ibatis/sqlmap/client/SqlMapClient;
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
        Truncated. see log file for complete stacktrace
Caused By: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClient' defined in ServletContext resource [/WEB-INF/applicationContext-ip-ibatis-db.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(Ljava/io/InputStream;Ljava/util/Properties;)Lcom/ibatis/sqlmap/client/SqlMapClient;
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
        Truncated. see log file for complete stacktrace
Caused By: java.lang.NoSuchMethodError: com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(Ljava/io/InputStream;Ljava/util/Properties;)Lcom/ibatis/sqlmap/client/SqlMapClient;
        at org.springframework.orm.ibatis.SqlMapClientFactoryBean.buildSqlMapClient(SqlMapClientFactoryBean.java:339)
        at org.springframework.orm.ibatis.SqlMapClientFactoryBean.afterPropertiesSet(SqlMapClientFactoryBean.java:292)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
        Truncated. see log file for complete stacktrace

Answer 1:

貌似春3.2不符合的iBatis 2.3.4兼容。

在iBatis的2.3.4 SqlMapConfigParser有没有方法#parse(InputStream中,属性),但在新版本的MyBatis 2.3.5它是存在的。

也许问题也MyBatis的弹簧库版本。

然而,你应该更新的MyBatis版本或发现或Spring的相应版本的Spring的iBatis的整合。



Answer 2:

检查是否在你的项目中iBatis的JAR文件和MySQL连接器jar文件。 和你的控制器类的名字不应该是controller.java



Answer 3:

检查是否在你的项目中iBatis的JAR文件和MySQL连接器jar文件。 和你的控制器类的名字不应该是controller.java

您SqlMap的命名空间的名称应该是你已经写在每个sqlMapConfig.xml文件SqlMap的独特

在你的SqlMap文件中,所有标签应明确界定。 你必须提到parameterClass和resultClass。 一定不能离开的空单,像这样。

选择ID = “sampleid” parameterClass = “” resultClass = “”

您的查询

选择ID = “sampleid”

您QUER



Answer 4:

看起来,你使用的是不与这些参数解析方法iBatis的罐子。 反编译,看看罐子有分析哪些代码正在寻找方法。



文章来源: ibatis spring java.lang.NoSuchMethodError com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse