Struts2 running exception

Source: Internet
Author: User

I am using myeclipse blue8.6, new project-, right-click Project-, myeclipse-, add struts capabilities, and add them as the default options.

No problem.

Add an action and deploy and run the project.

An exception occurs after the result is added:

Severe: Dispatcher initialization failed
Unable to load configuration. -Action-file:/C:/program % 20 Files % 20 (x86)/Apache-Tomcat-6.0.26/webapps/struct2/WEB-INF/classes/struts. XML: 6: 53
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)
At org. Apache. struts2.dispatcher. Ng. initoperations. initdispatcher (initoperations. Java: 69)
At org. Apache. struts2.dispatcher. Ng. Filter. strutsprepareandexecutefilter. INIT (strutsprepareandexecutefilter. Java: 51)
At org. Apache. Catalina. Core. applicationfilterconfig. getfilter (applicationfilterconfig. Java: 295)
At org. Apache. Catalina. Core. applicationfilterconfig. setfilterdef (applicationfilterconfig. Java: 422)
At org. Apache. Catalina. Core. applicationfilterconfig. <init> (applicationfilterconfig. Java: 115)
At org. Apache. Catalina. Core. standardcontext. filterstart (standardcontext. Java: 3838)
At org. Apache. Catalina. Core. standardcontext. Start (standardcontext. Java: 4488)
At org. Apache. Catalina. Core. containerbase. addchildinternal (containerbase. Java: 791)
At org. Apache. Catalina. Core. containerbase. addchild (containerbase. Java: 771)
At org. Apache. Catalina. Core. standardhost. addchild (standardhost. Java: 546)
At org. Apache. Catalina. startup. hostconfig. deploydirectory (hostconfig. Java: 1041)
At org. Apache. Catalina. startup. hostconfig. deploydirectories (hostconfig. Java: 964)
At org. Apache. Catalina. startup. hostconfig. deployapps (hostconfig. Java: 502)
At org. Apache. Catalina. startup. hostconfig. Start (hostconfig. Java: 1277)
At org. Apache. Catalina. startup. hostconfig. lifecycleevent (hostconfig. Java: 321)
At org. Apache. Catalina. util. lifecyclesupport. firelifecycleevent (lifecyclesupport. Java: 119)
At org. Apache. Catalina. Core. containerbase. Start (containerbase. Java: 1053)
At org. Apache. Catalina. Core. standardhost. Start (standardhost. Java: 785)
At org. Apache. Catalina. Core. containerbase. Start (containerbase. Java: 1045)
At org. Apache. Catalina. Core. standardengine. Start (standardengine. Java: 443)
At org. Apache. Catalina. Core. standardservice. Start (standardservice. Java: 519)
At org. Apache. Catalina. Core. standardserver. Start (standardserver. Java: 710)
At org. Apache. Catalina. startup. Catalina. Start (Catalina. Java: 581)
At sun. Reflect. nativemethodaccessorimpl. invoke0 (native method)
At sun. Reflect. nativemethodaccessorimpl. Invoke (nativemethodaccessorimpl. Java: 39)
At sun. Reflect. delegatingmethodaccessorimpl. Invoke (delegatingmethodaccessorimpl. Java: 25)
At java. Lang. Reflect. method. Invoke (method. Java: 597)
At org. Apache. Catalina. startup. Bootstrap. Start (Bootstrap. Java: 289)
At org. Apache. Catalina. startup. Bootstrap. Main (Bootstrap. Java: 414)
Caused by: Error building results for action in namespace-action-file:/C:/program % 20 Files % 20 (x86) /Apache-Tomcat-6.0.26/webapps/struct2/WEB-INF/classes/struts. XML: 6: 53
At com. opensymphony. xwork2.config. providers. xmlconfigurationprovider. addaction (xmlconfigurationprovider. Java: 367)
At com. opensymphony. xwork2.config. providers. xmlconfigurationprovider. addpackage (xmlconfigurationprovider. Java: 468)
At com. opensymphony. xwork2.config. providers. xmlconfigurationprovider. loadpackages (xmlconfigurationprovider. Java: 264)
At org. Apache. struts2.config. strutsxmlconfigurationprovider. loadpackages (strutsxmlconfigurationprovider. Java: 111)
At com. opensymphony. xwork2.config. impl. defaultconfiguration. reloadcontainer (defaultconfiguration. Java: 193)
At com. opensymphony. xwork2.config. configurationmanager. getconfiguration (configurationmanager. Java: 55)
... 31 more
Caused by: no result type specified for result named 'success ', perhaps the parent package does not specify the result type? -Result-file:/C:/program % 20 Files % 20 (x86)/Apache-Tomcat-6.0.26/webapps/struct2/WEB-INF/classes/struts. xml: 7: 27
At com. opensymphony. xwork2.config. providers. xmlconfigurationprovider. buildresults (xmlconfigurationprovider. Java: 612)
At com. opensymphony. xwork2.config. providers. xmlconfigurationprovider. addaction (xmlconfigurationprovider. Java: 365)
... 36 More
2011-4-21 18:17:46 org. Apache. Catalina. Core. standardcontext filterstart
Severe: exception starting filter struts2
Unable to load configuration. -Action-file:/C:/program % 20 Files % 20 (x86)/Apache-Tomcat-6.0.26/webapps/struct2/WEB-INF/classes/struts. XML: 6: 53
At org. Apache. struts2.dispatcher. Dispatcher. INIT (dispatcher. Java: 431)
At org. Apache. struts2.dispatcher. Ng. initoperations. initdispatcher (initoperations. Java: 69)
At org. Apache. struts2.dispatcher. Ng. Filter. strutsprepareandexecutefilter. INIT (strutsprepareandexecutefilter. Java: 51)
At org. Apache. Catalina. Core. applicationfilterconfig. getfilter (applicationfilterconfig. Java: 295)
At org. Apache. Catalina. Core. applicationfilterconfig. setfilterdef (applicationfilterconfig. Java: 422)
At org. Apache. Catalina. Core. applicationfilterconfig. <init> (applicationfilterconfig. Java: 115)
At org. Apache. Catalina. Core. standardcontext. filterstart (standardcontext. Java: 3838)
At org. Apache. Catalina. Core. standardcontext. Start (standardcontext. Java: 4488)
At org. Apache. Catalina. Core. containerbase. addchildinternal (containerbase. Java: 791)
At org. Apache. Catalina. Core. containerbase. addchild (containerbase. Java: 771)
At org. Apache. Catalina. Core. standardhost. addchild (standardhost. Java: 546)
At org. Apache. Catalina. startup. hostconfig. deploydirectory (hostconfig. Java: 1041)
At org. Apache. Catalina. startup. hostconfig. deploydirectories (hostconfig. Java: 964)
At org. Apache. Catalina. startup. hostconfig. deployapps (hostconfig. Java: 502)
At org. Apache. Catalina. startup. hostconfig. Start (hostconfig. Java: 1277)
At org. Apache. Catalina. startup. hostconfig. lifecycleevent (hostconfig. Java: 321)
At org. Apache. Catalina. util. lifecyclesupport. firelifecycleevent (lifecyclesupport. Java: 119)
At org. Apache. Catalina. Core. containerbase. Start (containerbase. Java: 1053)
At org. Apache. Catalina. Core. standardhost. Start (standardhost. Java: 785)
At org. Apache. Catalina. Core. containerbase. Start (containerbase. Java: 1045)
At org. Apache. Catalina. Core. standardengine. Start (standardengine. Java: 443)
At org. Apache. Catalina. Core. standardservice. Start (standardservice. Java: 519)
At org. Apache. Catalina. Core. standardserver. Start (standardserver. Java: 710)
At org. Apache. Catalina. startup. Catalina. Start (Catalina. Java: 581)
At sun. Reflect. nativemethodaccessorimpl. invoke0 (native method)
At sun. Reflect. nativemethodaccessorimpl. Invoke (nativemethodaccessorimpl. Java: 39)
At sun. Reflect. delegatingmethodaccessorimpl. Invoke (delegatingmethodaccessorimpl. Java: 25)
At java. Lang. Reflect. method. Invoke (method. Java: 597)
At org. Apache. Catalina. startup. Bootstrap. Start (Bootstrap. Java: 289)
At org. Apache. Catalina. startup. Bootstrap. Main (Bootstrap. Java: 414)
Caused by: Unable to load configuration. -Action-file:/C:/program % 20 Files % 20 (x86)/Apache-Tomcat-6.0.26/webapps/struct2/WEB-INF/classes/struts. XML: 6: 53
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)
... 29 more
Caused by: Error building results for action in namespace-action-file:/C:/program % 20 Files % 20 (x86) /Apache-Tomcat-6.0.26/webapps/struct2/WEB-INF/classes/struts. XML: 6: 53
At com. opensymphony. xwork2.config. providers. xmlconfigurationprovider. addaction (xmlconfigurationprovider. Java: 367)
At com. opensymphony. xwork2.config. providers. xmlconfigurationprovider. addpackage (xmlconfigurationprovider. Java: 468)
At com. opensymphony. xwork2.config. providers. xmlconfigurationprovider. loadpackages (xmlconfigurationprovider. Java: 264)
At org. Apache. struts2.config. strutsxmlconfigurationprovider. loadpackages (strutsxmlconfigurationprovider. Java: 111)
At com. opensymphony. xwork2.config. impl. defaultconfiguration. reloadcontainer (defaultconfiguration. Java: 193)
At com. opensymphony. xwork2.config. configurationmanager. getconfiguration (configurationmanager. Java: 55)
... 31 more
Caused by: no result type specified for result named 'success ', perhaps the parent package does not specify the result type? -Result-file:/C:/program % 20 Files % 20 (x86)/Apache-Tomcat-6.0.26/webapps/struct2/WEB-INF/classes/struts. xml: 7: 27
At com. opensymphony. xwork2.config. providers. xmlconfigurationprovider. buildresults (xmlconfigurationprovider. Java: 612)
At com. opensymphony. xwork2.config. providers. xmlconfigurationprovider. addaction (xmlconfigurationprovider. Java: 365)
... 36 More
2011-4-21 18:17:46 org. Apache. Catalina. Core. standardcontext start
Severe: Error filterstart
2011-4-21 18:17:46 org. Apache. Catalina. Core. standardcontext start

 

Solution:

Find the package node in struts. xml:

<Package name = "com. Action">

Add the following attributes

Extends = "struts-Default"

Last XML:

<? XML version = "1.0" encoding = "UTF-8"?> <Br/> <! Doctype struts public "-// Apache Software Foundation // DTD struts configuration 2.1 // en" "http://struts.apache.org/dtds/struts-2.1.dtd"> <br/> <struts> <br/> <package name =" com. action "extends =" struts-Default "> <br/> <action name =" action "class =" com. action. action1 "> <br/> <result name =" success ">/Suc. JSP </result> <br/> <result name = "error">/err. JSP </result> <br/> </Action> </package> </struts> <br/>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.