java.lang.NoClassDefFoundError

qq312409 2012-06-14 09:12:51
我在用到SSI的一个项目中运行tomcat的时候报了如下的错误,但是我把jar包都导进去了,还是解决不了。是在myeclipse环境下运行的,java的classpath的路径我查看过了,没有错。
Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
java.lang.NoClassDefFoundError: org/springframework/context/support/AbstractRefreshableConfigApplicationContext
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1847)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:890)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1354)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1847)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:890)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1354)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:230)
at org.springframework.web.context.ContextLoader.determineContextClass(ContextLoader.java:302)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:245)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.ClassNotFoundException: org.springframework.context.support.AbstractRefreshableConfigApplicationContext
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 44 more
...全文
49514 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
xianwangkai 2013-05-14
  • 打赏
  • 举报
回复
在导入jar时候一定要确认版本是否正确,以及是否存在包冲突的问题,不然你都不知道哪里出错!
鹏程万li 2013-05-14
  • 打赏
  • 举报
回复
引用 7 楼 qq312409 的回复:
被jar搞得偶的头晕了 我把org.springframework.core这个jar引用了,但是报错,说是在这个jar中的一个class找不到,我把这个jar解压后也找不到,不知道是什么原因。用的spring是3.x的。具体的报错如下: 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.web.context.support.XmlWebApplicationContext]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/core/env/DefaultEnvironment at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:162) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:104) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:251) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:578) 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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Caused by: java.lang.NoClassDefFoundError: org/springframework/core/env/DefaultEnvironment at org.springframework.context.support.AbstractApplicationContext.createEnvironment(AbstractApplicationContext.java:418) at org.springframework.context.support.AbstractApplicationContext.<init>(AbstractApplicationContext.java:227) at org.springframework.context.support.AbstractApplicationContext.<init>(AbstractApplicationContext.java:217) at org.springframework.context.support.AbstractRefreshableApplicationContext.<init>(AbstractRefreshableApplicationContext.java:82) at org.springframework.context.support.AbstractRefreshableConfigApplicationContext.<init>(AbstractRefreshableConfigApplicationContext.java:51) at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.<init>(AbstractRefreshableWebApplicationContext.java:93) at org.springframework.web.context.support.XmlWebApplicationContext.<init>(XmlWebApplicationContext.java:62) 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 org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147) ... 28 more Caused by: java.lang.ClassNotFoundException: org.springframework.core.env.DefaultEnvironment at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) ... 40 more 2012-6-14 14:36:13 org.apache.catalina.core.StandardContext start 严重: Error listenerStart 2012-6-14 14:36:13 org.apache.catalina.core.StandardContext start 严重: Context [/Test] startup failed due to previous errors
这个我出现过,是包坏掉了,重新复制一个好的就行
perior 2012-06-14
  • 打赏
  • 举报
回复
Ctrl+Shift+H 打开类搜索画面,把报错的类复制上去,看有没有,如果没有就表示没有添加到项目中
五哥 2012-06-14
  • 打赏
  • 举报
回复
org.springframework.core-3.1.1.RELEASE.jar
qq312409 2012-06-14
  • 打赏
  • 举报
回复
哦,是这样的。我以为在spring.jar中就有了,没想到还要加其他的jar包。我还想问下,现在报了另外一个错
java.lang.ClassNotFoundException: org.springframework.core.env.EnvironmentCapable
我想问下这个需要用到什么jar包
lgq_0714 2012-06-14
  • 打赏
  • 举报
回复

1、jar包少了

2、jar包对应的版本不对

泰山1979 2012-06-14
  • 打赏
  • 举报
回复
少spring包。
五哥 2012-06-14
  • 打赏
  • 举报
回复
少jar包啦 org.springframework.context-3.1.1.RELEASE.jar

org/springframework/context/support/AbstractRefreshableConfigApplicationContext

把 org.springframework.context-3.1.1.RELEASE.jar放到lib包中,即加到项目中
qq312409 2012-06-14
  • 打赏
  • 举报
回复
可能是这个问题吧,因为我缺哪个jar就从网上down下来的。
五哥 2012-06-14
  • 打赏
  • 举报
回复
你的jar还是统一从一个版本中出,要不然会有不兼容的哦
五哥 2012-06-14
  • 打赏
  • 举报
回复
org.springframework.core-3.1.0.M1.jar



Files contained in org.springframework.core-3.1.0.M1.jar:

META-INF/MANIFEST.MF
META-INF/license.txt
META-INF/notice.txt
org.springframework.core.AliasRegistry.class
org.springframework.core.AttributeAccessor.class
org.springframework.core.AttributeAccessorSupport.class
org.springframework.core.BridgeMethodResolver.class
org.springframework.core.CollectionFactory.class
org.springframework.core.ConcurrentMap.class
org.springframework.core.ConfigurableObjectInputStream.class
org.springframework.core.ConstantException.class
org.springframework.core.Constants.class
org.springframework.core.ControlFlow.class
org.springframework.core.ControlFlowFactory.class
org.springframework.core.Conventions.class
org.springframework.core.DecoratingClassLoader.class
org.springframework.core.ErrorCoded.class
org.springframework.core.ExceptionDepthComparator.class
org.springframework.core.GenericCollectionTypeResolver.class
org.springframework.core.GenericTypeResolver.class
org.springframework.core.InfrastructureProxy.class
org.springframework.core.JdkVersion.class
org.springframework.core.LocalVariableTableParameterNameDiscoverer.class
org.springframework.core.MethodParameter.class
org.springframework.core.NamedInheritableThreadLocal.class
org.springframework.core.NamedThreadLocal.class
org.springframework.core.NestedCheckedException.class
org.springframework.core.NestedExceptionUtils.class
org.springframework.core.NestedIOException.class
org.springframework.core.NestedRuntimeException.class
org.springframework.core.OrderComparator.class
org.springframework.core.Ordered.class
org.springframework.core.OverridingClassLoader.class
org.springframework.core.ParameterNameDiscoverer.class
org.springframework.core.PrioritizedParameterNameDiscoverer.class
org.springframework.core.PriorityOrdered.class
org.springframework.core.SimpleAliasRegistry.class
org.springframework.core.SmartClassLoader.class
org.springframework.core.SpringVersion.class
org.springframework.core.annotation.AnnotationAwareOrderComparator.class
org.springframework.core.annotation.AnnotationUtils.class
org.springframework.core.annotation.Order.class
org.springframework.core.annotation.package-info.class
org.springframework.core.convert.ConversionException.class
org.springframework.core.convert.ConversionFailedException.class
org.springframework.core.convert.ConversionService.class
org.springframework.core.convert.ConverterNotFoundException.class
org.springframework.core.convert.TypeDescriptor.class
org.springframework.core.convert.converter.ConditionalGenericConverter.class
org.springframework.core.convert.converter.Converter.class
org.springframework.core.convert.converter.ConverterFactory.class
org.springframework.core.convert.converter.ConverterRegistry.class
org.springframework.core.convert.converter.GenericConverter.class
org.springframework.core.convert.converter.package-info.class
org.springframework.core.convert.package-info.class
org.springframework.core.convert.support.ArrayToArrayConverter.class
org.springframework.core.convert.support.ArrayToCollectionConverter.class
org.springframework.core.convert.support.ArrayToObjectConverter.class
org.springframework.core.convert.support.ArrayToStringConverter.class
org.springframework.core.convert.support.CharacterToNumberFactory.class
org.springframework.core.convert.support.CollectionToArrayConverter.class
org.springframework.core.convert.support.CollectionToCollectionConverter.class
org.springframework.core.convert.support.CollectionToObjectConverter.class
org.springframework.core.convert.support.CollectionToStringConverter.class
org.springframework.core.convert.support.ConversionServiceFactory.class
org.springframework.core.convert.support.ConversionUtils.class
org.springframework.core.convert.support.ConvertingPropertyEditorAdapter.class
org.springframework.core.convert.support.DefaultConversionService.class
org.springframework.core.convert.support.GenericConversionService.class
org.springframework.core.convert.support.IdToEntityConverter.class
org.springframework.core.convert.support.MapToMapConverter.class
org.springframework.core.convert.support.NumberToCharacterConverter.class
org.springframework.core.convert.support.NumberToNumberConverterFactory.class
org.springframework.core.convert.support.ObjectToArrayConverter.class
org.springframework.core.convert.support.ObjectToCollectionConverter.class
org.springframework.core.convert.support.ObjectToObjectConverter.class
org.springframework.core.convert.support.ObjectToStringConverter.class
org.springframework.core.convert.support.PropertiesToStringConverter.class
org.springframework.core.convert.support.PropertyTypeDescriptor.class
org.springframework.core.convert.support.StringToArrayConverter.class
org.springframework.core.convert.support.StringToBooleanConverter.class
org.springframework.core.convert.support.StringToCharacterConverter.class
org.springframework.core.convert.support.StringToCollectionConverter.class
org.springframework.core.convert.support.StringToEnumConverterFactory.class
org.springframework.core.convert.support.StringToLocaleConverter.class
org.springframework.core.convert.support.StringToNumberConverterFactory.class
org.springframework.core.convert.support.StringToPropertiesConverter.class
org.springframework.core.convert.support.package-info.class
org.springframework.core.enums.AbstractCachingLabeledEnumResolver.class
org.springframework.core.enums.AbstractGenericLabeledEnum.class
org.springframework.core.enums.AbstractLabeledEnum.class
org.springframework.core.enums.LabeledEnum.class
org.springframework.core.enums.LabeledEnumResolver.class
org.springframework.core.enums.LetterCodedLabeledEnum.class
org.springframework.core.enums.ShortCodedLabeledEnum.class
org.springframework.core.enums.StaticLabeledEnum.class
org.springframework.core.enums.StaticLabeledEnumResolver.class
org.springframework.core.enums.StringCodedLabeledEnum.class
org.springframework.core.enums.package-info.class
org.springframework.core.env.AbstractEnvironment.class
org.springframework.core.env.AbstractPropertyResolver.class
org.springframework.core.env.ConfigurableEnvironment.class
org.springframework.core.env.ConfigurablePropertyResolver.class
org.springframework.core.env.DefaultEnvironment.class


http://www.java2s.com/Code/Jar/o/Downloadorgspringframeworkcore310M1jar.htm
qq312409 2012-06-14
  • 打赏
  • 举报
回复
被jar搞得偶的头晕了 我把org.springframework.core这个jar引用了,但是报错,说是在这个jar中的一个class找不到,我把这个jar解压后也找不到,不知道是什么原因。用的spring是3.x的。具体的报错如下:
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.web.context.support.XmlWebApplicationContext]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/core/env/DefaultEnvironment
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:162)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:104)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:251)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.NoClassDefFoundError: org/springframework/core/env/DefaultEnvironment
at org.springframework.context.support.AbstractApplicationContext.createEnvironment(AbstractApplicationContext.java:418)
at org.springframework.context.support.AbstractApplicationContext.<init>(AbstractApplicationContext.java:227)
at org.springframework.context.support.AbstractApplicationContext.<init>(AbstractApplicationContext.java:217)
at org.springframework.context.support.AbstractRefreshableApplicationContext.<init>(AbstractRefreshableApplicationContext.java:82)
at org.springframework.context.support.AbstractRefreshableConfigApplicationContext.<init>(AbstractRefreshableConfigApplicationContext.java:51)
at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.<init>(AbstractRefreshableWebApplicationContext.java:93)
at org.springframework.web.context.support.XmlWebApplicationContext.<init>(XmlWebApplicationContext.java:62)
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 org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
... 28 more
Caused by: java.lang.ClassNotFoundException: org.springframework.core.env.DefaultEnvironment
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 40 more
2012-6-14 14:36:13 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2012-6-14 14:36:13 org.apache.catalina.core.StandardContext start
严重: Context [/Test] startup failed due to previous errors

67,547

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧