`
isy
  • 浏览: 103248 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类

java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextAw

    博客分类:
  • java
阅读更多

最近整理了struts常用的jar包和配置文件,新建项目习惯性的把整个文件夹拷贝进去,启动tomcat报如下错误:

 

 

Unable to load configuration. - bean - jar:file:/D:/WIN7/apache-tomcat-6.0.26/webapps/DoAjax/WEB-INF/lib/struts2-spring-plugin-2.1.8.1.jar!/struts-plugin.xml:29:132
 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
 at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
 at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
 at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
 at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
 at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
 at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
 at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3838)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4488)
 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:546)
 at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)
 at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)
 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
 at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
 at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
 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:519)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
 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:289)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: Unable to load bean: type:com.opensymphony.xwork2.ObjectFactory class:org.apache.struts2.spring.StrutsSpringObjectFactory - bean - jar:file:/D:/WIN7/apache-tomcat-6.0.26/webapps/DoAjax/WEB-INF/lib/struts2-spring-plugin-2.1.8.1.jar!/struts-plugin.xml:29:132
 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:221)
 at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
 at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:169)
 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
 ... 31 more
Caused by: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextAware
 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:2527)
 at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1010)
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1483)
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
 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:2527)
 at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1010)
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1483)
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
 at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:138)
 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:192)
 ... 34 more
Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContextAware
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
 ... 51 more
2010-5-16 23:44:47 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter struts2
Unable to load configuration. - bean - jar:file:/D:/WIN7/apache-tomcat-6.0.26/webapps/DoAjax/WEB-INF/lib/struts2-spring-plugin-2.1.8.1.jar!/struts-plugin.xml:29:132
 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:431)
 at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
 at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
 at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
 at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
 at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
 at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3838)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4488)
 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:546)
 at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)
 at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)
 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
 at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
 at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
 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:519)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
 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:289)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: Unable to load configuration. - bean - jar:file:/D:/WIN7/apache-tomcat-6.0.26/webapps/DoAjax/WEB-INF/lib/struts2-spring-plugin-2.1.8.1.jar!/struts-plugin.xml:29:132
 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
 at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
 ... 29 more
Caused by: Unable to load bean: type:com.opensymphony.xwork2.ObjectFactory class:org.apache.struts2.spring.StrutsSpringObjectFactory - bean - jar:file:/D:/WIN7/apache-tomcat-6.0.26/webapps/DoAjax/WEB-INF/lib/struts2-spring-plugin-2.1.8.1.jar!/struts-plugin.xml:29:132
 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:221)
 at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
 at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:169)
 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
 ... 31 more
Caused by: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextAware
 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:2527)
 at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1010)
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1483)
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
 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:2527)
 at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1010)
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1483)
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
 at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:138)
 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:192)
 ... 34 more
Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContextAware
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
 at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
 ... 51 more
2010-5-16 23:44:47 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2010-5-16 23:44:47 org.apache.catalina.core.StandardContext start
严重: Context [/DoAjax] startup failed due to previous errors

 关键是这行"java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextAware",让我很是困惑,没用到spring框架出找不到spring类的问题,仔细检查配置文件和jar包,发现没有用到的插件包struts2-spring-plugin-2.1.8.1.jar在lib目录里,去掉一切正常.

 

添加此jar包启动服务时会自动寻找spring监听器和配置文件,没有用到spring框架还是不要引入的好,免得麻烦.

2
1
分享到:
评论
1 楼 dhy9836 2013-02-20  
一言惊醒梦中人啊,就是这个问题!!!

相关推荐

    java.lang.NoClassDefFoundError:

    Exceptions sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory...

    lib-springMVC

    java.lang.NoClassDefFoundError: org/springframework/context/EnvironmentAware 1 2 继续加入 spring-context-4.x.x.RELEASE.jar 1 2 接着报错 java.lang.NoClassDefFoundError: org/springframework/core/env/...

    springAOP demo 带错误解决文档

    在搭建spring项目时通常需要这些jar包 ... at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70) 由于缺少依赖包 aspectjweaver-1.6.12.jar ...

    Exception in thread main java.lang.NoClassDefFoundError错误解决方法

    `Exception in thread "main" java.lang.NoClassDefFoundError` 是Java编程中常见的一个运行时异常,通常发生在尝试运行一个Java程序时,如果JVM找不到在类路径(ClassPath)中定义的主要类(主类,即包含`public ...

    SSH整合常见错误总结

    #### 一、Java.lang.NoClassDefFoundError: org/hibernate/context/CurrentSessionContext **问题描述**:在启动应用时遇到`java.lang.NoClassDefFoundError: org/hibernate/context/CurrentSessionContext`异常。 ...

    Java技术问答(带链接)

    根据提供的文件信息,我们可以归纳出一系列与Java及周边技术相关的知识点。下面将对这些知识点进行详细阐述: ### Java基础知识 1. **Java基础类型** - **boolean**: 用于存储逻辑值,即`true`或`false`。 - **...

    spring mvc 项目错误,和一些配置

    java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener - **原因**:这个异常表示Spring的核心库未被正确加载。 - **解决办法**: - 确认Spring框架的相关jar包已被添加至...

    com.springsource.org.objectweb.asm-3.2.0.jar

    严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error ...

    MyEclipse报错说明

    1. **java.lang.NoClassDefFoundError:org/hibernate/context/CurrentSessionContext** 这个错误通常意味着在类路径(classpath)中缺少了必要的Hibernate库或其版本不兼容。原因为开发环境中的Hibernate版本为3.1...

    SSH整合项目中容易出现的错误

    5. jsf+spring+hibernate 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory....

    第一个spring IOC例子(maven)

    注: applicationContext.xml 配置bean信息所依赖的class路径要一致且大小写敏感,否则运行时会出现java.lang.NoClassDefFoundError (wrong name)。 https://blog.csdn.net/my_bkn/article/details/6875481

    S2SH整合报错

    ERROR main org.springframework.web.context.ContextLoader - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in ...

    easypoi导入导出excel表格.pdf

    - `java.lang.ClassNotFoundException:org.springframework.web.context.request.async.CallableProcessingInterceptor` 这些问题,可以通过添加或更新相应的Spring相关依赖来解决。 ### 常见的错误和解决方案 当...

    HIBERNATE4开发文档,HIBERNATE4的变化

    同时,需要在Hibernate配置中指定`current_session_context_class`为`org.springframework.orm.hibernate4.SpringSessionContext`。 2. **缓存配置的改变** - Hibernate4中,缓存提供商由旧的类名改为`...

    Quartz 框架快速入门

    如果在运行时遇到`java.lang.NoClassDefFoundError:javax/transaction/UserTransaction`错误,可以引入jta.jar来解决这个问题。 在Quartz中,每个任务称为一个Job,它必须实现`org.quartz.Job`接口。这个接口只有一...

    在学习中发现的一些ssh-error

    再者,如果在配置监听器时遇到`Error configuring application listener of class org.springframework.web.context.ContextLoaderListener`,可能是因为Eclipse在生成项目时遗漏了一些必要的Spring库。此时,应手动...

    ssm项目启动需要的jar包

    - `spring-context.jar`: 提供了应用上下文,它是Spring的核心,用于管理Bean的生命周期和依赖注入。 - `spring-webmvc.jar`: 包含了Spring MVC的相关实现,用于处理HTTP请求和响应。 - `spring-beans.jar`: 包含...

    hibernate需要的jar包

    - `spring-context.jar`、`spring-beans.jar`、`spring-aop.jar`、`spring-jdbc.jar`、`spring-tx.jar`等:SSH中的S代表Spring,这是一个全面的应用框架,提供了AOP(面向切面编程)、DI(依赖注入)等功能,与...

Global site tag (gtag.js) - Google Analytics