编程语言
首页 > 编程语言> > java – Hibernate slf4j异常

java – Hibernate slf4j异常

作者:互联网

我打电话时遇到以下异常
configuration.configure(hibernate.cfg.xml中).buildSessionFactory():

Exception in thread "main" java.lang.NoSuchMethodError: org.slf4j.Logger.isTraceEnabled()Z
    at org.hibernate.type.NullableType.<clinit>(NullableType.java:59)
    at org.hibernate.Hibernate.<clinit>(Hibernate.java:103)
    at org.hibernate.type.TypeFactory.<clinit>(TypeFactory.java:69)
    at org.hibernate.mapping.ManyToOne.getType(ManyToOne.java:49)
    at org.hibernate.mapping.ManyToOne.createForeignKey(ManyToOne.java:62)
    at org.hibernate.cfg.HbmBinder.createProperty(HbmBinder.java:2213)
    at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2170)
    at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2060)
    at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:381)
    at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:295)
    at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:166)
    at org.hibernate.cfg.Configuration.add(Configuration.java:702)
    at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:537)
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:599)
    at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1621)
    at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1589)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1568)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1542)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1462)
    at com.enwelib.server.hibernate.helper.HibernateVendHelper.<init>(HibernateVendHelper.java:47)
    at com.ensarm.crawler.CrawlManager.saveEntity(CrawlManager.java:93)
    at com.ensarm.crawler.CrawlManager.main(CrawlManager.java:30)

解决方法:

方法Logger.isTraceEnabled() 1.4中添加.显然你使用的是旧的,而Hibernate需要更新的版本.修改您的CLASSPATH并使用此库的更新版本(目前为1.6.4).

标签:nosuchmethoderror,java,logging,hibernate,slf4j,slf4j
来源: https://codeday.me/bug/20190902/1789856.html