eclipse中的Struts 2给出“请求的资源未找到”

时间:2013-05-16 12:54:24

标签: java xml eclipse struts2 struts-config

CONSOLE OUTPUT

16 May, 2013 6:06:51 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\PHP\;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\adarsh\mysql\bin;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Java\jdk1.6.0_04\bin;.;C:\apache-ant-1.8.4\bin;.;C:\apache-ant-1.8.4\lib;.;C:\Program Files (x86)\clisp-2.49
16 May, 2013 6:06:52 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Struts2Starter' did not find a matching property.
16 May, 2013 6:06:52 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
16 May, 2013 6:06:52 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
16 May, 2013 6:06:52 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 781 ms
16 May, 2013 6:06:52 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
16 May, 2013 6:06:52 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.34

此后的代码错误开始

16 May, 2013 6:06:53 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: /struts-tags is already defined
16 May, 2013 6:06:53 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Parsing configuration file [struts-default.xml]
16 May, 2013 6:06:54 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
SEVERE: Dispatcher initialization failed
Unable to load configuration. - bean - jar:file:/C:/adarsh/Struts/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts2Starter/WEB-INF/lib/struts2-core-2.3.4.1.jar!/struts-default.xml:29:72
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:436)
    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.initFilter(ApplicationFilterConfig.java:278)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:259)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:383)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:104)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4650)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5306)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/C:/adarsh/Struts/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts2Starter/WEB-INF/lib/struts2-core-2.3.4.1.jar!/struts-default.xml:29:72
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:235)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:180)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
    ... 18 more
Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - jar:file:/C:/adarsh/Struts/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts2Starter/WEB-INF/lib/struts2-core-2.3.1.2.jar!/struts-default.xml:29:72 - bean - jar:file:/C:/adarsh/Struts/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts2Starter/WEB-INF/lib/struts2-core-2.3.4.1.jar!/struts-default.xml:29:72
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:219)
    ... 21 more
16 May, 2013 6:06:54 PM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter struts2
Unable to load configuration. - bean - jar:file:/C:/adarsh/Struts/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts2Starter/WEB-INF/lib/struts2-core-2.3.4.1.jar!/struts-default.xml:29:72
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:449)
    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.initFilter(ApplicationFilterConfig.java:278)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:259)
    at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:383)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:104)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4650)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5306)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: Unable to load configuration. - bean - jar:file:/C:/adarsh/Struts/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts2Starter/WEB-INF/lib/struts2-core-2.3.4.1.jar!/struts-default.xml:29:72
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:436)
    ... 16 more
Caused by: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/C:/adarsh/Struts/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts2Starter/WEB-INF/lib/struts2-core-2.3.4.1.jar!/struts-default.xml:29:72
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:235)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:180)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
    ... 18 more
Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - jar:file:/C:/adarsh/Struts/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts2Starter/WEB-INF/lib/struts2-core-2.3.1.2.jar!/struts-default.xml:29:72 - bean - jar:file:/C:/adarsh/Struts/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts2Starter/WEB-INF/lib/struts2-core-2.3.4.1.jar!/struts-default.xml:29:72
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:219)
    ... 21 more
16 May, 2013 6:06:54 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error filterStart
16 May, 2013 6:06:54 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/Struts2Starter] startup failed due to previous errors
16 May, 2013 6:06:54 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
16 May, 2013 6:06:54 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
16 May, 2013 6:06:54 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1926 ms
## Heading ##

2 个答案:

答案 0 :(得分:3)

  

引起:无法加载bean :类型:class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/ C:/adarsh/Struts/.metadata/.plugins/ !org.eclipse.wst.server.core / TMP0 / wtpwebapps / Struts2Starter / WEB-INF / LIB /的 struts2的核 - 2.3.4.1.jar /支杆-default.xml中:29:72 < / p>      

引起:bean类型类com.opensymphony.xwork2.ObjectFactory,名称为xwork已经由bean加载 - jar:file:/ C:/adarsh/Struts/.metadata/。 !插件/ org.eclipse.wst.server.core / TMP0 / wtpwebapps / Struts2Starter / WEB-INF / LIB /的 struts2的核 - 2.3.1.2.jar /支杆-default.xml中:29: 72 - bean - jar:file:/ C:/adarsh/Struts/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts2Starter/WEB-INF/lib/ struts2-core !-2.3.4.1.jar /支杆-default.xml中:29:72

您的项目中只有多个版本的Struts2库。

除了你想要使用的版本以外的所有其他版本,你会没事的。

答案 1 :(得分:0)

你的WEB-INF \ classes文件夹可能包含一个struts.xml,并且在加载了clasess \ struts.xml之后eclipse正在加载它的struts.xml两次。 尝试清理classes文件夹,或者至少删除那里的struts.xml文件。