随笔-10  评论-23  文章-32  trackbacks-0
Error creating bean with name 'sqlMapClient' defined in file [H:\work_soft\workspace-galileo\zhejiangLibrary\target\classes\applicationContext-ibatis.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)

at org.springframework.beans.factory.support.AbstractBeanFactory$
1.getObject(AbstractBeanFactory.java:264)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:
222)

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:
261)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:
185)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:
164)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:
423)

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:
728)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:
380)

at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:
255)

at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:
199)

at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:
45)

at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:
548)

at org.mortbay.jetty.servlet.Context.startContext(Context.java:
136)

at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:
1234)

at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:
517)

at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:
460)

at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:
124)

at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)

at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:
152)

at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:
156)

at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)

at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:
152)

at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)

at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:
130)

at org.mortbay.jetty.Server.doStart(Server.java:
222)

at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)

at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:
132)

at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:
379)

at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:
321)

at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:
205)

at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:
184)

at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:
451)

at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:
558)

at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:
512)

at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:
482)

at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:
330)

at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:
291)

at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:
142)

at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:
336)

at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:
129)

at org.apache.maven.cli.MavenCli.main(MavenCli.java:
287)

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.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:
315)

at org.codehaus.classworlds.Launcher.launch(Launcher.java:
255)

at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:
430)

at org.codehaus.classworlds.Launcher.main(Launcher.java:
375)

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)

...
53 more



已解决:

 ibatis2的版本问题,可能是ibatis2的接口有所更改,所以配置文件也要相应的修改。使用ibatis-sqlmap.jar代替ibatis2-sqlmap.jar,或同时加入就可以。

我的配置方式如下(这可能就是老的配置方式):

<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
    <property name="configLocation" value="/WEB-INF/spring/sql-map-config.xml"/>
    <property name="dataSource" ref="dataSource"></property>
</bean>

posted on 2009-08-10 14:18 liuyimx 阅读(7658) 评论(4)  编辑  收藏

评论:
# re: spring+ibatis 配置出错(com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(Ljava/io/InputStream;Ljava/util/Properties;)Lcom/ibatis/sqlmap/client/SqlMapClient;) 2011-10-11 10:16 | feihuale
我也碰到了相同的错误,我添加了ibatis-sqlmap-2.jar
里面com.ibatis.sqlmapl.engine.builder.xml.SqlMapConfigParser类,
有parser(reader,propertis);方法,但是还是出现这个错误。。。求救。。。。  回复  更多评论
  
# re: spring+ibatis 配置出错(com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(Ljava/io/InputStream;Ljava/util/Properties;)Lcom/ibatis/sqlmap/client/SqlMapClient;) 2011-10-11 10:47 | feihuale
问题终于解决了,换了一包,parse(InputStream,Properties);

关键是要有这个方法。。。。。。累的我够。。。。  回复  更多评论
  
# re: spring+ibatis 配置出错(com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(Ljava/io/InputStream;Ljava/util/Properties;)Lcom/ibatis/sqlmap/client/SqlMapClient;) 2011-10-11 10:53 | 留意生活
呵呵,解决了就好@feihuale
  回复  更多评论
  
# re: spring+ibatis 配置出错(com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(Ljava/io/InputStream;Ljava/util/Properties;)Lcom/ibatis/sqlmap/client/SqlMapClient;) 2012-05-30 13:31 | light.young
你好,我也遇到了相同的问题,找了好几个包试了还是不行,能不能将你的包发我一下,在此谢过了!yxl419@163.com @feihuale
  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航: