知也atitit.解决struts2 SpringObjectFactory.getClassInstance NullPointerException v2 q31无涯 - I
atitit.解决struts2 SpringObjectFactory.getClassInstance NullPointerException v2 q31
1. #--现象 java.lang.NullPointerException1
1. #--现象 java.lang.NullPointerException
at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance
com.opensymphony.xwork2.spring.SpringObjectFactory nullpointexcept.txt
九千一满好直了,猛个腊擦走不行兰.
作者 老哇的爪子 Attilax 艾龙, EMAIL:1466519819@qq.com
转载请注明来源: http://blog.csdn.net/attilax
2. #----原因
maybe hb err...so .spr error .so ket...rej to ekshen...
can run sprutil...test
3. #---别的原因
1.原因是加多了一个包(jar冲突),把这个包删除就可以了
struts2-spring-plugin-2.0.11.jar
2.短了struts2-spring-plugin-2.0.11.jar
3.webxml 没配置spring action的listen
4. Spring的加载机制
<!-- 加载数据库中所有公用数据到缓存中 -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
SpringObjectFactory.getClassInstance 是从classloader黑头load class的..
public Class getClassInstance(String className)
throws ClassNotFoundException {
Class clazz = null;
if (this.useClassCache) {
synchronized (this.classes) {
clazz = (Class) this.classes.get(className);
}
}
if (clazz == null) {
if (this.appContext.containsBean(className))
clazz = this.appContext.getBean(className).getClass();
else {
clazz = super.getClassInstance(className);
}
if (this.useClassCache) {
synchronized (this.classes) {
this.classes.put(className, clazz);
}
}
}
return clazz;
}
5. 参考
tomcat6启动出现的错误 Exception starting filter struts com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance - Chark-程序员BOLG - 博客频道 - CSDN.NET.htm
struts2启动报错com opensymphony xwork2 spring SpringObjectFactory.java 220 -1 - 吾生也有涯,而知也无涯 - ITeye技术网站.htm