2014-05-10 130 views
1

我正在用Struts2構建我的第一個Web應用程序。我沒有發現錯誤(當然,我不認爲我犯了錯誤),但Tomcat總是給我404 ...調度程序初始化失敗,Struts2

我在這裏發佈日誌給你,建議我一個解決方案。但它對我沒有多大幫助,只是說他沒有加載配置或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 
+0

http://stackoverflow.com/a/19985547/573032 –

+0

http://stackoverflow.com/a/16883428/573032 –

+0

http://stackoverflow.com/a/22617924/573032 –

回答

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

意味着struts2-core.x.x.x.jar應該在類路徑,例如在WEB-INF/lib

+0

無法加載配置。 - bean - jar:file:/ C:/Users/Dario/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts2Starter/WEB-INF/lib/struts2-portlet-plugin -2.3.16.3.jar /struts-plugin.xml:31:133 – dariodp

0

您當前正在加載您沒有所需依賴關係的S2插件。

你缺少依賴關係。

  1. 只部署您實際使用的S2插件。
  2. 包含您實際使用的插件的依賴關係。
  3. 你仍然需要S2庫和它們的依賴關係來完成任何工作。

這就是爲什麼你應該考慮使用像Maven,Gradle,Ivy等一樣的依賴管理工具的一個原因。手動跟蹤傳遞依賴是最不愉快的。

0

以防萬一任何人有同樣的問題。在項目構面上將java版本更改爲1.7或更高版本。