Struts2的Dispatcher初始化失败

时间:2014-05-10 22:38:14

标签: java struts2 tomcat7

我正在使用Struts2构建我的第一个Web应用程序。我没有发现错误(好吧,我认为我不会犯错误,实际上)但是Tomcat总是给我404 ...

我在这里发布日志给你建议我一个解决方案。但它对我没有多大帮助,只是说他没有加载配置或bean。我真的不知道。

日志:

mag 11, 2014 12:13:45 AM org.apache.catalina.core.AprLifecycleListener init
Informazioni: 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\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\eclipse;;.
mag 11, 2014 12:13:46 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
Avvertenza: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Struts2Starter' did not find a matching property.
mag 11, 2014 12:13:47 AM org.apache.coyote.AbstractProtocol init
Informazioni: Initializing ProtocolHandler ["http-bio-8080"]
mag 11, 2014 12:13:47 AM org.apache.coyote.AbstractProtocol init
Informazioni: Initializing ProtocolHandler ["ajp-bio-8009"]
mag 11, 2014 12:13:47 AM org.apache.catalina.startup.Catalina load
Informazioni: Initialization processed in 2878 ms
mag 11, 2014 12:13:47 AM org.apache.catalina.core.StandardService startInternal
Informazioni: Starting service Catalina
mag 11, 2014 12:13:47 AM org.apache.catalina.core.StandardEngine startInternal
Informazioni: Starting Servlet Engine: Apache Tomcat/7.0.42
mag 11, 2014 12:13:48 AM org.apache.catalina.util.SessionIdGenerator createSecureRandom
Informazioni: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [336] milliseconds.
mag 11, 2014 12:13:58 AM com.opensymphony.xwork2.config.providers.XmlConfigurationProvider info
Informazioni: Parsing configuration file [struts-default.xml]
mag 11, 2014 12:13:59 AM com.opensymphony.xwork2.config.providers.XmlConfigurationProvider info
Informazioni: Parsing configuration file [struts-plugin.xml]
mag 11, 2014 12:14:00 AM org.apache.struts2.dispatcher.Dispatcher error
Grave: Dispatcher initialization failed
Unable to load configuration. - bean - jar:file:/C:/Users/Dario/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts2Starter/WEB-INF/lib/struts2-gxp-plugin-2.3.16.3.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:445)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:489)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
    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:4775)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5452)
    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.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)
Caused by: Unable to load bean: type:org.apache.struts2.views.gxp.inject.InjectedObjectContainer class:org.apache.struts2.views.gxp.inject.InjectedObjectContainer - bean - jar:file:/C:/Users/Dario/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts2Starter/WEB-INF/lib/struts2-gxp-plugin-2.3.16.3.jar!/struts-plugin.xml:8:162
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:245)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:234)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
    ... 16 more
Caused by: java.lang.ClassNotFoundException: org.apache.struts2.views.gxp.inject.InjectedObjectContainer
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
    at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:152)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:216)
    ... 19 more

mag 11, 2014 12:14:00 AM org.apache.catalina.core.StandardContext filterStart
Grave: Exception starting filter struts2
Unable to load configuration. - bean - jar:file:/C:/Users/Dario/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts2Starter/WEB-INF/lib/struts2-gxp-plugin-2.3.16.3.jar!/struts-plugin.xml:8:162
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:501)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
    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:4775)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5452)
    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.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)
Caused by: Unable to load configuration. - bean - jar:file:/C:/Users/Dario/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts2Starter/WEB-INF/lib/struts2-gxp-plugin-2.3.16.3.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:445)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:489)
    ... 14 more
Caused by: Unable to load bean: type:org.apache.struts2.views.gxp.inject.InjectedObjectContainer class:org.apache.struts2.views.gxp.inject.InjectedObjectContainer - bean - jar:file:/C:/Users/Dario/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts2Starter/WEB-INF/lib/struts2-gxp-plugin-2.3.16.3.jar!/struts-plugin.xml:8:162
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:245)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:234)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
    ... 16 more
Caused by: java.lang.ClassNotFoundException: org.apache.struts2.views.gxp.inject.InjectedObjectContainer
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
    at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:152)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:216)
    ... 19 more

mag 11, 2014 12:14:00 AM org.apache.catalina.core.StandardContext startInternal
Grave: Error filterStart
mag 11, 2014 12:14:00 AM org.apache.catalina.core.StandardContext startInternal
Grave: Context [/Struts2Starter] startup failed due to previous errors
mag 11, 2014 12:14:00 AM org.apache.coyote.AbstractProtocol start
Informazioni: Starting ProtocolHandler ["http-bio-8080"]
mag 11, 2014 12:14:00 AM org.apache.coyote.AbstractProtocol start
Informazioni: Starting ProtocolHandler ["ajp-bio-8009"]
mag 11, 2014 12:14:00 AM org.apache.catalina.startup.Catalina start
Informazioni: Server startup in 13236 ms

删除gxp插件jar后,我得到的错误是:

mag 11, 2014 7:06:38 PM org.apache.catalina.core.AprLifecycleListener init
Informazioni: 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\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\eclipse;;.
mag 11, 2014 7:06:39 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
Avvertenza: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Struts2Starter' did not find a matching property.
mag 11, 2014 7:06:40 PM org.apache.coyote.AbstractProtocol init
Informazioni: Initializing ProtocolHandler ["http-bio-8080"]
mag 11, 2014 7:06:40 PM org.apache.coyote.AbstractProtocol init
Informazioni: Initializing ProtocolHandler ["ajp-bio-8009"]
mag 11, 2014 7:06:40 PM org.apache.catalina.startup.Catalina load
Informazioni: Initialization processed in 4344 ms
mag 11, 2014 7:06:41 PM org.apache.catalina.core.StandardService startInternal
Informazioni: Starting service Catalina
mag 11, 2014 7:06:41 PM org.apache.catalina.core.StandardEngine startInternal
Informazioni: Starting Servlet Engine: Apache Tomcat/7.0.42
mag 11, 2014 7:06:42 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
Informazioni: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [343] milliseconds.
mag 11, 2014 7:06:43 PM org.apache.catalina.core.StandardContext filterStart
Grave: Exception starting filter struts2
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:527)
    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:509)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:137)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4775)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5452)
    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.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)

mag 11, 2014 7:06:43 PM org.apache.catalina.core.StandardContext startInternal
Grave: Error filterStart
mag 11, 2014 7:06:43 PM org.apache.catalina.core.StandardContext startInternal
Grave: Context [/Struts2Starter] startup failed due to previous errors
mag 11, 2014 7:06:43 PM org.apache.coyote.AbstractProtocol start
Informazioni: Starting ProtocolHandler ["http-bio-8080"]
mag 11, 2014 7:06:43 PM org.apache.coyote.AbstractProtocol start
Informazioni: Starting ProtocolHandler ["ajp-bio-8009"]
mag 11, 2014 7:06:43 PM org.apache.catalina.startup.Catalina start
Informazioni: Server startup in 2882 ms

3 个答案:

答案 0 :(得分:1)

以防万一有相同问题的人。在项目方面将java版本更改为1.7或更高版本。

答案 1 :(得分:0)

java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter

表示struts2-core.x.x.x.jar应位于类路径上,例如在WEB-INF/lib

答案 2 :(得分:0)

您目前正在加载没有所需依赖项的S2插件。

您缺少依赖项。

  1. 仅部署您实际使用的S2插件。
  2. 包含您实际使用的插件的依赖项。
  3. 您仍然需要S2库及其依赖项才能完成任何工作。
  4. 这就是为什么你应该考虑使用Maven,Gradle,Ivy等依赖管理工具的原因之一。手动跟踪传递依赖关系最多也是令人不快的。