struts2启动报错com/opensymphony/xwork2/spring/SpringObjectFactory.java:220:-1

好久没有搞struts2,今天配置strut2.2.1,启动时遇到个小问题。记录下。

tomcat启动报错:


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

Class: com.opensymphony.xwork2.spring.SpringObjectFactory

File: SpringObjectFactory.java

Method: getClassInstance

Line: 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)

原理:

查看struts2插件struts2-spring-plugin中的strtus-plugin.xml


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

<struts>

    <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" />

    <constant name="struts.class.reloading.watchList" value="" />

    <constant name="struts.class.reloading.acceptClasses" value="" />

    <constant name="struts.class.reloading.reloadConfig" value="false" />

    <package name="spring-default">

        <interceptors>

            <interceptor name="autowiring" class="com.opensymphony.xwork2.spring.interceptor.ActionAutowiringInterceptor"/>

            <interceptor name="sessionAutowiring" class="org.apache.struts2.spring.interceptor.SessionContextAutowiringInterceptor"/>

        </interceptors>

    </package>   

</struts>

注意下面部分,表明该插件引入工程后,会自动设置Struts的ObjectFactory为StrutsSpringObjectFactory,从而让Spring的IOC容器来托管Struts的Action。所以导致了启动的问题。


1

2

3

<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" /> 

时间: 2024-10-25 01:23:12

struts2启动报错com/opensymphony/xwork2/spring/SpringObjectFactory.java:220:-1的相关文章

at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:209)

Class: com.opensymphony.xwork2.spring.SpringObjectFactoryFile: SpringObjectFactory.javaMethod: getClassInstanceLine: 209 - com/opensymphony/xwork2/spring/SpringObjectFactory.java:209:-1Caused by: java.lang.NullPointerException  at com.opensymphony.xw

struts2启动报错:ERROR com.opensymphony.xwork2.conversion.impl.DefaultConversionPropertiesProcessor - Conversion registration error

[framework] 2019-12-05 11:34:05,441 - org.springframework.web.context.ContextLoader -5352 [RMI TCP Connection(3)-127.0.0.1]INFO org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 5349 ms timer appl

Tomcat启动报错:严重: StandardServer.await: create[8005] java.net.BindException: Cannot assign requested address

org.apache.catalina.core.StandardServer await        SEVERE: StandardServer.await: create[8005]:        java.net.BindException: Cannot assign requested address java.net.BindException: Cannot assign requested address        at java.net.PlainSocketImpl

解决Eclipse启动报错【Failed to create the Java Virtual Machine】

电脑:2G内存,WIN7 32位. 启动adt-bundle-windows-x86-20140702\eclipse\eclipse.exe时,报错[Failed to create the Java Virtual Machine].点确定后,Eclipse自动关闭 解决方法如下: 修改Eclipse目录下的配置文件[eclipse.iniadt-bundle-windows-x86-20140702\eclipse\eclipse.ini] 将下面两个值改为原来的0.5倍,然后保存,重新启

Jmeter启动报错:Not able to find Java executable or version. Please check your Java installation

启动高版本的jmeter5.0报错,如下图: 解决方案: 1.配置jmeter环境,修改path:%SystemRoot%\system32;%SystemRoot%; 添加在最前面 2.jmeter.bat文件前面加上以上两句: SET JAVA_HOME=C:\Program Files\Java\jdk1.7.0_51 (jdk路径)SET PATH=%SystemRoot%/system32;%SystemRoot%;%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin

eclipse启动报错eclipse failed to create the java virutal machine

早上一来,我的eclipse就无法启动了,错误就是这句话: eclipse failed to create the java virutal machine 直译就是eclipse无法创建JAVA虚拟机. 问题解决思路: 1.确保java虚拟机是已经正常运行的. 2.确保JAVA_HOME的环境变量是正确设置的. 3.检查eclipse的启动配置项eclipse.ini --------------------------------------------------------------

jmeter安装启动报错:Not able to find Java executable or version. Please check your Java installation

1.xp安装jmeter后启动,出现下面错误,找了很多方法试了,都没有用: 2.最后找到一个方法解决了[感谢无名大神],在环境变量PATH中添加:%SystemRoot%/system32;%SystemRoot%; 3.可以正常启动了: 'findstr' 不是内部或外部命令,也不是可运行的程序或批处理文件.Not able to find Java executable or version. Please check your Java installation.errorlevel=2请

【问题解决方案】之 jmeter启动报错:Not able to find Java executable or version. Please check your Java installation

故事发生在云计算实验课上-- ** 故事发生在云计算实验课上-- Step 1 在Xshell中登录自己的cloud虚拟机后,<sudo su ->切换到root用户 Step 2 <~/tpcw/apache-tomcat-8.5.23/bin/startup.sh>启动虚拟机装好的TPC-W(an e-commerce website, which supports online shopping and payment) Step 3 Download Apache Jmet

Tomcat启动报错[org.apache.struts2.dispatcher.Dispatcher]Dispatcher initialization failed

Tomcat启动报错: [org.apache.struts2.dispatcher.Dispatcher]Dispatcher initialization failed Unable to load configuration. - bean - jar:file:/E:/SoftwareDevelopment/Software/Eclipse4.3/eclipse-jee-kepler-SR1-win32-x86_64/Workspace/.metadata/.plugins/org.ec