Initializing Spring root WebApplicationContext log4j:WARN No appenders couould be found for logger (
来源:互联网 发布:男科网络咨询说话技巧 编辑:程序博客网 时间:2024/03/29 06:45
错误信息
在出现以下信息:
信息: Initializing Spring root WebApplicationContext log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http ://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
和服务器错误信息
web.xml的spring配置
- 1
- 2
- 3
- 4
- 5
- 1
- 2
- 3
- 4
- 5
只有以上的listener,但是它的文档写着
Bootstrap listener to start up and shut down spring’s root WebApplicationContext. Simply delegates
to ContextLoader as well as to ContextCleanupListener.
This listener should be registered after org.springframework.web.util.Log4jConfigListener in web.xml,
if the latter is used.
As of Spring 3.1, ContextLoaderListener supports injecting the root web application context via the
ContextLoaderListener(WebApplicationContext) constructor, allowing for programmatic configuration
in Servlet 3.0+ environments. See org.springframework.web.WebApplicationInitializer for usage
examples.
需要修改的地方
- web.xml
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
把spring配置增加一个listener和其listener的配置文件,修改成这样就可以了,log4listener的配置文件内,添加如下的东西
- all.properties
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
当然服务器不能常规启动,不只是配置的原因,这次的主要是由数据库连接被拒造成的,但做以上修改后,console就能出现错误日志如下,从而能一一排查错误
13:41:48,958 INFO [web.context.ContextLoader] Root WebApplicationContext: initialization started
13:41:49,067 INFO [context.support.XmlWebApplicationContext] Refreshing Root WebApplicationContext: startup date [Wed Nov 04 13:41:49 CST 2015]; root of context hierarchy
13:41:49,117 INFO [factory.xml.XmlBeanDefinitionReader] Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
13:41:49,440 INFO [factory.config.PropertyPlaceholderConfigurer] Loading properties file from ServletContext resource [/WEB-INF/configs/all.properties]
before controller afterPropertiesSe
13:41:49,551 INFO [v2.log.MLog] MLog clients using log4j logging.
13:41:49,720 INFO [v2.c3p0.C3P0Registry] Initializing c3p0-0.9.2.1 [built 20-March-2013 10:47:27 +0000; debug? true; trace: 10]
13:41:50,009 INFO [org.hibernate.Version] HHH000412: Hibernate Core {5.0.2.Final}
13:41:50,011 INFO [hibernate.cfg.Environment] HHH000206: hibernate.properties not found
13:41:50,012 INFO [hibernate.cfg.Environment] HHH000021: Bytecode provider name : javassist
13:41:50,069 INFO [annotations.common.Version] HCANN000001: Hibernate Commons Annotations {5.0.0.Final}
13:41:50,211 INFO [c3p0.impl.AbstractPoolBackedDataSource] Initializing c3p0 pool… com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1k67t389c1lzsplk14o06b0|1dbed0, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.MySQL.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1k67t389c1lzsplk14o06b0|1dbed0, idleConnectionTestPeriod -> 0, initialPoolSize -> 1, jdbcUrl -> jdbc:mysql://127.0.0.1:3306/ntci, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 20, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 20, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 1, numHelperThreads -> 3, preferredTestQuery -> null, properties -> {user=*, password=*}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]
13:42:21,818 WARN [v2.resourcepool.BasicResourcePool] com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@e23d8 – Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
Java.sql.SQLException: Access denied for user ‘tester’@’localhost’ (using password: YES)
- Initializing Spring root WebApplicationContext log4j:WARN No appenders couould be found for logger (
- 解决 WARN No appenders could be found for logger log4j
- log4j:WARN No appenders could be found for logger
- log4j:WARN No appenders could be found for logger
- log4j:WARN No appenders could be found for logger
- log4j:WARN No appenders could be found for logger
- log4j WARN No appenders could be found for logger
- log4j:WARN No appenders could be found for logger
- log4j:WARN No appenders could be found for logger
- log4j:WARN No appenders could be found for logger
- log4j:WARN No appenders could be found for logger
- log4j:WARN No appenders could be found for logger
- log4j:WARN No appenders could be found for logger
- log4j:WARN No appenders could be found for logger
- log4j:WARN No appenders could be found for logger
- log4j:WARN No appenders could be found for logger 解决方案
- log4j:WARN No appenders could be found for logger 解决方案
- log4j:WARN No appenders could be found for logger
- 使PC端网页宽度自适应手机屏幕大小
- DS和[address]
- 初中OJ2105【NOIP2016普及组复赛】魔法阵
- 推荐系统必读的10篇精选技术文章
- 推荐系统中常用算法 以及优点缺点对比
- Initializing Spring root WebApplicationContext log4j:WARN No appenders couould be found for logger (
- mysql索引与范式
- 数据结构之双向链表(C语言实现)
- NULL¬ NULL
- android 网络请求获得返回数据(1)
- spring boot 整合 spring security 之使用数据库验证
- android post请求
- DB2 C language external scalar user-defined function
- C::有趣的约瑟夫环