问题描述
%%%%ErrorCreatingSessionFactory%%%%org.hibernate.HibernateException:JDBCDriverclassnotfound:com.microsoft.sqlserver.jdbc.SQLServerDriveratorg.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:66)atorg.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)atorg.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)atorg.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:414)atorg.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)atorg.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)atorg.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)atcom.dao.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:31)atcom.dao.BaseHibernateDAO.getSession(BaseHibernateDAO.java:14)atcom.entity.PetInfoDAO.findAll(PetInfoDAO.java:151)atcom.test.TestMain.main(TestMain.java:13)Causedby:java.lang.ClassNotFoundException:com.microsoft.sqlserver.jdbc.SQLServerDriveratjava.net.URLClassLoader$1.run(UnknownSource)atjava.security.AccessController.doPrivileged(NativeMethod)atjava.net.URLClassLoader.findClass(UnknownSource)atjava.lang.ClassLoader.loadClass(UnknownSource)atsun.misc.Launcher$AppClassLoader.loadClass(UnknownSource)atjava.lang.ClassLoader.loadClass(UnknownSource)atjava.lang.ClassLoader.loadClassInternal(UnknownSource)atjava.lang.Class.forName0(NativeMethod)atjava.lang.Class.forName(UnknownSource)atorg.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:100)atorg.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:61)...10more%%%%ErrorCreatingSessionFactory%%%%org.hibernate.InvalidMappingException:Couldnotparsemappingdocumentfromresourcecom/entity/PetDiary.hbm.xmlatorg.hibernate.cfg.Configuration.addResource(Configuration.java:569)atorg.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1587)atorg.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1555)atorg.hibernate.cfg.Configuration.doConfigure(Configuration.java:1534)atorg.hibernate.cfg.Configuration.doConfigure(Configuration.java:1508)atorg.hibernate.cfg.Configuration.configure(Configuration.java:1428)atcom.dao.HibernateSessionFactory.rebuildSessionFactory(HibernateSessionFactory.java:69)atcom.dao.HibernateSessionFactory.getSession(HibernateSessionFactory.java:53)atcom.dao.BaseHibernateDAO.getSession(BaseHibernateDAO.java:14)atcom.entity.PetInfoDAO.findAll(PetInfoDAO.java:151)atcom.test.TestMain.main(TestMain.java:13)Causedby:org.hibernate.DuplicateMappingException:Duplicateclass/entitymappingcom.entity.PetDiaryatorg.hibernate.cfg.Mappings.addClass(Mappings.java:118)atorg.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:145)atorg.hibernate.cfg.Configuration.add(Configuration.java:669)atorg.hibernate.cfg.Configuration.addInputStream(Configuration.java:504)atorg.hibernate.cfg.Configuration.addResource(Configuration.java:566)...10moreExceptioninthread"main"java.lang.NullPointerExceptionatcom.entity.PetInfoDAO.findAll(PetInfoDAO.java:151)atcom.test.TestMain.main(TestMain.java:13)这是什么错误??配置文件都是自动生成的但是一用就报这个错
解决方案
解决方案二:
驱动类没有找到,把驱动类加上吧
解决方案三:
有没有高手!来指点一下
解决方案四:
加了没用
解决方案五:
JDBC驱动程序类未找到
解决方案六:
已经放在WEB-INFlib下
解决方案七:
该回复于2011-03-21 13:42:53被版主删除
解决方案八:
org.hibernate.InvalidMappingException:Couldnotparsemappingdocumentfromresourcecom/entity/PetDiary.hbm.xml看下PetDiary.hbm.xml配置文件和PetDiary实体类
解决方案九:
别一报错就到这上面让人帮忙看,这样很不好。你是不是自己看都没看呀,这种普通的异常还是自己解决的好。别一报错就慌就到这个面让别人给你解决
解决方案十:
"Exceptioninthread"main"java.lang.NullPointerException”main方法里还报空指针异常,自己慢慢解决,如果确实找不着原因再把代码贴出来看看
解决方案十一:
驱动不对啊,不然不会报com.microsoft.sqlserver.jdbc.SQLServerDriver
解决方案十二:
缺少驱动包,或者连接串不对!