今天遇到了这个问题
严重: Exception starting filter struts2
Class: com.opensymphony.xwork2.spring.SpringObjectFactory
File: SpringObjectFactory.java
Method: getClassInstance
Line: 209 - com/opensymphony/xwork2/spring/SpringObjectFactory.java:209:-1
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:4072)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
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: java.lang.NullPointerException
at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:209)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyResultType(XmlConfigurationProvider.java:519)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addResultTypes(XmlConfigurationProvider.java:490)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:446)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:264)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:193)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
... 29 more
2013-4-16 20:41:42 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2013-4-16 20:41:42 org.apache.catalina.core.StandardContext start
严重: Context [/Book1] startup failed due to previous errors
2013-4-16 20:41:42 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
严重: The web application [/Book1] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@607135]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@1a88001]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
2013-4-16 20:41:42 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
严重: The web application [/Book1] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@18532dc]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@1ce1387]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
2013-4-16 20:41:43 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory docs
2013-4-16 20:41:43 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory EasyBuySystem
2013-4-16 20:41:44 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory examples
2013-4-16 20:41:44 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2013-4-16 20:41:44 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
2013-4-16 20:41:44 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory ROOT
2013-4-16 20:41:45 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2013-4-16 20:41:45 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2013-4-16 20:41:45 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/32 config=null
2013-4-16 20:41:45 org.apache.catalina.startup.Catalina start
信息: Server startup in 7968 ms
其实之前也遇到了这个问题 突然间想到了是没有在web里配置spring支持
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<!-- 配置监听 -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
加上这句话就好了
一时的粗心导致错误!与大家分享一哈哈哈
<wbr></wbr>
分享到:
相关推荐
* Exception starting filter struts2 Class: com.opensymphony.xwork2.spring.SpringObjectFactory + 解决方案:检查 Struts2 的配置文件是否正确,是否存在语法错误或格式不正确的问题。 * org.springframework....
Exception starting filter struts2: Class: com.opensymphony.xwork2.spring.SpringObjectFactory** - **异常描述**:启动过滤器时出现异常。 - **原因分析**:通常是因为Struts2配置错误或类路径问题。 - **解决...
首先,你需要在Struts2的配置文件(通常为`struts.xml`)中定义Action类,这里Action类应继承自Spring提供的`org.springframework.web.struts2.SpringAware`或`com.opensymphony.xwork2.spring.SpringObjectFactory`...
但整合后,Action实例由Spring容器创建并管理,通过`<action>`标签的`class`属性设置为`com.opensymphony.xwork2.spring.SpringObjectFactory`,使得Struts2能从Spring容器获取Action实例。 4. **AOP结合**:Spring...
Struts2 和 Spring 的整合是Java Web开发中的常见实践,这两种框架的结合可以极大地提高应用的可维护性和灵活性。在本文中,我们将深入探讨如何实现Struts2与Spring的集成,以及利用拦截器来增强应用的功能。 首先...
5. **Action类设计**:Action类通常需要继承自`org.springframework.web.struts2.support.SpringAware`或`com.opensymphony.xwork2.spring.SpringObjectFactory`,以便于Struts2能够利用Spring的IoC容器找到并实例化...
3. **Action 类**:Action 类应继承自 Spring 提供的 `org.springframework.web.struts2.SpringAware` 或 `com.opensymphony.xwork2.spring.SpringObjectFactory` 类,这样 Struts2 就可以识别并利用 Spring 容器来...
5. **Action和Service**:编写Action类,通常需要实现`com.opensymphony.xwork2.ActionSupport`接口,并使用`@Autowired`注解从Spring容器中获取服务。服务层(Service)则负责业务逻辑。 ```java public class ...
<constant name="struts.objectFactory" value="com.opensymphony.xwork2.spring.SpringObjectFactory"/> <package name="default" extends="struts-default"> <interceptor-stack name="guiceStack"> ...
在本文中,我们将探讨如何搭建一...<bean type="com.opensymphony.xwork2.spring.SpringObjectFactory" id="strutsSpringObjectFactory"> <property name="applicationContext" ref="applicationContext"/> </bean> ...
2. **配置Struts**:在`struts.xml`中,需要将Action配置为Spring管理的Bean,通常使用`<action>`标签的`class`属性设置为`com.opensymphony.xwork2.spring.SpringObjectFactory# springspring-proxy`。这告诉Struts...