Struts2 教程不起作用 [英] Struts2 tutorial doesn't work
问题描述
我正在学习 struts2.我根据 tutorial 尝试我的 hello world 项目然后我在eclipse中运行代码.但它不起作用.控制台显示很多错误.第一个如下:
com.opensymphony.xwork2.util.logging.commons.CommonsLogger 错误严重:调度程序初始化失败无法加载配置.- 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在 com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)在 org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:429)在 org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:471)在 org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:193)在 org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281)在 org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262)在 org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:107)在 org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4656)在 org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5312)在 org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)在 org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)在 org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)在 java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)在 java.util.concurrent.FutureTask.run(未知来源)在 java.util.concurrent.ThreadPoolExecutor.runWorker(来源不明)在 java.util.concurrent.ThreadPoolExecutor$Worker.run(未知来源)在 java.lang.Thread.run(未知来源)
页面显示:HTTP 状态 404 -/MyStruts2/index.jsp输入状态报告
消息/MyStruts2/index.jsp
描述请求的资源不可用.
这是怎么回事.我需要配置更多吗?
首先,删除所有未使用的 S2 插件 如果您正在学习基本教程,那么您几乎可以肯定没有使用 GXP.>
S2 插件:
- 可能会从根本上改变 S2 的功能,并且
- 拥有自己的依赖项,如果不满足它们的依赖项会导致失败.
其次,确保您部署了所有必需的库.创建 Maven(或等效项)是为了管理这些依赖项,但对于绝对的准系统应用而言,这并不是绝对必要的.
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?
First, remove all unused S2 plugins If you're following a basic tutorial, you are almost certainly not using GXP.
S2 plugins:
- May alter S2 functionality in fundamental ways, and
- 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.
这篇关于Struts2 教程不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!