为了账号安全,请及时绑定邮箱和手机立即绑定

我没有log4j的配置文件 我直接按照老师的文件写了一个 报错

log4j:ERROR Could not instantiate class [org.apache.log4j.Patternlayout].

java.lang.ClassNotFoundException: org.apache.log4j.Patternlayout

at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)

at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:190)

at org.apache.log4j.helpers.Loader.loadClass(Loader.java:198)

at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:327)

at org.apache.log4j.helpers.OptionConverter.instantiateByKey(OptionConverter.java:124)

at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:797)

at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:768)

at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:648)

at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:514)

at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:580)

at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:526)

at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)

at org.apache.log4j.Logger.getLogger(Logger.java:104)

at org.apache.ibatis.logging.log4j.Log4jImpl.<init>(Log4jImpl.java:32)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

at org.apache.ibatis.logging.LogFactory.setImplementation(LogFactory.java:133)

at org.apache.ibatis.logging.LogFactory.useLog4JLogging(LogFactory.java:101)

at org.apache.ibatis.logging.LogFactory$4.run(LogFactory.java:55)

at org.apache.ibatis.logging.LogFactory.tryImplementation(LogFactory.java:123)

at org.apache.ibatis.logging.LogFactory.<clinit>(LogFactory.java:52)

at org.apache.ibatis.executor.loader.javassist.JavassistProxyFactory.<clinit>(JavassistProxyFactory.java:47)

at org.apache.ibatis.session.Configuration.<init>(Configuration.java:126)

at org.apache.ibatis.builder.xml.XMLConfigBuilder.<init>(XMLConfigBuilder.java:82)

at org.apache.ibatis.builder.xml.XMLConfigBuilder.<init>(XMLConfigBuilder.java:66)

at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:51)

at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:38)

at com.uctech.db.DBAccess.getSqlSession(DBAccess.java:32)

at com.uctech.dao.MessageDao.getMessages(MessageDao.java:24)

at com.uctech.service.MessageService.getMessages(MessageService.java:19)

at com.uctech.servlet.MessageServlet.doGet(MessageServlet.java:33)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)

at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:744)

log4j:ERROR No layout set for the appender named [Console].



log4j.rootLogger=DEBUG,Console

log4j.appender.Console=org.apache.log4j.ConsoleAppender

log4j.appender.Console.layout=org.apache.log4j.Patternlayout

log4j.appender.Console.layout.ConversionPatten=%d [%t] %-5p [%c] - %m%n

log4j.logger.org.apache=INFO

斜体 是报错信息   粗体 是根据老师的抄的

正在回答

3 回答

java.lang.ClassNotFoundException: org.apache.log4j.Patternlayout

你应该是没有到log4j的jar包吧??重新导一次完整的

0 回复 有任何疑惑可以回复我~

去掉org  再运行就报java.lang.ClassNotFoundException: org.apache.log4j.Patternlayout

具体报错信息:

log4j:ERROR Could not instantiate class [org.apache.log4j.Patternlayout].


java.lang.ClassNotFoundException: org.apache.log4j.Patternlayout

at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)

at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:190)

at org.apache.log4j.helpers.Loader.loadClass(Loader.java:198)

at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:327)

at org.apache.log4j.helpers.OptionConverter.instantiateByKey(OptionConverter.java:124)

at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:797)

at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:768)

at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:648)

at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:514)

at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:580)

at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:526)

at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)

at org.apache.log4j.Logger.getLogger(Logger.java:104)

at org.apache.ibatis.logging.log4j.Log4jImpl.<init>(Log4jImpl.java:32)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

at org.apache.ibatis.logging.LogFactory.setImplementation(LogFactory.java:133)

at org.apache.ibatis.logging.LogFactory.useLog4JLogging(LogFactory.java:101)

at org.apache.ibatis.logging.LogFactory$4.run(LogFactory.java:55)

at org.apache.ibatis.logging.LogFactory.tryImplementation(LogFactory.java:123)

at org.apache.ibatis.logging.LogFactory.<clinit>(LogFactory.java:52)

at org.apache.ibatis.executor.loader.javassist.JavassistProxyFactory.<clinit>(JavassistProxyFactory.java:47)

at org.apache.ibatis.session.Configuration.<init>(Configuration.java:126)

at org.apache.ibatis.builder.xml.XMLConfigBuilder.<init>(XMLConfigBuilder.java:82)

at org.apache.ibatis.builder.xml.XMLConfigBuilder.<init>(XMLConfigBuilder.java:66)

at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:51)

at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:38)

at com.uctech.db.DBAccess.getSqlSession(DBAccess.java:32)

at com.uctech.dao.MessageDao.getMessages(MessageDao.java:20)

at com.uctech.service.MessageService.getMessages(MessageService.java:19)

at com.uctech.servlet.MessageServlet.doGet(MessageServlet.java:33)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)

at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:744)

log4j:ERROR No layout set for the appender named [Console].


0 回复 有任何疑惑可以回复我~
#1

幕布斯6097550

解决了没有?
2019-04-06 回复 有任何疑惑可以回复我~
#2

qq_慕盖茨356195 回复 幕布斯6097550

解决了,楼主2个单词拼写错误了
2019-04-17 回复 有任何疑惑可以回复我~

log4j.logger.org.apache=INFO这一句中的org不要

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

我没有log4j的配置文件 我直接按照老师的文件写了一个 报错

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信