2013-12-11 100 views
3

我正在開發Struts 2應用程序,畢竟我遇到了以下錯誤。SEVERE:調度程序初始化失敗無法加載配置

SEVERE: Dispatcher initialization failed 
Unable to load configuration. - bean - jar:file:/home/sachith/SourceCodeGroupCW/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/PcArcade/WEB-INF/lib/struts2-core-2.3.16.jar!/struts-default.xml:69:87 
    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$Sync.innerRun(FutureTask.java:334) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:166) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
    at java.lang.Thread.run(Thread.java:724) 
Caused by: Unable to load bean: type: class:org.apache.struts2.views.freemarker.FreemarkerThemeTemplateLoader - bean - jar:file:/home/sachith/SourceCodeGroupCW/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/PcArcade/WEB-INF/lib/struts2-core-2.3.16.jar!/struts-default.xml:69:87 
    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) 
    ... 17 more 
Caused by: java.lang.NoClassDefFoundError: freemarker/cache/TemplateLoader 
    at java.lang.ClassLoader.defineClass1(Native Method) 
    at java.lang.ClassLoader.defineClass(ClassLoader.java:788) 
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) 
    at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2918) 
    at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1174) 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1669) 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547) 
    at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:144) 
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:216) 
    ... 20 more 
Caused by: java.lang.ClassNotFoundException: freemarker.cache.TemplateLoader 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702) 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547) 
    ... 29 more 

Dec 11, 2013 1:25:28 PM org.apache.catalina.core.StandardContext filterStart 
SEVERE: Exception starting filter struts2 
Unable to load configuration. - bean - jar:file:/home/sachith/SourceCodeGroupCW/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/PcArcade/WEB-INF/lib/struts2-core-2.3.16.jar!/struts-default.xml:69:87 
    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$Sync.innerRun(FutureTask.java:334) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:166) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
    at java.lang.Thread.run(Thread.java:724) 
Caused by: Unable to load configuration. - bean - jar:file:/home/sachith/SourceCodeGroupCW/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/PcArcade/WEB-INF/lib/struts2-core-2.3.16.jar!/struts-default.xml:69:87 
    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) 
    ... 15 more 
Caused by: Unable to load bean: type: class:org.apache.struts2.views.freemarker.FreemarkerThemeTemplateLoader - bean - jar:file:/home/sachith/SourceCodeGroupCW/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/PcArcade/WEB-INF/lib/struts2-core-2.3.16.jar!/struts-default.xml:69:87 
    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) 
    ... 17 more 
Caused by: java.lang.NoClassDefFoundError: freemarker/cache/TemplateLoader 
    at java.lang.ClassLoader.defineClass1(Native Method) 
    at java.lang.ClassLoader.defineClass(ClassLoader.java:788) 
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) 
    at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2918) 
    at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1174) 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1669) 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547) 
    at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:144) 
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:216) 
    ... 20 more 
Caused by: java.lang.ClassNotFoundException: freemarker.cache.TemplateLoader 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702) 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547) 
    ... 29 more 

Dec 11, 2013 1:25:28 PM org.apache.catalina.core.StandardContext startInternal 
SEVERE: Error filterStart 
Dec 11, 2013 1:25:28 PM org.apache.catalina.core.StandardContext startInternal 
SEVERE: Context [/PcArcade] startup failed due to previous errors 
Dec 11, 2013 1:25:28 PM org.apache.coyote.AbstractProtocol start 
INFO: Starting ProtocolHandler ["http-bio-8080"] 
Dec 11, 2013 1:25:28 PM org.apache.coyote.AbstractProtocol start 
INFO: Starting ProtocolHandler ["ajp-bio-8009"] 
Dec 11, 2013 1:25:28 PM org.apache.catalina.startup.Catalina start 
INFO: Server startup in 4877 ms 

我什至不能想這是爲什麼?而我的其他文件就像下面,

行動文件

public class PcArcadeAction { 

    public String execute() 
    { 
     String success="success"; 
     return success; 
    } 
} 

的web.xml

<?xml version="1.0" encoding="UTF-8"?> 
<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> 

<display-name>PcArcade</display-name> 
<filter> 
     <filter-name> struts2</filter-name> 
     <filter-class> 
      org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter 
     </filter-class> 
 </filter> 

<filter-mapping> 
     <filter-name>struts2</filter-name> 
     <url-pattern>/*</url-pattern> 
 </filter-mapping> 

<welcome-file-list> 
    <welcome-file>default.jsp</welcome-file> 
</welcome-file-list> 
</web-app> 

我在struts.xml中得到錯誤,它說的公共標識符必須以單引號或雙引號字符開頭

enter image description here

這裏是我的文件夾結構:

enter image description here

+0

請注意' l'在你的struts.xml中 –

+0

謝謝但不是他的情況? (其錯誤:) – CodeSac

+0

首先,使用Struts 2.3 dtd,而不是2.0 ... –

回答

0

貌似freemarker的罐子丟失。這應該糾正當前的問題。 如果其他相關的JAR缺失,那麼在此之後,您會發現其他一些異常。

2

作爲例外明確規定,

造成的:拋出java.lang.ClassNotFoundException:freemarker.cache.TemplateLoader

它缺少一些罐子的只是一個簡單的情況下(freemarker的在這案件 )。

如果這是您第一次製作struts應用程序,我建議您從空白struts戰爭開始。這是一個簡單的deployabe war文件,它包含成功部署和運行struts2項目所需的所有基本jar和資源/文件。

這裏是direct link的戰爭文件。

+0

**由於:**部分幫助我解決了一些其他問題。新的Java環境。 – gldraphael

0

你只需要檢查你是否添加了所有需要的.jar文件。這些都在你要添加的jar下面: 在你的lib中維護以下版本的jar。我想你不會面對任何問題

ANTLR-2.7.6.jar

公地的BeanUtils-1.7.0.jar

公地集合-3.2.jar

commons- digester.jar

公地文件上傳-1.2.2.jar

公地IO-2.4.jar

commons-lang-1.2.jar

commons-logging-1.1。罐子

的freemarker-2.3.16.jar

了Javassist-3.7.ga.jar

OGNL-3.0.jar

struts2的核 - 2.2.3.jar

XWork的-core-2.2.1.jar

相關問題