2

I'm learning struts2. And I try my hello world projects according to the tutorial Then I run the code in eclipse. But it doesn't work. The Console shows a lot of error. The first is as below:

 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
SEVERE: Dispatcher initialization failed
Unable to load configuration. - bean - jar:file:/C:/Users/Administrator/Eclipse/workspace_2/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/MyStruts2/WEB-INF/lib/struts2-gxp-plugin-2.3.8.jar!/struts-plugin.xml:8:162
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:429)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:471)
    at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:193)
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4656)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5312)
    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.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

And the pages shows : HTTP Status 404 - /MyStruts2/index.jsp type Status report

message /MyStruts2/index.jsp

description The requested resource is not available.

What's wrong with it. Need I configure more?

roast_soul
  • 3,554
  • 7
  • 36
  • 73

1 Answers1

2

First, remove all unused S2 plugins If you're following a basic tutorial, you are almost certainly not using GXP.

S2 plugins:

  1. May alter S2 functionality in fundamental ways, and
  2. Have their own dependencies that will cause failures if their dependencies are not met.

Second, ensure you are deploying all required libraries. Maven (or the equivalent) was created to manage those dependencies, but for an absolute bare-bones app it's not strictly necessary.

Dave Newton
  • 158,873
  • 26
  • 254
  • 302
  • It works,at first I copy all the jar files which are zipped in struts-2.3.8-lib.zip into the lib folder. Because I think that all the jar file in lib can ensure no missing class. But I'm worng. So I just put the necessary jar as the tutorial said. Now it's OK.But how do I know which one is necessary when I develop my application? Any reference documents? – roast_soul Feb 20 '13 at 02:03
  • @roast_soul Using Maven is the best way to handle this, but: http://struts.apache.org/release/2.3.x/struts2-core/dependencies.html – Dave Newton Feb 20 '13 at 02:49