This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply locked New topic

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

Jeetu Das

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
at org.hibernate.util.ConfigHelper.getResourceAsStream(
at org.hibernate.cfg.Environment.<clinit>(
at org.hibernate.cfg.Configuration.reset(
at org.hibernate.cfg.Configuration.<init>(
at org.hibernate.cfg.Configuration.<init>(
at com.jitu.core.HibernateUtil.sessionFactory(
at com.jitu.http.server.CreateUserServlet.doPost(
at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.coyote.http11.Http11Processor.process(
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(

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

Joined: Mar 24, 2008
Posts: 3826

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

[How to ask questions] [Twitter]
It is sorta covered in the JavaRanch Style Guide.
subject: java.lang.NullPointerException at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.