aspose file tools*
The moose likes Object Relational Mapping and the fly likes java.lang.NullPointerException 	at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply locked New topic
Author

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

Jeetu Das
Greenhorn

Joined: May 12, 2012
Posts: 12
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

Joined: Mar 24, 2008
Posts: 3855

Please don't duplicate posts. Continue the discussion in your other thread.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
 
Don't get me started about those stupid light bulbs.
 
subject: java.lang.NullPointerException at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.