严重:配置类org.apache.struts2.tiles.StrutsTilesListener java.lang.NoClassDefFoundError的应用程序侦听器时出错:

在此处输入图像描述 我正在尝试在struts2中学习一个基本的Web应用程序。 但是,我面临以下问题。 请帮我删除这个问题。

SEVERE: Error configuring application listener of class org.apache.struts2.tiles.StrutsTilesListener java.lang.NoClassDefFoundError: Could not initialize class org.apache.log4j.Log4jLoggerFactory at org.apache.log4j.LogManager.getLogger(LogManager.java:45) at org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:63) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:242) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254) at org.apache.tiles.web.startup.AbstractTilesListener.(AbstractTilesListener.java:44) at org.apache.tiles.web.startup.TilesListener.(TilesListener.java:38) at org.apache.struts2.tiles.StrutsTilesListener.(StrutsTilesListener.java:48) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:119) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4638) at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5204) at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5199) 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) Sep 20, 2015 12:17:28 PM org.apache.catalina.core.StandardContext listenerStart SEVERE: Skipped installing application listeners due to previous error(s) Sep 20, 2015 12:17:28 PM org.apache.catalina.core.StandardContext startInternal SEVERE: Error listenerStart Sep 20, 2015 12:17:28 PM org.apache.catalina.core.StandardContext startInternal SEVERE: Context [/Login] startup failed due to previous errors Sep 20, 2015 12:17:28 PM com.opensymphony.xwork2.config.providers.XmlConfigurationProvider info INFO: Parsing configuration file [struts-default.xml] Sep 20, 2015 12:17:29 PM com.opensymphony.xwork2.config.providers.XmlConfigurationProvider info INFO: Unable to locate configuration files of the name struts-plugin.xml, skipping Sep 20, 2015 12:17:29 PM com.opensymphony.xwork2.config.providers.XmlConfigurationProvider info INFO: Parsing configuration file [struts-plugin.xml] Sep 20, 2015 12:17:29 PM com.opensymphony.xwork2.util.DomHelper warn WARNING: Local DTD is missing for publicID: -//Apache Software Foundation//DTD Struts Configuration 2.5//EN - defined mappings: {-//Apache Struts//XWork 1.0//EN=xwork-1.0.dtd, -//Apache Struts//XWork 1.1.1//EN=xwork-1.1.1.dtd, -//Apache Struts//XWork 2.0//EN=xwork-2.0.dtd, -//Apache Struts//XWork 1.1//EN=xwork-1.1.dtd, -//Apache Struts//XWork 2.1//EN=xwork-2.1.dtd, -//Apache Software Foundation//DTD Struts Configuration 2.0//EN=struts-2.0.dtd, -//Apache Struts//XWork 2.1.3//EN=xwork-2.1.3.dtd, -//Apache Software Foundation//DTD Struts Configuration 2.3//EN=struts-2.3.dtd, -//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN=struts-2.1.7.dtd, -//Apache Software Foundation//DTD Struts Configuration 2.1//EN=struts-2.1.dtd, -//Apache Struts//XWork 2.3//EN=xwork-2.3.dtd} Sep 20, 2015 12:17:29 PM com.opensymphony.xwork2.config.providers.XmlConfigurationProvider info INFO: Parsing configuration file [struts.xml] Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.ObjectFactory) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.factory.ActionFactory) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.factory.ResultFactory) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.factory.ConverterFactory) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.factory.InterceptorFactory) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.factory.ValidatorFactory) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.factory.UnknownHandlerFactory) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.FileManagerFactory) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.XWorkConverter) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.CollectionConverter) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.ArrayConverter) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.DateConverter) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.NumberConverter) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.impl.StringConverter) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.ConversionPropertiesProcessor) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.ConversionFileProcessor) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.ConversionAnnotationProcessor) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.TypeConverterCreator) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.TypeConverterHolder) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.TextProvider) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.LocaleProvider) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.ActionProxyFactory) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.conversion.ObjectTypeDeterminer) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (org.apache.struts2.dispatcher.mapper.ActionMapper) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (jakarta) for (org.apache.struts2.dispatcher.multipart.MultiPartRequest) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (org.apache.struts2.views.freemarker.FreemarkerManager) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (org.apache.struts2.components.UrlRenderer) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.validator.ActionValidatorManager) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.util.ValueStackFactory) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.util.reflection.ReflectionProvider) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.util.reflection.ReflectionContextFactory) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.util.PatternMatcher) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (org.apache.struts2.util.ContentTypeMatcher) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (org.apache.struts2.dispatcher.StaticContentLoader) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.UnknownHandlerManager) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (org.apache.struts2.views.util.UrlHelper) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.util.TextParser) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (org.apache.struts2.dispatcher.DispatcherErrorHandler) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.security.ExcludedPatternsChecker) Sep 20, 2015 12:17:29 PM org.apache.struts2.config.AbstractBeanSelectionProvider info INFO: Choosing bean (struts) for (com.opensymphony.xwork2.security.AcceptedPatternsChecker) Sep 20, 2015 12:17:31 PM com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register INFO: Parsing configuration file [struts-default.xml] Sep 20, 2015 12:17:31 PM com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register INFO: Parsing configuration file [struts-plugin.xml] Sep 20, 2015 12:17:31 PM com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register INFO: Parsing configuration file [struts.xml] Sep 20, 2015 12:17:31 PM org.apache.struts2.config.Settings getLocale WARNING: Settings: Could not parse struts.locale setting, substituting default VM locale Sep 20, 2015 12:17:31 PM com.opensymphony.xwork2.util.ObjectTypeDeterminerFactory  INFO: Setting DefaultObjectTypeDeterminer as default ... Sep 20, 2015 12:17:31 PM org.apache.coyote.AbstractProtocolHandler start INFO: Starting ProtocolHandler ["http-bio-8080"] Sep 20, 2015 12:17:31 PM org.apache.coyote.AbstractProtocolHandler start INFO: Starting ProtocolHandler ["ajp-bio-8009"] Sep 20, 2015 12:17:31 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 8899 ms Sep 20, 2015 12:17:35 PM org.apache.catalina.core.StandardServer await INFO: A valid shutdown command was received via the shutdown port. Stopping the Server instance. Sep 20, 2015 12:17:35 PM org.apache.coyote.AbstractProtocolHandler pause INFO: Pausing ProtocolHandler ["http-bio-8080"] Sep 20, 2015 12:17:36 PM org.apache.coyote.AbstractProtocolHandler pause INFO: Pausing ProtocolHandler ["ajp-bio-8009"] Sep 20, 2015 12:17:37 PM org.apache.catalina.core.StandardService stopInternal INFO: Stopping service Catalina Sep 20, 2015 12:17:37 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks SEVERE: The web application [/UITagsExample] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@1c11080]) and a value of type [com.opensymphony.xwork2.inject.InternalContext[]] (value [[Lcom.opensymphony.xwork2.inject.InternalContext;@226e75]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. Sep 20, 2015 12:17:37 PM org.apache.catalina.util.LifecycleBase stop INFO: The stop() method was called on component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Login]] after stop() had already been called. The second call will be ignored. Sep 20, 2015 12:17:37 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks SEVERE: The web application [/SimpleLogin_FirstPro_2] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@136df08]) and a value of type [com.opensymphony.xwork2.inject.InternalContext[]] (value [[Lcom.opensymphony.xwork2.inject.InternalContext;@16cbe3c]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak. Sep 20, 2015 12:17:37 PM org.apache.coyote.AbstractProtocolHandler stop INFO: Stopping ProtocolHandler ["http-bio-8080"] Sep 20, 2015 12:17:37 PM org.apache.coyote.AbstractProtocolHandler stop INFO: Stopping ProtocolHandler ["ajp-bio-8009"] 

这是我的WEb.XML文件

    index.jsp   struts2  org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter    struts2 /*   org.apache.struts2.tiles.StrutsTilesListener   

在struts.xml

      login.jsp   loginsuccess.jsp loginerror.jsp   logoutsuccess.jsp   profilesuccess.jsp profileerror.jsp    

我正在努力解决但是,我无法这样做。 请帮忙。

你错过了类路径中的log4j.jar。 下载jar广告添加它。