-->
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.  [ 9 posts ] 
Author Message
 Post subject: Config problem when entity-name attr used in XML mapping
PostPosted: Mon Jan 12, 2009 8:45 pm 
Newbie

Joined: Sun Dec 04, 2005 2:24 pm
Posts: 9
I've used Hibernate Search before very successfully. However I'm having trouble with a new project. I've narrowed the problem to attempting to index classes where I specify an entity-name in the XML map file instead of using the default full class name.

Eg classes starting with:
<class name="com.mydomain.myapp.AnswerImpl" table="answer"
entity-name="Answer">

I use XML for mappings, and annotations to specify which fields to index.

I get the following error/stackdump on application load:

org.hibernate.HibernateException: could not init listeners
at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:205)
at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1338)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at ie.wombat.db.HibernateUtil.<clinit>(HibernateUtil.java:38)
at ie.wombat.db.EndOfRequestCleanup.requestDestroyed(EndOfRequestCleanup.java:77)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:187)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

[stack lines deleted for brevity]

Caused by: java.lang.NullPointerException
at org.hibernate.search.cfg.SearchConfigurationFromHibernateCore.getClassMapping(SearchConfigurationFromHibernateCore.java:31)
at org.hibernate.search.store.DirectoryProviderFactory.getDirectoryProviderName(DirectoryProviderFactory.java:226)
at org.hibernate.search.store.DirectoryProviderFactory.createDirectoryProviders(DirectoryProviderFactory.java:53)
at org.hibernate.search.impl.SearchFactoryImpl.initDocumentBuilders(SearchFactoryImpl.java:404)
at org.hibernate.search.impl.SearchFactoryImpl.<init>(SearchFactoryImpl.java:119)
at org.hibernate.search.event.ContextHolder.getOrBuildSearchFactory(ContextHolder.java:30)
at org.hibernate.search.event.FullTextIndexEventListener.initialize(FullTextIndexEventListener.java:59)
at org.hibernate.event.EventListeners$1.processListener(EventListeners.java:198)
at org.hibernate.event.EventListeners.processListeners(EventListeners.java:181)
at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:194)
... 16 more


I did some debugging. Line 31 at
SearchConfigurationFromHibernateCore.java is:
return cfg.getClassMapping( name ).getMappedClass();

This line works for classes which have no "entity-name" attribute in the XML mapping. However when name="com.mydomain.myapp.AnswerImpl"
I get the NullPointerException mentioned above.

I am using:
hibernate-3.3.1.jar, hibernate-annotations-3.4.0.jar, hibernate-commons-annotations-3.4.0.jar, hibernate-search-3.1.0.jar, lucene-core-2.4.0.jar
on Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Linux OS.


Top
 Profile  
 
 Post subject: Follow up and example application to demonstrate problem
PostPosted: Tue Jan 13, 2009 10:46 pm 
Newbie

Joined: Sun Dec 04, 2005 2:24 pm
Posts: 9
I still haven't been able to make headway on this one, so I have created a small (ish) WAR file which should demonstrate the problem. I've also found a thread discussing a similar problem:
http://forums.hibernate.org/viewtopic.p ... d8600faa24
Unfortunately no resolution to that problem in the thread.

Please find WAR file here (source and test db dump included):
http://cms.galway.net/tmp/HibernateSearchProblem.war

Any help or pointers would be greatly appreciated.

Joe.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 14, 2009 8:57 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
thank you very much, this information and test are very helpful.
Could you please open a new issue?
would it be possible to make a simple unit test to attach to the issue?

http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH

thanks a lot!

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Config problem when entity-name attr used in XML mapping
PostPosted: Thu Jul 09, 2009 5:12 am 
Newbie

Joined: Thu Jul 09, 2009 5:06 am
Posts: 1
Hello,

Is the problem solved or exists a workaround? I can't find the issue for that.

thanks


Top
 Profile  
 
 Post subject: Re: Config problem when entity-name attr used in XML mapping
PostPosted: Thu Jul 09, 2009 8:44 am 
Newbie

Joined: Sun Dec 04, 2005 2:24 pm
Posts: 9
I didn't test it with the latest release. I suspect it's still there. Unfortunately I never got around to registering an account with JIRA and opening a ticket.


Top
 Profile  
 
 Post subject: Re: Config problem when entity-name attr used in XML mapping
PostPosted: Fri Jan 15, 2010 8:51 am 
Newbie

Joined: Fri Jan 15, 2010 8:47 am
Posts: 1
I've run into this problem aswell. I suppose it can be worked around by using annotations for the mappings aswell. Any solutions found?


Top
 Profile  
 
 Post subject: Re: Config problem when entity-name attr used in XML mapping
PostPosted: Fri Jan 15, 2010 12:24 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
sorry, I forgot about this and nobody opened an issue to keep track of it.
I've created HSEARCH-444

A testcase is welcome and could speed things up.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Config problem when entity-name attr used in XML mapping
PostPosted: Wed Feb 17, 2010 3:26 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I can get it to work (in some cases) but I need to understand the reasons why you are using an entity-name.
Are you keeping a 1-1 relationship between an entity-name and a class or are you using entity names to map the same class multiple times.
If the later can you explain your use case?
If the former, well can you explain your reason?

_________________
Emmanuel


Top
 Profile  
 
 Post subject: Re: Config problem when entity-name attr used in XML mapping
PostPosted: Wed Feb 17, 2010 3:26 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Please comment on http://opensource.atlassian.com/project ... SEARCH-444 because I don't follow this forum very closely.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 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.