• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

The Struts dispatcher cannot be found error

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.

I just try to migrate struts.. and get this
Error.......
The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag.

how can i overcome this?

thanks
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I think I've got the same problem.
I have just started working with struts2, so I am not very good at it.
Still i think you need to write about that dipatcher in the web.xml file if do not have it already written.



So, it'll find the filter dispatcher.

As far as my problem is concerned, when I start tomcat and view my site on localhost, it's working properly until I need an action class. And at that point I get the error "The Struts dispatcher cannot be found"
Then I found out that eclipse had deleted my web.xml (or I do not know where it has vanished)..
I rewrote it again (web.xml) and put in the WEB-INF folder again, but now I cannot start my site.. not even the index.html page.

"requested resource is not available"..

Any ideas?
 
Lela Latsoshvili
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Found
my mistake..
I had mistake in struts.xml
 
Harshani Wickramarathna
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Samurai,

Thanks 4 the reply. But I have put that code you have given in the web.xml
but it didn't work..!!

Anyway thanks again

Do you have any idea about migtating struts1 application to struts2?
If so please let me know..

Harshani
 
Lela Latsoshvili
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Harshani,

These articles seem quite interesting to me..
Migrating Struts Apps to Struts 2

and here is a good tutorial for Struts2 from roseindia.net
Struts 2 tutorial
 
Harshani Wickramarathna
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much Samurai...

 
Lela Latsoshvili
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good luck

p.s. it's me again
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Change the filter as follows and the <url-pattern>/*</url-pattern> should be /* and it should work.

<filter>
<filter-name>struts-filter</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>stuts-filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just started with struts, and facing the same problem as Lela.
Any suggestions ?
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
FilterDispatcher not found error details ;

This error is happening because of container is unable to find the relevant class StrutsPrepareAndExecuteFilter.class & FilterDispatcher.class respectively
after reading the Deployment Descriptor.

Make the above class available to the container you must copy the strut2-core.jar into the lib directory under WEB_INF Folder. You can easily find the above
two classes into these packages org.apache.struts2.dispatcher.ng.filter & org.apache.struts2.dispatcher respectively, that is available into the JAR file.
[ Unjar the strut2-core.jar file to see these package ]

**************************************************************************************************************************************

And there are no difference at all in these two element both do same thing. Both elements are just a convention to map our request towards the Strut Framework.
Both abs works fine with me. But yes d only one difference is there ;

// Deprecated since Strut 2.1.3 to split-up the dispatcher phases. But still working
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>

So, we must follow the new convention written below thts it
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>

Tested with Apache-Tomcat on Eclipse IDE

Hope everything is clear by now !!!
 
Greenhorn
Posts: 1
Netbeans IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kr. Gaurav wrote:FilterDispatcher not found error details ;

This error is happening because of container is unable to find the relevant class StrutsPrepareAndExecuteFilter.class & FilterDispatcher.class respectively
after reading the Deployment Descriptor.

Make the above class available to the container you must copy the strut2-core.jar into the lib directory under WEB_INF Folder. You can easily find the above
two classes into these packages org.apache.struts2.dispatcher.ng.filter & org.apache.struts2.dispatcher respectively, that is available into the JAR file.
[ Unjar the strut2-core.jar file to see these package ]

**************************************************************************************************************************************

And there are no difference at all in these two element both do same thing. Both elements are just a convention to map our request towards the Strut Framework.
Both abs works fine with me. But yes d only one difference is there ;

// Deprecated since Strut 2.1.3 to split-up the dispatcher phases. But still working
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>

So, we must follow the new convention written below thts it
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>

Tested with Apache-Tomcat on Eclipse IDE

Hope everything is clear by now !!!



----------------------------------------
Thanks Gaurav.. great explanation !!
 
Ranch Hand
Posts: 96
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Gaurav,
I have put the struts2-core-2.0.11 jar in the lib directory under WEB-INF directory. I have also declared the dispatcher in my web.xml, which I have put along with the WEB-INF directory, as it should be.



I still get that error.
Can you please suggest why this is happening?

I've been stuck up at this place for several days now. Please help!!
 
Souvvik Basu
Ranch Hand
Posts: 96
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Found my error.....

Was placing the web.xml file outside the WEB-INF directory
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting this error although my web app was working fine when I went to bed. Shut down my laptop and when I woke up I started getting a 404 not found. I had to remove the web app from the server in eclipse and then I got this error. I have the struts-core jar file in web-inf and my web.xml file looks like this:



To me, this is inconsistent behavior. I'm not sure what the problem could be but it is disheartening to say the least.

Edit: I changed the filter-class to the FilterDispatcher and now the page loads fine. I'm still wondering why if someone could shed some light, I'd really appreciate it.
 
Ranch Hand
Posts: 38
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Benjamin,
in your code, you have used "org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter" which is a new Dispatcher available in struts2. It may have some dependencies (like additional .jar files other than struts-core). If you are using newer features of Struts2 they requires few extra jars and yes they required newer versions. so while creating struts applications, you should always have all required libraries.
 
Benjamin Pope
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. Any idea as to why I received the 404 not found error when it was just working the night before and all I did was shutdown my laptop? I am noticing that it also is happening as I make changes to the struts.xml config file. Once I make a change, the whole site becomes unavailable.

Edit: I think I solved the problem. It seems to be an eclipse problem, not a struts problem. I was cleaning the tomcat working directory and also trying to clean the project by right clicking the server and clicking clean, but this was not working. When I used the Projects menus at the top of the ide, the problem was corrected.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Lela Latsoshvili

what is the error in struts.xml file.

i too getting the same error. which you told

please tell me...

 
reply
    Bookmark Topic Watch Topic
  • New Topic