An error occurred while modifying the struts configuration file path.

Source: Internet
Author: User

An error occurred while modifying the struts configuration file path.

When integrating spring and struts today, place the struts2 configuration file in src/config/struts. xml. An error is always reported when you start the project! The following is the configuration of the struts interceptor on the web:




Struts2
Org. apache. struts2.dispatcher. ng. filter. StrutsPrepareAndExecuteFilter

Config
Config/struts. xml




Struts2
/*
 

 

An error always occurs during running, and it takes a whole day. The eclipse error is as follows:


Com. opensymphony. xwork2.inject. dependencyException: com. opensymphony. xwork2.inject. containerImpl $ MissingDependencyException: No mapping found for dependency [type = com. opensymphony. xwork2.ObjectFactory, name = 'default'] in public void com. opensymphony. xwork2.config. providers. xmlConfigurationProvider. setObjectFactory (com. opensymphony. xwork2.ObjectFactory ).
At com. opensymphony. xwork2.inject. ContainerImpl. addInjectorsForMembers (ContainerImpl. java: 144)
At com. opensymphony. xwork2.inject. ContainerImpl. addInjectorsForMethods (ContainerImpl. java: 113)
At com. opensymphony. xwork2.inject. ContainerImpl. addInjectors (ContainerImpl. java: 90)
At com. opensymphony. xwork2.inject. ContainerImpl. addInjectors (ContainerImpl. java: 86)
At com. opensymphony. xwork2.inject. ContainerImpl $1. create (ContainerImpl. java: 71)
At com. opensymphony. xwork2.inject. ContainerImpl $1. create (ContainerImpl. java: 67)
At com. opensymphony. xwork2.inject. util. ReferenceCache $ CallableCreate. call (ReferenceCache. java: 150)
At java. util. concurrent. FutureTask. run (FutureTask. java: 262)
At com. opensymphony. xwork2.inject. util. ReferenceCache. internalCreate (ReferenceCache. java: 76)
At com. opensymphony. xwork2.inject. util. ReferenceCache. get (ReferenceCache. java: 116)
At com. opensymphony. xwork2.inject. ContainerImpl. inject (ContainerImpl. java: 483)
At com. opensymphony. xwork2.inject. ContainerImpl $6. call (ContainerImpl. java: 523)

Maybe it should be unable to struts-default.xml and error!

 

There are two ways to modify:

Solution 1: Add the following content to struts2.xml:

 

Solution 2: modify the configuration of the struts interceptor on the web as follows:



Struts2
Org. apache. struts2.dispatcher. ng. filter. StrutsPrepareAndExecuteFilter

Config
Struts-default.xml, config/struts. xml




Struts2
/*
 

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.