-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: getFullTextEntityManager Null Pointer Exception
PostPosted: Sun Jul 11, 2010 5:01 pm 
Newbie

Joined: Mon Oct 26, 2009 3:38 pm
Posts: 18
When I try to get the FullTextEntityManager I continually get the error below. Anyone know what could be causing this? I'm using Hibernate Search 3.2.0, Hibernate Core & Entity-Manager 3.5.1, Lucene 2.9.2

Quote:
Caused by: java.lang.NullPointerException
at org.hibernate.search.jpa.impl.FullTextEntityManagerImpl.getFullTextSession(FullTextEntityManagerImpl.java:62)
at org.hibernate.search.jpa.impl.FullTextEntityManagerImpl.createFullTextQuery(FullTextEntityManagerImpl.java:98)
at com.facility.ws.search.BasicSearch.buildJpaQuery(BasicSearch.java:69)


This is the method were the exception (at the line where static method getFullTextEntityManager() is called):
Code:
public org.hibernate.search.jpa.FullTextQuery buildJpaQuery(org.apache.lucene.search.Query luceneQuery, Class entity) {
        FullTextEntityManager ftem = org.hibernate.search.jpa.Search.getFullTextEntityManager(em);
        org.hibernate.search.jpa.FullTextQuery query = ftem.createFullTextQuery(luceneQuery, entity);
        return query;
}


Top
 Profile  
 
 Post subject: Re: getFullTextEntityManager Null Pointer Exception
PostPosted: Mon Jul 12, 2010 4:38 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

are you sure your entity manager is not null? The line throwing the NullPointerException is:

Code:
Object delegate = em.getDelegate();


Seems to me that em must be null.

--Hardy


Top
 Profile  
 
 Post subject: Re: getFullTextEntityManager Null Pointer Exception
PostPosted: Mon Jul 12, 2010 7:46 pm 
Newbie

Joined: Mon Oct 26, 2009 3:38 pm
Posts: 18
hardy.ferentschik wrote:
Hi,

are you sure your entity manager is not null?

Seems to me that em must be null.

--Hardy

You're right, the entity manager was null. I mistakenly directly instantiated the class rather than relying on Spring DI to provide an instance of the class, hence circumventing the DI process and thus resulting in a null em.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.