Announcement Announcement Module
Collapse
No announcement yet.
java.lang.NullPointerException Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • java.lang.NullPointerException

    Hi there,

    I am working in a Spring-Hibernate environment
    I am trying to call a method in a file that implements an interface
    I got the following error message when I look into the log

    2006-10-10 11:29:17,504 INFO [springext.web.filter.RequestFilter] - request for [/dashboard.do]
    2006-10-10 11:29:17,535 DEBUG [eu.cec.immogest.services.impl.RealestateServicesIm pl] - .......getDashBoard.......
    2006-10-10 11:29:17,535 DEBUG [eu.cec.immogest.services.impl.RealestateServicesIm pl] - .......getRentingContracts.......
    2006-10-10 11:29:17,550 ERROR [org.springframework.web.servlet.DispatcherServlet] - Could not complete request
    java.lang.NullPointerException

    The error is happening just after the variable tbContractDocs get the value of what is returned by the getRentingContracts method

    Here is the file that calls the method

    private TbContractualDocExtDAO tbContractualDocExtDAO;

    public void setTbContractualDocExtDAO(TbContractualDocExtDAO tbContractualDocExtDAO) {
    this.tbContractualDocExtDAO = tbContractualDocExtDAO;
    }

    public List getRentingContracts() {

    LOG.debug(".......getRentingContracts.......");
    List tbContractDocs = tbContractualDocExtDAO.findAllRentingContracts();



    Here is the method that is called. Apparently, the method is not called because I can't see the debug in the method



    package eu.cec.immogest.realestate.dao;


    import java.util.Date;


    import net.sf.hibernate.Criteria;
    import net.sf.hibernate.HibernateException;
    import net.sf.hibernate.expression.Expression;
    import org.springframework.orm.hibernate.SessionFactoryUt ils;
    import eu.cec.immogest.realestate.base.BaseTbContractualD ocDAO;
    import eu.cec.immogest.services.impl.RealestateServicesIm pl;

    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;


    public class TbContractualDocExtDAO extends BaseTbContractualDocDAO {

    /**
    * Default constructor. Can be used in place of getInstance()
    */

    private static final Log LOG = LogFactory
    .getLog(RealestateServicesImpl.class);


    public TbContractualDocExtDAO () {}
    /**
    * Return all objects related to the implementation of this DAO with no filter.
    * Use the session given.
    * @param s the Session
    */

    public java.util.List findAllRentingContracts() {
    LOG.debug(".......findAllRentingContracts 1 before criteria.......");
    try {
    LOG.error(".......findAllRentingContracts 2 before criteria.......");
    LOG.debug(".......findAllRentingContracts 3 before criteria.......");

    Criteria crit = SessionFactoryUtils.getSession(getSessionFactory() , false).createCriteria(getReferenceClass());

    LOG.error(".......findAllRentingContracts.......") ;
    LOG.debug(".......findAllRentingContracts.......") ;

    //Date date = new Date();
    //crit.add(Expression.eq("Active","Y"));
    //crit.add(Expression.eq("Active","Y"));
    //crit.add(Expression.like("ShortDescription","descr ipt%"));
    //crit.add((Expression.eq("Category.Id",new Integer(1))));

    //crit.createCriteria("TbContractRents").add(Express ion.lt("EndDate",date));
    LOG.debug(".......findAllRentingContracts after create Criteria.......");

    return crit.list();
    } catch (HibernateException ex) {
    LOG.debug(".......findAllRentingContracts after create Criteria in exception.......");
    throw SessionFactoryUtils.convertHibernateAccessExceptio n(ex);
    }
    }

    }


    Could somebody help me understand what is going wrong?

    Thank you.

    Loranbe

  • #2
    Does this have anything to do with Spring Web Flow?
    If not, try the DAO forum.

    Erwin

    Comment

    Working...
    X