Severe: Dispatcher initialization failed
Unable to load configuration. -action-file:/D:/Apache % 20 Software % 20 Foundation/Tomcat % 206.0/webapps/structs2/WEB-INF/classes/struts. xml: 23: 79
At com. opensymphony. xwork2.config. ConfigurationManager. getConfiguration (ConfigurationManager. java: 58)
At org. apache. struts2.dispatcher. Dispatcher. init_PreloadConfiguration (Dispatcher. java: 374)
At org. apache. struts2.dispatcher. Dispatcher. init (Dispatcher. java: 418)
.
.
.
Unable to load configuration. Check whether the jar package is complete!
Besides
Commons-logging-1.0.4.jar
Freemarker-2.3.12.jar
Ognl-2.6.11.jar
Struts2-core-2.1.8.jar
Xwork-2.1.1.jar
These five core lib files must be copied,
Load the following two lib
Commons-fileupload-1.2.1.jar
Commons-io-1.3.2.jar
In addition, pay attention to the problem with the original code!
Take a closer look at your error message
Unable to load configuration. -action-file:/D:/Apache % 20 Software % 20 Foundation/Tomcat % 206.0/webapps/structs2/WEB-INF/classes/struts. xml: 23: 79
It cannot load the struts. xml configuration here. You should carefully check the code of that file!
In my own example, the cause of the error is:
<? Xml version = "1.0" encoding = "GBK"?> <! DOCTYPE struts PUBLIC "-// Apache Software Foundation // DTD Struts Configuration 2.1.7 // EN "" http://struts.apache.org/dtds/struts-2.1.7.dtd "> <! -- Specify the root element of the Struts 2 configuration file --> <struts> <! -- Specify the global resource file --> <constant name = "struts. custom. i18n. resources" value = "mess"/> <! -- Specify the character set used for international encoding --> <constant name = "struts. i18n. encoding" value = "UTF-8"/> <! -- If the name of constant is set to devMode, it indicates that the configuration file is in development mode. value = true indicates that the configuration file content is automatically replaced by hot replacement, and does not need to be released every time. --> <constant name = "struts. devMode "value =" true "/> <! -- All Action definitions should be placed under the package. In Struts2, actions are managed through the package, the package name here does not correspond to the package in the java class --> <package name = "wbb" namespace = "/" extends = "struts-default"> <action name = "loginPro" class = "w_basketboy.ajax.action.LoginAction"> <result name = "success" type = "stream"> <param name = "contentType">/html </param> <param name = "inputName"> result </param> </result> <result name = "login"> login. jsp </result> </action> </package> <pa Ckage name = "wbb" extends = "json-default"> <action name = "JSONExample" class = "w_basketboy.ajax.action.JSONExample"> <! -- Configure json Result --> <result type = "json"> <! -- Specify the parameter --> <param name = "noCache"> true </param> <param name = "contentType"> text/html </param> </Result> </action> <action name = "*"> <result>/{1 }. jsp </result> </action> </package> </struts> <? Xml version = "1.0" encoding = "GBK"?> <! DOCTYPE struts PUBLIC "-// Apache Software Foundation // DTD Struts Configuration 2.1.7 // EN "" http://struts.apache.org/dtds/struts-2.1.7.dtd "> <! -- Specify the root element of the Struts 2 configuration file --> <struts> <! -- Specify the global resource file --> <constant name = "struts. custom. i18n. resources" value = "mess"/> <! -- Specify the character set used for international encoding --> <constant name = "struts. i18n. encoding" value = "UTF-8"/> <! -- If the name of constant is set to devMode, it indicates that the configuration file is in development mode. value = true indicates that the configuration file content is automatically replaced by hot replacement, and does not need to be released every time. --> <constant name = "struts. devMode "value =" true "/> <! -- All Action definitions should be placed under the package. In Struts2, actions are managed through the package, the package name here does not correspond to the package in the java class --> <package name = "wbb" namespace = "/" extends = "struts-default"> <action name = "loginPro" class = "w_basketboy.ajax.action.LoginAction"> <result name = "success" type = "stream"> <param name = "contentType">/html </param> <param name = "inputName"> result </param> </result> <result name = "login"> login. jsp </result> </action> </package> <pa Ckage name = "wbb" extends = "json-default"> <action name = "JSONExample" class = "w_basketboy.ajax.action.JSONExample"> <! -- Configure json Result --> <result type = "json"> <! -- Specify the parameter --> <param name = "noCache"> true </param> <param name = "contentType"> text/html </param> </Result> </action> <action name = "*"> <result>/{1 }. jsp </result> </action> </package> </struts>
The names of the two packages are the same. The name attribute in the package is equivalent to the id and cannot be duplicated. change one of the two packages to another value.