开发者

Web Project and Hibernate Exception

I 开发者_如何学Cam running a web application that uses Hibernate for data persistence.

Now I have created another webproject and included necessary jar files etc. While fetching data I got an exception.

Exception in thread "main" java.lang.ExceptionInInitializerError
    at com.util.HibernateUtil.<clinit>(Unknown Source)
    at java.lang.J9VMInternals.initializeImpl(Native Method)
    at java.lang.J9VMInternals.initialize(J9VMInternals.java:177)
    at com.core.dao.OpenIncidentDao.getAllOpenIncidents(Unknown Source)
    at Test.main(Test.java:17)
Caused by: org.hibernate.HibernateException: /hibernate.cfg.xml not found
    at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:147)
    at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1405)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1427)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1414)
    ... 5 more

My other web project is running fine. Also hibernate.cfg.xml is in its place. hibernate.cfg.xml is under EarContent/hibernate.cfg.xml


Classpath issue. Check to see which is your project root folder.


There was a problem in calling my hibernate class. I was not calling it from a jsp page. Doing so problem solved.

Before this I was calling it from a java class main method to test it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜