发生了错误。有关详细信息,请参阅错误日志显示java.lang.NullPointerException

时间:2016-05-17 02:47:50

标签: java hibernate

当我想创建文件hibernate.hbm.xml时,eclipse加载错误消息如:

  

"发生了错误。有关详细信息,请参阅错误日志   java.lang.NullPointerException"

为什么呢?

当我运行主文件时,错误系统还有一件事我也会收到错误:

"log4j:WARN No appenders could be found for logger (org.jboss.logging).
 log4j:WARN Please initialize the log4j system properly.
 log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
 Exception in thread "main" java.lang.NoSuchMethodError: org.hibernate.SessionFactory.getCurrentSession()Lorg/hibernate/classic/Session;
 at TestPerson.main(TestPerson.java:29)"

1 个答案:

答案 0 :(得分:0)

Unknown entity: Person,在hibernate配置文件中添加hibernate映射条目。

示例:

<mapping resource="com.Person.hbm.xml"/>