Tuesday, 3 December 2013

Dispatcher initialization failed in struts2.2

As we know that struts2 is most popular framework among developers because it is extensible and elegant for development of enterprise web application. It is very far differ from struts 1.2.

Why Struts2?
  1. It is extensible
  2. It has built AJAX theme support.
  3. It has in built support for il8n.
  4. It has extensive validations support
  5. Struts2 interceptor
  6. It classes/interface are spring friendly so easy to integrate
  7. Any other framework/plugin easy to integrate
  8. It is based on MVC2 architecture
  9. Struts2 UI support
  10. Easy to learn and configure the project
  11. Support annotation based configuration (eliminate XML configuration)
  12. Simplified testability
  13. Template support like Velocity, Freemarker
  14. Multiple view options like Velocity, Freemarker ,JSP, XML ,JSON etc
  15. Thread safe
Struts2 request Life cycle
  1. User sends a request
  2. Request first goes to FilterDispatcher and it determine the appropriate action
  3. Interceptor applies before/after request/response
  4. Then execute the action
  5. Rendering the output
  6. Return the response
  7. Display result to user
When we are configuration/doing project in struts2 so we might be find some error, which I would like to cover as below:

Dispatcher initialization failed in struts2.2

If you have faced the following error so you are coming to right place.
ERROR [Dispatcher] Dispatcher initialization failed
Unable to load configuration. – action – vfsfile:/Your Drive:/Your Path/jboss-5.1.0.GA/server/default/deploy/Struts2Quartz.war/WEB-INF/classes/struts.xml:12:52

Solution:

1. You have to check that have you included the following jar file.
  • antlr-2.7.6.jar
  •  commons-collections.jar
  •  commons-io-1.3.2.jar
  •  commons-logging-1.0.4.jar
  •  commons-logging-api-1.1.jar
  •  log4j-1.2.14.jar
  •  ognl-3.0.jar
  •  struts2-core-2.2.1.jar
  •  xwork-core-2.2.1.jar
 2. Make sure that if you did any wrong configuration in struts.xml file so it might also be a problem

<action name="testAction" class="com.aoiblog.action.HelloWorld">
</action>
But either there is not “HelloWorld” Action class in given package or Action class name is wrong so it may be complaining about an error.

If still you are facing this problem so just put down your problem detail in comment so i can able to help you.

MultiPartRequest Error during Struts2 File Upload

Unable to load bean org.apache.struts2.dispatcher.multipart.MultiPartRequest (jakarta) [unknown location]
If you are getting this error so you need to add the following JAR file in your project.
  • commons-fileupload.jar
  • commons-io.jar

struts-dojo-tags not found

Whenever you are using autocompleter and datetimepicker in Struts 2.2 so you might be face the following error .

1. Autocompleter and Datetimepicker not working in Struts 2
2. struts-dojo-tags not found

If yes , so you can get the solution of your problem.

1. Check that do you have include the "struts2-dojo-plugin-2.1.8.1.jar"  jar file in your class path?
2. Do you use the <sx:head> tag?

Example :

 <s:head theme="ajax"/>
 </head>

3. Check it your dojo jar is depolyed in your lib folder?

If you used this above given examples and still you are facing the problem so please free feel to ask me so I can solve your problem and also we can update the article.

If you want to get more examples for struts2 so you can click on JAVA Struts2 under category section.
Thanks to visit.

No comments:

Post a Comment