2015-09-20 76 views
0

enter image description here我正在尝试学习struts2中的基本Web应用程序。但是,我正面临以下问题。请帮我解决这个问题。SEVERE:配置类org.apache.struts2.tiles.StrutsTilesListener java.lang.NoClassDefFoundError的应用程序监听器时出错:

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.<init>(AbstractTilesListener.java:44) 
    at org.apache.tiles.web.startup.TilesListener.<init>(TilesListener.java:38) 
    at org.apache.struts2.tiles.StrutsTilesListener.<init>(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 <clinit> 
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 [[email protected]]) 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 [[email protected]]) 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文件

<?xml version="1.0" encoding="UTF-8"?> 
<web-app version="2.5" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    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"> 
    <welcome-file-list> 
    <welcome-file>index.jsp</welcome-file> 
    </welcome-file-list> 
    <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> 

    <listener> 
    <listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class> 
    </listener> 

    </web-app> 

struts.xml的

<?xml version="1.0" encoding="UTF-8" ?> 
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN" "http://struts.apache.org/dtds/struts-2.5.dtd"> 
<struts> 
<package name="abc" extends="struts-default"> 

<action name="login"> 
<result >login.jsp</result> 
</action> 

<action name="loginprocess" class="com.javatpoint.Login"> 
<result name="success" >loginsuccess.jsp</result> 
<result name="error" >loginerror.jsp</result> 
</action> 

<action name="logout" class="com.javatpoint.Login" method="logout"> 
<result name="success" >logoutsuccess.jsp</result> 
</action> 

<action name="profile" class="com.javatpoint.Profile"> 
<result name="success" >profilesuccess.jsp</result> 
<result name="error" >profileerror.jsp</result> 
</action> 

</package> 
</struts>  

我试图用它来解决,但,我不能这样做。请帮忙。

回答

1

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

+0

已安装log4j jar。你可以看到那篇文章 – Sourav

+0

@Sourav我看不到log4j.jar。我只能看到log4j-over-slf4j.jar – Jens

+0

@Sourav另外你还会显示buildbapth,而不是classpath。 – Jens

相关问题