Search code examples
javajpahbasekundera

Nullpointer exception is thrown while using getResultList() method in Kundera


I am using Kundera as JPA with HBase and java. Following is the method which call getResultList() method:

 @Override
    public List<Activity> getAllActivities()
    {
        em = emf.createEntityManager();        
        Query q = em.createQuery("select ac from Activity ac");
        List<Activity> activities = q.getResultList();
        return activities;
    }

It throws nullpointer exception.

Exception in thread "main" java.lang.NullPointerException
    at com.impetus.kundera.index.IndexManager.search(IndexManager.java:191)
    at com.impetus.kundera.query.LuceneQuery.getResultList(LuceneQuery.java:101)
    at com.impetus.activity.dao.ActivityService.getAllActivities(ActivityService.java:100)
    at ActivityExample.main(ActivityExample.java:44)

P.S : Activity table in HBase has 6 records.
What can be the reason for it?


Solution

  • Please try to add a property mentioned below

    <property name="index_home_dir" value="./lucene" />
    

    in persistence.xml.

    Reason is your there is no default indexing support available with HBase.

    It should work for you.