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虚 ...
随机推荐
- python学习之html从0开始(二)
<!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content ...
- php 微信开发之 微信支付 V3 开发 -CURLOP_TIMEOUT问题
如果不懂怎么配置的话请看文章 php 微信开发之 微信支付配置 基本配置后在继续本文章的开发 . 本文章就先继续基本的实现!也并不困难.我大概的思路的返回购买者的唯一id 和 订单号的唯一 id 就2 ...
- uniquery 在win2008 下hold的问题。
TmpQry.ReadOnly := True; 加上这句解决,原因未知!
- sublime text2 配置php调试环境
步骤一: 首先确保你电脑安装了php,并把php设置到环境变量里了. 步骤二: 点击 sublime_text的“工具”->"编译系统"->"编译新系统&qu ...
- butterknife7.0.1使用
1.官网:http://jakewharton.github.io/butterknife/ Introduction Annotate fields with @Bind and a view ID ...
- MySQL创建数据库[保存mojo格式的数据库]已经常用的utf8格式数据库
一.创建最新编码utf8mb4格式的库: CREATE DATABASE IF NOT EXISTS yourdbname CHARACTER SET utf8mb4 COLLATE utf8mb4_ ...
- SQL Server数据库备份(异机)
简单的远程异机备份数据库功能,通过这个存储过程,讲远程其他机器上的数据库备份到本地.其主要原理为: 1.通过XP_CMDSHELL执行Windows命令,将本机的共享目录映射为远程机器的网络驱动器. ...
- 【BZOJ3262】 陌上花开
Description 有n朵花,每朵花有三个属性:花形(s).颜色(c).气味(m),又三个整数表示.现要对每朵花评级,一朵花的级别是它拥有的美丽能超过的花的数量.定义一朵花A比另一朵花B要美丽,当 ...
- sql之表的表达式
1.派生表 实质:就是特殊的子查询(将查询结果放在from后面) 含有一张Order表: 看下面的sql语句: select orderid,orderdate,custid from ( selec ...
- iOS 本地存储四种方法
在iOS开发过程中,不管是做什么应用,都会碰到数据保存的问题.将数据保存到本地,能够让程序的运行更加流畅,不会出现让人厌恶的菊花形状,使得用户体验更好.下面介绍⼀一下数据保存的方式: 1.NSKeye ...