你日志接口用的是slf4j,底层日志实现用的是log4j,根据slf4j的规定,你需要一个slf4j到log4j的转换jar包
回复
@追逐梦想:我回答的是针对的第一个错误,但你已经加了slf4j-nop-1.5.2.jar,就不需要加slf4j-log4j12-1.5.8.jar我下载添加了你说的那个slf4j-log4j12-1.5.8.jar出现了下面的情况。。。又出现错误了.... java.lang.ClassNotFoundException:org.slf4j.impl.StaticLoggerBinder 帮我看看...怎么解决啊?缺包,slf.lar,或者工程发部有问题
缺少
slf4j-nop-1.5.2.jar包,导入即可。
下载地址:
http://download.csdn.net/detail/jianfan_k/3545292
http://ishare.iask.sina.com.cn/f/11298521.html?retcode=0
看一下新的错误InitialSessionFactorycreationfailed.org.hibernate.InvalidMappingException:Couldnotparsemappingdocumentfromresourcecom/pb/hibernate/po/Login.hbm.xml
Exceptioninthread"main"java.lang.ExceptionInInitializerError
atcom.pb.hibernate.util.HibernateUtil.<clinit>(HibernateUtil.java:20)
atcom.pb.hibernate.dao.LoginDao.save(LoginDao.java:15)
atcom.pb.hibernate.test.Test.main(Test.java:15)
Causedby:org.hibernate.InvalidMappingException:Couldnotparsemappingdocumentfromresourcecom/pb/hibernate/po/Login.hbm.xml
atorg.hibernate.cfg.Configuration.addResource(Configuration.java:616)
atorg.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1635)
atorg.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1603)
atorg.hibernate.cfg.Configuration.doConfigure(Configuration.java:1582)
atorg.hibernate.cfg.Configuration.doConfigure(Configuration.java:1556)
atorg.hibernate.cfg.Configuration.configure(Configuration.java:1476)
atorg.hibernate.cfg.Configuration.configure(Configuration.java:1462)
atcom.pb.hibernate.util.HibernateUtil.<clinit>(HibernateUtil.java:14)
...2more
Causedby:org.hibernate.InvalidMappingException:Couldnotparsemappingdocumentfrominputstream
atorg.hibernate.cfg.Configuration.addInputStream(Configuration.java:555)
atorg.hibernate.cfg.Configuration.addResource(Configuration.java:613)
...9more
Causedby:org.dom4j.DocumentException:Erroronline15ofdocument :元素类型"class"必须由匹配的结束标记"</class>"终止。Nestedexception:元素类型"class"必须由匹配的结束标记"</class>"终止。
atorg.dom4j.io.SAXReader.read(SAXReader.java:482)
atorg.hibernate.cfg.Configuration.addInputStream(Configuration.java:546)
...10more
大家帮帮我啦。。。
SLF4J:ClasspathcontainsmultipleSLF4Jbindings.
SLF4J:Foundbindingin[jar:file:/C:/Users/supermanxkq/Desktop/slf4j-nop-1.5.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J:Foundbindingin[jar:file:/C:/Users/supermanxkq/Desktop/slf4j-log4j12-1.5.8%20(1).jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J:See
http://www.slf4j.org/codes.html#multiple_bindingsforanexplanation.
InitialSessionFactorycreationfailed.org.hibernate.MappingNotFoundException:resource:com/pb/hibernate/po/Login/hbm/xmlnotfound
Exceptioninthread"main"java.lang.ExceptionInInitializerError
atcom.pb.hibernate.util.HibernateUtil.<clinit>(HibernateUtil.java:17)
atcom.pb.hibernate.dao.LoginDao.save(LoginDao.java:15)
atcom.pb.hibernate.test.Test.main(Test.java:15)
Causedby:org.hibernate.MappingNotFoundException:resource:com/pb/hibernate/po/Login/hbm/xmlnotfound
atorg.hibernate.cfg.Configuration.addResource(Configuration.java:610)
atorg.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1635)
atorg.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1603)
atorg.hibernate.cfg.Configuration.doConfigure(Configuration.java:1582)
atorg.hibernate.cfg.Configuration.doConfigure(Configuration.java:1556)
atorg.hibernate.cfg.Configuration.configure(Configuration.java:1476)
atorg.hibernate.cfg.Configuration.configure(Configuration.java:1462)
atcom.pb.hibernate.util.HibernateUtil.<clinit>(HibernateUtil.java:13)
...2more
无效的配置文件,你的Login.hbm.xml配置有错吧
回复
@追逐梦想:可能是数据库版本、jdbc驱动、方言配置等没有匹配嗯,我的login.hbm.xml在hibernate.cfg.xml中指定映射文件的完整路径的时候写成了login/hbm/xml,然后改过来之后又出现了这个问题。。。
log4j:WARNNoappenderscouldbefoundforlogger(org.hibernate.cfg.Environment).
log4j:WARNPleaseinitializethelog4jsystemproperly.
log4j:WARNSee
http://logging.apache.org/log4j/1.2/faq.html#noconfigformoreinfo.
InitialSessionFactorycreationfailed.org.hibernate.HibernateException:Unabletoaccessjava.sql.DatabaseMetaDatatodetermineappropriateDialecttouse
Exceptioninthread"main"java.lang.ExceptionInInitializerError
atcom.pb.hibernate.util.HibernateUtil.<clinit>(HibernateUtil.java:17)
atcom.pb.hibernate.dao.LoginDao.save(LoginDao.java:15)
atcom.pb.hibernate.test.Test.main(Test.java:15)
Causedby:org.hibernate.HibernateException:Unabletoaccessjava.sql.DatabaseMetaDatatodetermineappropriateDialecttouse
atorg.hibernate.dialect.resolver.DialectFactory.determineDialect(DialectFactory.java:141)
atorg.hibernate.dialect.resolver.DialectFactory.buildDialect(DialectFactory.java:97)
atorg.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:117)
atorg.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2119)
atorg.hibernate.cfg.Configuration.buildSettings(Configuration.java:2115)
atorg.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1339)
atcom.pb.hibernate.util.HibernateUtil.<clinit>(HibernateUtil.java:13)
...2more
Causedby:java.sql.SQLException:不支持的特性
atoracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
atoracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
atoracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
atoracle.jdbc.dbaccess.DBError.throwUnsupportedFeatureSqlException(DBError.java:689)
atoracle.jdbc.OracleDatabaseMetaData.getDatabaseMajorVersion(OracleDatabaseMetaData.java:4442)
atorg.hibernate.dialect.resolver.DialectFactory.determineDialect(DialectFactory.java:131)
...8more