Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
    Bookmark Topic Watch Topic
  • New Topic

java.lang.NullPointerException at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.

 
Jeetu Das
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi All,
I am new to Hibernate . I know the concept .
Now i am designing a applicaton using Hibernate .

I am getting a error , while creating a configuration object .


StackTrace :

May 26, 2012 6:47:36 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet CreateUserServlet threw exception
java.lang.NullPointerException
at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:167)
at org.hibernate.cfg.Environment.<clinit>(Environment.java:608)
at org.hibernate.cfg.Configuration.reset(Configuration.java:330)
at org.hibernate.cfg.Configuration.<init>(Configuration.java:296)
at org.hibernate.cfg.Configuration.<init>(Configuration.java:300)
at com.jitu.core.HibernateUtil.sessionFactory(HibernateUtil.java:13)
at com.jitu.http.server.CreateUserServlet.doPost(CreateUserServlet.java:41)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)



Code :

//Configuration cfg = new Configuration().configure("Hibernate.cfg.xml");
Configuration cfg = new Configuration().addResource("com/jitu/core/Book.hbm.xml")
.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect")
.setProperty("hibernate.connection.driver_class", "oracle.jdbc.driver.OracleDrive")
.setProperty("hibernate.connection.url", "jdbcracle:thin:@TRAINHR1011:1521:RETAILS")
.setProperty("hibernate.connection.username", "fcr")
.setProperty("hibernate.connection.password", "fcr");
SessionFactory sessionFactry = cfg.buildSessionFactory();
Session session = sessionFactry.getCurrentSession();



Please help .



 
Vijitha Kumara
Bartender
Pie
Posts: 3930
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please don't duplicate posts. Continue the discussion in your other thread.
 
    Bookmark Topic Watch Topic
  • New Topic