hibernate问题

信息: Reading mappings from resource: /com/handson/testhibernate/entity/student.hbn.xml
org.hibernate.MappingNotFoundException: resource: /com/handson/testhibernate/entity/student.hbn.xml not found
at org.hibernate.cfg.Configuration.addResource(Configuration.java:517)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1511)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1479)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1458)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1432)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1352)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1338)
at com.handson.testhibernate.TestStudent.main(TestStudent.java:19)
请大虾帮忙,解析这个小问题,谢谢,与君共勉!!!
...全文
107 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
magong 2010-09-26
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 bingshanyijiao_fkx 的回复:]
Caused by: java.sql.SQLException: No suitable driver
[/Quote]
URL写得不对,
或者Driver包带得不对。
magong 2010-09-25
  • 打赏
  • 举报
回复
看一下这个xml文件是不是放在了类文件旁边。
仔细看一下是不是config文件中的文件名写得和真实的文件名不一致。
madFatso 2010-09-25
  • 打赏
  • 举报
回复
org.hibernate.MappingNotFoundException: resource: /com/handson/testhibernate/entity/student.hbn.xml not found

没有找到 /com/handson/testhibernate/entity/student.hbn.xml
soli11722984 2010-09-25
  • 打赏
  • 举报
回复
org.hibernate.MappingNotFoundException: resource: /com/handson/testhibernate/entity/student.hbn.xml not found

这个。。。。。还需要怎么解析
thegodofwar 2010-09-25
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 fhzengzhiwu 的回复:]
“/com/handson/testhibernate/entity/student.hbn.xml not found” --没有找到student.hbn.xml啊
student.hbn.xml是student.hbm.xml吧.
[/Quote]
呵呵,应该是这个
小武茶庄 2010-09-25
  • 打赏
  • 举报
回复
“/com/handson/testhibernate/entity/student.hbn.xml not found” --没有找到student.hbn.xml
student.hbn.xml是student.hbm.xml吧.
cnmb1 2010-09-25
  • 打赏
  • 举报
回复
Caused by: java.sql.SQLException: No suitable driver

换个jdbc包
  • 打赏
  • 举报
回复
2010-9-25 17:26:02 org.hibernate.util.JDBCExceptionReporter logExceptions
警告: SQL Error: 0, SQLState: 08001
2010-9-25 17:26:02 org.hibernate.util.JDBCExceptionReporter logExceptions
严重: No suitable driver
Exception in thread "main" org.hibernate.exception.JDBCConnectionException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:420)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
at com.handson.testhibernate.TestStudent.main(TestStudent.java:23)
Caused by: java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
... 5 more
修改之后又报这样的错,刚刚接触hibernate不知道为什么
cnmb1 2010-09-25
  • 打赏
  • 举报
回复
student.hbn.xml
hengxingbao 2010-09-25
  • 打赏
  • 举报
回复
没有根据路径找到对应资源

可能是路径问题,或你根本不存在些MAPPING

50,543

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧