Struts2 Start Error Com/opensymphony/xwork2/spring/springobjectfactory.java:220:-1

Source: Internet
Author: User

Long time no struts2, today configuration strut2.2.1, startup encountered a small problem. Recorded.

Tomcat Startup error:

123456789101112131415161718192021222324252627 Class: com.opensymphony.xwork2.spring.SpringObjectFactoryFile: SpringObjectFactory.javaMethod: getClassInstanceLine: 220- com/opensymphony/xwork2/spring/SpringObjectFactory.java:220:-1    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:428)    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.start(ContainerBase.java:1045)    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:585)    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:220)

Principle:

View the Strtus-plugin.xml in the Struts2 plug-in Struts2-spring-plugin

123456789101112131415161718 <struts>    <beantype="com.opensymphony.xwork2.ObjectFactory"name="spring"class="org.apache.struts2.spring.StrutsSpringObjectFactory"/>        <!--  Make the Spring object factory the automatic default -->    <constantname="struts.objectFactory"value="spring"/>     <constantname="struts.class.reloading.watchList"value=""/>    <constantname="struts.class.reloading.acceptClasses"value=""/>    <constantname="struts.class.reloading.reloadConfig"value="false"/>    <packagename="spring-default">        <interceptors>            <interceptorname="autowiring" class="com.opensymphony.xwork2.spring.interceptor.ActionAutowiringInterceptor"/>            <interceptorname="sessionAutowiring"class="org.apache.struts2.spring.interceptor.SessionContextAutowiringInterceptor"/>        </interceptors>    </package>   </struts>

Note The following section, indicating that the plug-in was introduced into the project, and that the struts Objectfactory is automatically set to Strutsspringobjectfactory, allowing spring's IOC container to host the struts action. So it caused the startup problem.

123 <bean type="com.opensymphony.xwork2.ObjectFactory"name="spring" class="org.apache.struts2.spring.StrutsSpringObjectFactory" /><!--  Make the Spring object factory the automatic default --><constant name="struts.objectFactory" value="spring"/> 

Struts2 Start Error com/opensymphony/xwork2/spring/springobjectfactory.java:220:-1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.