严重:调度程序初始化失败无法加载配置
Posted
技术标签:
【中文标题】严重:调度程序初始化失败无法加载配置【英文标题】:SEVERE: Dispatcher initialization failed Unable to load configuration 【发布时间】:2017-08-03 12:49:57 【问题描述】:我正在开发 Struts 2 应用程序,毕竟我遇到了以下错误。
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 中遇到错误,它说 公共标识符必须以单引号或双引号字符开头
这是我的文件夹结构:
【问题讨论】:
在你的 struts.xml 中通知</action>l
谢谢,但不是这样吗? :(这是错误的。
首先,使用 Struts 2.3 dtd,而不是 2.0...
您是否部署了所有必需的库?
【参考方案1】:
正如例外明确指出的那样,
原因:java.lang.ClassNotFoundException: freemarker.cache.TemplateLoader
这只是一些缺少 jar 的简单案例(本例中为 freemarker)。
如果这是您第一次制作struts 应用程序,我建议您从空白struts 战争开始。它是一个简单的 deployabe war 文件,包含成功部署和运行 struts2 项目所需的所有基本 jar 和资源/文件。
这是战争文件的direct link。
【讨论】:
Caused by: 部分帮助我解决了其他一些问题。我是 java 环境的新手。【参考方案2】:您只需检查是否添加了所有必需的 .jar 文件。这些在您必须添加的罐子下面: 在您的库中维护以下版本的 jar。我想你不会遇到任何问题
antlr-2.7.6.jar
commons-beanutils-1.7.0.jar
commons-collections-3.2.jar
commons-digester.jar
commons-fileupload-1.2.2.jar
commons-io-2.4.jar
commons-lang-1.2.jar
commons-logging-1.1.jar
freemarker-2.3.16.jar
javassist-3.7.ga.jar
ognl-3.0.jar
struts2-core-2.2.3.jar
xwork-core-2.2.1.jar
【讨论】:
【参考方案3】:看起来 freemarker jar 丢失了。这应该可以纠正当前的问题。 如果缺少其他依赖 JAR,那么在此之后您将出现其他一些异常。
【讨论】:
以上是关于严重:调度程序初始化失败无法加载配置的主要内容,如果未能解决你的问题,请参考以下文章
无法加载 DLL“rasapi32.dll”: 动态链接库(DLL)初始化例程失败。的处理备注方案