aspose file tools*
The moose likes Struts and the fly likes Struts2 Start up error : org.apache.struts2.dispatcher.FilterDispatcher java.lang.NullPointerExcept Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 Start up error : org.apache.struts2.dispatcher.FilterDispatcher java.lang.NullPointerExcept" Watch "Struts2 Start up error : org.apache.struts2.dispatcher.FilterDispatcher java.lang.NullPointerExcept" New topic
Author

Struts2 Start up error : org.apache.struts2.dispatcher.FilterDispatcher java.lang.NullPointerExcept

Nandan Jain
Ranch Hand

Joined: Feb 14, 2006
Posts: 44
Hi,
I am getting error when trying to deploy a simple jsp based struts 2 application on weblogic 9.2 (without weblogic.xml)

<Jan 19, 2009 12:57:59 PM IST> <Error> <HTTP> <BEA-101165> <Could not load user defined filter in web.xml: org.apache.struts2.dispatcher.FilterDispatcher.
java.lang.NullPointerException
at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:203)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyResultType(XmlConfigurationProvider.java:511)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addResultTypes(XmlConfigurationProvider.java:482)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:438)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:265)
Truncated. see log file for complete stacktrace

can anyone help me ?

Following are the entries in web.xml file :


><?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

<display-name>EMP Deployment Descriptor</display-name>

<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter>
<filter-name>struts-cleanup</filter-name>
<filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts-cleanup</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>welcome.jsp</welcome-file>
</welcome-file-list>
</web-app>

Thanks.
Nandan
Omar Al Kababji
Ranch Hand

Joined: Jan 13, 2009
Posts: 357
from the print stack is obvious that its trying to initialize a filter of this class type

org.apache.struts2.dispatcher.FilterDispatcher


and it dosen't find it, so check if you have these class in your project, it may be because you are missing some jars in your application, normally this class should be inside the struts core jar so if you don't have this jar try to add it to your libs directory ;)


(peace)


Omar Al Kababji - Electrical & Computer Engineer
[SCJP - 90% - Story] [SCWCD - 94% - Story] [SCBCD - 80% - Story] | My Blog
Nandan Jain
Ranch Hand

Joined: Feb 14, 2006
Posts: 44
Actually above error is occuring because of spring jars. I have many spring jars which I got when I downloaded struts2 framework from net. Because I had not been using any of the spring related api, it was throwing that error. After deletion of those jars I was able to run it.
Nandan Jain
Ranch Hand

Joined: Feb 14, 2006
Posts: 44
One more thing, Struts-cleanup filter must be defined before Struts2 filter :

<filter>
<filter-name>struts-cleanup</filter-name>
<filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
</filter>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts-cleanup</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
jazy smith
Ranch Hand

Joined: Nov 18, 2009
Posts: 101
Hi Nandan,

I have the same prob as you had. I tried to delete the struts2-spring related jar files. and try to make the cleanup filter before action filter as you said. But still it is throwing exception. org.apache.dispatcher.filterdispatcher not found....

well, my question is , logically if the jars are not used by the application why should JRE throw exception ? I mean application should only look at the jars that are needed. If the some extra jars are there, the application should have nothing to do with that right ?

Please correct me if I am wrong

thanks
krishna kmk
Greenhorn

Joined: Jul 16, 2012
Posts: 1
hi all


i got a this same problem when i deploy the struts2 application with following code in web.xml.


<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml,classpath*:/META-INF/spring/*.xml</param-value>
</context-param>
<filter>
<filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
<filter-class>
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
</filter-class>
</filter>

<filter-mapping>
<filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>


i resolved this problem as follows



web.xml

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml,classpath*:/META-INF/spring/*.xml</param-value>
</context-param>
<filter>
<filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
<filter-class>
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
</filter-class>
</filter>

<filter-mapping>
<filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>

<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>

</web-app>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts2 Start up error : org.apache.struts2.dispatcher.FilterDispatcher java.lang.NullPointerExcept
 
Similar Threads
Struts2 dojo not working on RAD7 WS6.1
Struts2 Action problem Problem
web.xml problem in struts2
Struts2 FilterDispatcher Error
interceptor problem in struts2