严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:\tomcat_others\webapps\myoa\WEB-INF\classes\applicationContext-common.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.apache.log4j.Logger.isTraceEnabled()Z
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3830)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4337)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.NoSuchMethodError: org.apache.log4j.Logger.isTraceEnabled()Z
at org.slf4j.impl.Log4jLoggerAdapter.isTraceEnabled(Log4jLoggerAdapter.java:81)
at org.hibernate.type.NullableType.<clinit>(NullableType.java:59)
at org.hibernate.Hibernate.<clinit>(Hibernate.java:103)
at org.hibernate.dialect.Dialect.<init>(Dialect.java:179)
at org.hibernate.dialect.MySQLDialect.<init>(MySQLDialect.java:46)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:101)
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:65)
at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:460)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:155)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:814)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:732)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
... 39 more
2008-12-11 19:22:22 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2008-12-11 19:22:22 org.apache.catalina.core.StandardContext start
严重: Context [/myoa] startup failed due to previous errors
2008-12-11 19:22:22 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
2008-12-11 19:22:22 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8088
2008-12-11 19:22:22 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8008
2008-12-11 19:22:22 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/31 config=null
2008-12-11 19:22:22 org.apache.catalina.startup.Catalina start
信息: Server startup in 6515 ms
在spring中配置sessionFactory时候,启动tomcat时总是有上面的错误
搞了一下午我觉得是我的sessionFactory配置有问题呢,原来是tmd的log4j的版本有问题,最后用了log4j-1.2.15.jar就好了
分享到:
相关推荐
log4j.logger.example.MyClass=WARN ``` 四、实践应用 在实际开发中,Log4j 1.2.16广泛应用于系统调试、性能监控、故障排查等场景。通过合理配置,可以有效收集运行时信息,辅助开发者定位问题,提高开发效率。...
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout log4j.appender.FILE.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n ``` 四、实际应用 在实际项目中,Log4j常用于记录用户操作、系统...
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender log4j.appender.CONSOLE.Target=System.out log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout log4j.appender.CONSOLE.layout....
Apache Log4j是Java平台上的一个著名日志记录框架,广泛应用于各种Java应用程序中,包括服务器、Web应用、企业级软件等。Log4j 1.2.16是该框架的一个版本,提供了丰富的日志功能,允许开发者灵活地控制日志信息的...
Apache Log4j_1.2.17 完整依赖包,在jdk1.8.201中测试通过。使用教程https://www.tutorialspoint.com/springmvc/springmvc_log4j.htm
这些接口包括最基本的`org.apache.logging.log4j.Logger`,它是所有日志记录的起点,以及`org.apache.logging.log4j.LogManager`,它负责管理日志配置和日志器实例。API库的主要目标是与实现层解耦,允许开发者在不...
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender log4j.appender.Threshold=DEBUG log4j.appender.CONSOLE.Target=System.out log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout log4j....
import org.apache.log4j.Logger; public class MyClass { private static final Logger logger = Logger.getLogger(MyClass.class); public void myMethod() { logger.debug("Debug message"); logger.info(...
Log4j提供了一个名为`org.apache.log4j.ConsoleAppender`的类,用于将日志输出到控制台,我们可以通过自定义Filter或者继承现有Appender来实现这个功能。 下面是一个简单的示例,展示如何在Log4j配置文件中设置...
<appender name="consoleAppender" class="org.apache.log4j.ConsoleAppender"> <layout class="org.apache.log4j.PatternLayout"> ,SSS} %-5p %c{1}:%L - %m%n"/> <appender name="fileAppender" class="org....
- **设置Layout**:如`log4j.appender.stdout.layout=org.apache.log4j.PatternLayout`,并定义其模式`log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n`,决定日志的显示格式。...
1. **引入依赖**:首先,你需要下载并添加 `org.apache.commons.io` 和 `log4j` 的 JAR 包到你的项目类路径中。在本例中,`io` 包版本为 2.2,而 `log4j` 可用于日志记录,提高程序的可调试性。 2. **配置环境**:...
log4j.appender.R=org.apache.log4j.DailyRollingFileAppender log4j.appender.R.File=./logs/app.log log4j.appender.R.ImmediateFlush=true log4j.appender.R.Append=true log4j.appender.R.Threshold=DEBUG ...
#log4j.logger.java.sql.Connection = INFO #log4j.logger.java.sql.Statement = DEBUG #log4j.logger.java.sql.PreparedStatement = DEBUG #log4j.logger.java.sql.ResultSet = DEBUG #2 定義A1輸出到控制器 ...
org.apache.tools.ant.DefaultLogger org.apache.tools.ant.Diagnostics$1 org.apache.tools.ant.ExitException org.apache.tools.ant.PathTokenizer org.apache.tools.ant.ProjectHelper org.apache.tools.ant...
在Java代码中,你可以通过调用`org.apache.logging.log4j.LogManager.getLogger()`获取一个Logger实例,然后使用它来记录日志信息。 总的来说,Apache Log4j是一个强大且灵活的日志框架,对于开发人员来说,理解和...
org.slf4j.Logger.class org.slf4j.LoggerFactory.class org.slf4j.MDC.class org.slf4j.Marker.class org.slf4j.MarkerFactory.class org.slf4j.helpers.BasicMDCAdapter.class org.slf4j.helpers.BasicMarker....
log4j.appender.Console.layout=org.apache.log4j.PatternLayout log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n log4j.appender.File=org.apache.log4j....
log4j.logger.org.apache.ibatis=DEBUG log4j.logger.jdbc.sqltiming=DEBUG ``` 上述配置将使得Ibatis的SQL语句及其执行时间被输出到控制台。`%d{ABSOLUTE}`是时间戳,`%5p`是日志级别,`%c{1}`是类名,`%L`是行号...
然后使用Logger.getLogger()方法获取日志记录器,而Log4j2需要import org.apache.logging.log4j.Level、org.apache.logging.log4j.LogManager和org.apache.logging.log4j.Logger,使用LogManager.getLogger()方法...