java.lang.NoSuchMethodError

今天重新搭了个Spring+hibernate的web项目,为了在数据库里直接生成hibernate的entity的类以及映射文件,便引用了MyEclipse自带的hibernate框架,然后生成了一系列的配置文件,看着不习惯的自己全部是删掉了,但是项目启动的时候就出现了下面的异常:

严重: StandardWrapper.Throwable
java.lang.NoSuchMethodError: org.springframework.core.convert.converter.ConverterRegistry.addConverter(Ljava/lang/Class;Ljava/lang/Class;Lorg/springframework/core/convert/converter/Converter;)V
 at org.springframework.core.convert.support.DefaultConversionService.addScalarConverters(DefaultConversionService.java:82)
 at org.springframework.core.convert.support.DefaultConversionService.addDefaultConverters(DefaultConversionService.java:63)
 at org.springframework.core.convert.support.DefaultConversionService.(DefaultConversionService.java:50)
 at org.springframework.core.env.AbstractPropertyResolver.(AbstractPropertyResolver.java:41)
 at org.springframework.core.env.PropertySourcesPropertyResolver.(PropertySourcesPropertyResolver.java:41)
 at org.springframework.core.env.AbstractEnvironment.(AbstractEnvironment.java:98)
 at org.springframework.core.env.StandardEnvironment.(StandardEnvironment.java:54)
 at org.springframework.web.context.support.StandardServletEnvironment.(StandardServletEnvironment.java:44)
 at org.springframework.web.servlet.HttpServletBean.createEnvironment(HttpServletBean.java:215)
 at org.springframework.web.servlet.HttpServletBean.getEnvironment(HttpServletBean.java:205)
 at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126)
 at javax.servlet.GenericServlet.init(GenericServlet.java:160)
 at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
 at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)
 at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5015)
 at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5302)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:897)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:873)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
 at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1095)
 at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1617)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
 at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
 at java.util.concurrent.FutureTask.run(FutureTask.java:166)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
 at java.lang.Thread.run(Thread.java:722)

然后在网上找原因,各种解释都有,然后就从报错的类入手。比如 org.springframework.core.convert.converter.ConverterRegistry 在MyEclipse里ctrl+shift+T粘贴类名,问题就出来了,一个显示的路径是我自己加的jar包,另一个是MyEclipse自带的文件路径。这样问题就出来了,一定是jar包冲突了,删了MyEclipse生成的build path,问题就解决了。又学到了一种查错的方法。以后遇到问题应该多想想自己的程序哪里不合逻辑了,盲目的在网上找解决办法,效率很低。

你可能感兴趣的:(我的异常)