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" /> |
struts2启动报错com/opensymphony/xwork2/spring/SpringObjectFactory.java:220:-1的更多相关文章
- Line: 220 - com/opensymphony/xwork2/spring/SpringObjectFactory.java:220:-1
转自:http://blog.51cto.com/alinazh/1276363 在启动tomcat的时候出现错误: Line: 220 - com/opensymphony/xwork2/sprin ...
- com/opensymphony/xwork2/spring/SpringObjectFactory.java:220:-1问题出现的原因及解决办法
转自:https://blog.csdn.net/shinchan_/article/details/37818927 com/opensymphony/xwork2/spring/SpringObj ...
- SSH框架环境搭建问题:Line: 230 - com/opensymphony/xwork2/spring/SpringObjectFactory.java:230:-1
只是通过myeclipse搭建一个框架而已 启动tomcat时报错信息: File: SpringObjectFactory.java Method: getClassInstance Line: 2 ...
- 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 C ...
- XAMPP里tomcat启动报错:Make sure you have Java JDK or JRE installed and the required ports are free
以前用XAMPP的时候就是自然而然装好了就可以用,最近重装了新系统,打算在Windows 10里面配置Apache tomcat.PHP.MySQL的开发环境,迟迟试验不成功,于是直接用了XAMPP, ...
- 解决Eclipse启动报错【Failed to create the Java Virtual Machine】
电脑:2G内存,WIN7 32位. 启动adt-bundle-windows-x86-20140702\eclipse\eclipse.exe时,报错[Failed to create the Jav ...
- 关于myeclipse启动报错:An internal error has occurred. java.lang.NullPointerException解决办法
启动myeclipse报错,百度了一下网友处理方式,对比日志,发现现在已有的教程真的是巨人坑: 如果出现了上述的错误按照如下的3个步骤解决:1.首先关闭MyEclipse工作空间.2.然后删除工作空间 ...
- eclipse启动报错:Could not create the java virtual machine
用maven.springboot开发时,安装了当时最新版的eclipse(3.5.5).eclipse解压版的非常方便,想先安装了看看.暂时没有升级其他软件. 打开的时候报错: 原因其实就是还木有升 ...
- eclipse启动报错eclipse failed to create the java virutal machine
早上一来,我的eclipse就无法启动了,错误就是这句话: eclipse failed to create the java virutal machine 直译就是eclipse无法创建JAVA虚 ...
随机推荐
- jquery checkBox的问题
在新版的jquery中选择ckeckbox最好使用prop方法,否则会出现一些问题.比如手动点击取消,再使用代码全选或者反选时候就不好使啦!!!
- ES6学习笔记(九)
1.概述 ES5的对象属性名都是字符串,这容易造成属性名的冲突.比如,你使用了一个他人提供的对象,但又想为这个对象添加新的方法(mixin模式),新方法的名字就有可能与现有方法产生冲突.如果有一种机制 ...
- linux关闭服务的方法
本文介绍下,在linux下关闭服务的方法,主要学习chkconfig的用法,有需要的朋友参考下. 先来看一个在linux关闭服务的例子,例如,要关闭sendmail服务,则可以按如下操作. 例1, 复 ...
- MySQL Connector Net连接vs2012问题
最近做一.NET项目,数据库用到MySQL,可是在VS2012连接数据库是遇到问题,提示:Authentication with old password no longer supported, u ...
- PhantomJS实现最简单的模拟登录方案
以前写爬虫,遇到需要登录的页面,一般都是通过chrome的检查元素,查看登录需要的参数和加密方法,如果网站的加密非常复杂,例如登录qq的,就会很蛋疼 在后面,有了Pyv8,就可以把加密的js文件扔给它 ...
- C语言的32个关键字
由ANSI标准定义的C语言关键字共个: auto double int struct break else long switch case enum register typedef char ex ...
- 使用NPIO操作Excel
using System; using System.Collections.Generic; using System.Linq; using System.Text; using NPOI.SS. ...
- Linux C程序的编译过程
Linux C程序的编译过程 学习一门语言程序,本人觉得还是得学习它的编译规则,现在,通过小例子小结下自己对C编译的认识. /*test.c 了解C程序的编译*/ #include <s ...
- ASP.NET如何获取根目录的方法汇总
编写程序的时候,经常需要用的项目根目录,自己总结如下: 1.取得控制台应用程序的根目录方法 方法1.Environment.CurrentDirectory 取得或设置当前工作目录的完整限定路径 方法 ...
- Xcode8 重新配置 CocoaPods -替换阿里源
一.CocoaPods是什么? CocoaPods是一个负责管理iOS项目中第三方开源库的工具.CocoaPods的项目源码在Github上管理.该项目开始于2011年8月12日,在这两年多的时间里, ...