Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8400471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:34:05+00:00 2026-06-09T21:34:05+00:00

i written a simple web application registering users. but iam getting error as below.

  • 0

i written a simple web application registering users.
but iam getting error as below.

INFO: Configuration resource: /com/vaannila/config/adminuser.hbm.xml
java.lang.NullPointerException
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1399)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1378)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1298)
    at com.vaannila.utility.FactoryUtil.<clinit>(FactoryUtil.java:18)
    at com.vaannila.service.AdminUserBO.addUser(AdminUserBO.java:17)
    at com.vaannila.delegate.AdminUserBusinessDelegate.addUser(AdminUserBusinessDelegate.java:11)
    at com.vaannila.action.AdminUserAction.addUser(AdminUserAction.java:27)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
    at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    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)
    at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
    at com.vaannila.service.AdminUserBO.addUser(AdminUserBO.java:17)
    at com.vaannila.delegate.AdminUserBusinessDelegate.addUser(AdminUserBusinessDelegate.java:11)
    at com.vaannila.action.AdminUserAction.addUser(AdminUserAction.java:27)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
    at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    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)
    at java.lang.Thread.run(Unknown Source)
1123damuammudamodardamuchinni@gmail.com

Also below is the code at FactoryUtil class and BO class

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class FactoryUtil {
    //Static Session Factory
        private static org.hibernate.SessionFactory sessionFactory;

        private FactoryUtil() {}

        static {

            //Creates the SessionFactory based on the XML Configuration
            try{
            Configuration configs = new Configuration();
            sessionFactory = configs.configure("/com/vaannila/config/adminuser.hbm.xml").buildSessionFactory();
            }catch(Exception e){
                e.printStackTrace();
            }
        }

        public static SessionFactory getInstance() {
            return sessionFactory;
        }

        public Session openSession() {
            return sessionFactory.openSession();
        }

        public Session getCurrentSession() {
            return sessionFactory.getCurrentSession();
        }

        public static void close() {
            if (sessionFactory != null)
                sessionFactory.close();
            sessionFactory = null;
        }

        public static FactoryUtil getSessionFactory() {
            // TODO Auto-generated method stub
            return null;
        }

}

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.Transaction;

import com.vaannila.domain.AdminUserVO;
import com.vaannila.utility.FactoryUtil;

public class AdminUserBO {



    public void addUser(AdminUserVO auserVO) {
        // TODO Auto-generated method stub

        Session session = FactoryUtil.getInstance().openSession();
        Transaction transaction = null;
        Long singerId = null;

        try {
            transaction = session.beginTransaction();
            AdminUserVO userVO = new AdminUserVO();
            singerId = (Long)session.save(userVO);
            transaction.commit();
        }
        catch (HibernateException e) {
            transaction.rollback();
            e.printStackTrace();
        }
        finally {
            session.close();
        }


    }

}

Below is the mapping file.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.vaannila.domain.AdminUserVO" table="users">
<id name="userId" type="int" column="userId" >
<generator class="increment"/>
</id>
<property name="userName">
<column name="userNm" />
</property>
<property name="password">
<column name="password" />
</property>
<property name="emailAddress">
<column name="emailId" />
</property>

</class>
</hibernate-mapping>

Please can anyone suggest me to resolve above issue

Edit

public class AdminUserVO implements java.io.Serializable{
    private String userName;
    private String userId;
    private String password;
    private String emailAddress;

    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
    public String getUserId() {
        return userId;
    }
    public void setUserId(String userId) {
        this.userId = userId;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public String getEmailAddress() {
        return emailAddress;
    }
    public void setEmailAddress(String emailAddress) {
        this.emailAddress = emailAddress;
    }

}


User Name  damodar
User Id  damuammu
Password  1123
Email Address  damuchinni@gmail.com

Above is the data iam entering same is been printed in the stacttrace also.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:34:06+00:00Added an answer on June 9, 2026 at 9:34 pm

    The Hibernate configure method

    public Configuration configure(String resource)
                            throws HibernateException
    

    should take a path to your hibernate.cfg.xml file, NOT to a mapping file. See http://docs.jboss.org/hibernate/orm/3.5/api/org/hibernate/cfg/Configuration.html#configure%28java.lang.String%29.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a simple web Application which is running(on Tomcat Server) fine on
I have a fairly simple data audit web application written with ASP MVC which
I've written a simple PHP nusoap web service for an application and wish to
I have my web application written in Spring MVC. It is quite simple app
I've written a simple web application, which I want to be able to post
I've written a simple Java Console Application in Eclipse that references a WCF web
I have a simple web application written in java which has servlets accessing the
I try to develop a simple web application, but to exclude all the possibilities
I have a simple application written that allows users to pick inventory items with
I've written a simple web application using asp.net mvc3 and I have a login

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.