-->
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: Unexpected error during MassIndexer operation
PostPosted: Wed Aug 28, 2013 6:42 am 
Beginner
Beginner

Joined: Thu Jul 11, 2013 7:58 am
Posts: 22
I am using the following code to create hibernate search index:

Code:
OgmConfiguration cfgogm=new OgmConfiguration();
        cfgogm.configure("hibernate.cfg.xml");
        serviceregistry=new ServiceRegistryBuilder().applySettings(cfgogm.getProperties()).buildServiceRegistry();
        sessionfactory=cfgogm.buildSessionFactory(serviceregistry);         
        Session session=sessionfactory.getCurrentSession();


        FullTextSession fullTextSession = Search.getFullTextSession(session);
        fullTextSession.createIndexer(User.class).startAndWait();


but i get thi sexception:

Code:
but i get thi sexception:

ERROR: HSEARCH000058: HSEARCH000116: Unexpected error during MassIndexer operation
java.lang.NullPointerException
    at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.<init>(AbstractStatementProxyHandler.java:57)
    at org.hibernate.engine.jdbc.internal.proxy.PreparedStatementProxyHandler.<init>(PreparedStatementProxyHandler.java:50)
    at org.hibernate.engine.jdbc.internal.proxy.ProxyBuilder.buildPreparedStatement(ProxyBuilder.java:187)
    at org.hibernate.engine.jdbc.internal.proxy.ConnectionProxyHandler.postProcess(ConnectionProxyHandler.java:167)
    at org.hibernate.engine.jdbc.internal.proxy.ConnectionProxyHandler.continueInvocation(ConnectionProxyHandler.java:139)
    at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
    at com.sun.proxy.$Proxy17.prepareStatement(Unknown Source)
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:147)
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:166)
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:145)
    at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1720)
    at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1697)
    at org.hibernate.loader.Loader.doQuery(Loader.java:832)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:293)
    at org.hibernate.loader.Loader.doList(Loader.java:2382)
    at org.hibernate.loader.Loader.doList(Loader.java:2368)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2198)
    at org.hibernate.loader.Loader.list(Loader.java:2193)
    at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:122)
    at org.hibernate.internal.StatelessSessionImpl.list(StatelessSessionImpl.java:657)
    at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:374)
    at org.hibernate.internal.CriteriaImpl.uniqueResult(CriteriaImpl.java:396)
    at org.hibernate.search.batchindexing.impl.IdentifierProducer.loadAllIdentifiers(IdentifierProducer.java:130)
    at org.hibernate.search.batchindexing.impl.IdentifierProducer.inTransactionWrapper(IdentifierProducer.java:115)
    at org.hibernate.search.batchindexing.impl.IdentifierProducer.run(IdentifierProducer.java:96)
    at org.hibernate.search.batchindexing.impl.OptionallyWrapInJTATransaction.run(OptionallyWrapInJTATransaction.java:135)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)

Aug 28, 2013 12:31:10 PM org.hibernate.search.impl.SimpleIndexingProgressMonitor indexingCompleted


the following is my entity class:

Code:
@Entity
@Indexed
public class User{
    @DocumentId
    @Id
    @GeneratedValue
    private String  id;
    @Field(index= Index.YES,analyze = Analyze.NO,store = Store.YES)
    private String city;
    @Field(index= Index.YES, analyze = Analyze.NO, store = Store.YES)
    private int UserID;


Top
 Profile  
 
 Post subject: Re: Unexpected error during MassIndexer operation
PostPosted: Mon Sep 02, 2013 7:15 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi Baro,
it looks like you're using Hibernate OGM + Search, until recently in this combination the MassIndexer wasn't working fine but this was resolved. I'd suggest you to update both OGM and Search to latest releases.

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


Top
 Profile  
 
 Post subject: Re: Unexpected error during MassIndexer operation
PostPosted: Mon Sep 02, 2013 9:54 am 
Beginner
Beginner

Joined: Thu Jul 11, 2013 7:58 am
Posts: 22
Hi Sanne, thank you for your answer :)

I have updated my Dependency. Now I have:

hibernate-search-4.3.0.Final.jar
hibernate-ogm-core-4.0.0-SNAPSHOT.jar

It seems that my code works :) If I test my code with:

Code:
int res=fulltextquery.getResultSize();


I see 1 in res. If I change the query that doesnt match in DB I see 0, but now I have another problem, I cant see the content of
Code:
fulltextquery.list()
If I am using this code:

Code:
List result=fulltextquery.list();
System.out.println(result.get(0).toString());


I get this exception:

Code:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
   at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.<init>(AbstractStatementProxyHandler.java:57)
   at org.hibernate.engine.jdbc.internal.proxy.PreparedStatementProxyHandler.<init>(PreparedStatementProxyHandler.java:50)
   at org.hibernate.engine.jdbc.internal.proxy.ProxyBuilder.buildPreparedStatement(ProxyBuilder.java:187)
   at org.hibernate.engine.jdbc.internal.proxy.ConnectionProxyHandler.postProcess(ConnectionProxyHandler.java:167)
   at org.hibernate.engine.jdbc.internal.proxy.ConnectionProxyHandler.continueInvocation(ConnectionProxyHandler.java:139)
   at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
   at com.sun.proxy.$Proxy15.prepareStatement(Unknown Source)
   at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:147)
   at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:166)
   at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:145)
   at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1720)
   at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1697)
   at org.hibernate.loader.Loader.doQuery(Loader.java:832)
   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:293)
   at org.hibernate.loader.Loader.doList(Loader.java:2382)
   at org.hibernate.loader.Loader.doList(Loader.java:2368)
   at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2198)
   at org.hibernate.loader.Loader.list(Loader.java:2193)
   at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:122)
   at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1618)
   at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:374)
   at org.hibernate.internal.CriteriaImpl.uniqueResult(CriteriaImpl.java:396)
   at org.hibernate.search.query.hibernate.impl.ObjectLoaderHelper.executeLoad(ObjectLoaderHelper.java:103)
   at org.hibernate.search.query.hibernate.impl.ObjectLoaderHelper.load(ObjectLoaderHelper.java:49)
   at org.hibernate.search.query.hibernate.impl.LookupObjectsInitializer.initializeObjects(LookupObjectsInitializer.java:68)
   at org.hibernate.search.query.hibernate.impl.QueryLoader.executeLoad(QueryLoader.java:90)
   at org.hibernate.search.query.hibernate.impl.AbstractLoader.load(AbstractLoader.java:72)
   at org.hibernate.search.query.hibernate.impl.FullTextQueryImpl.list(FullTextQueryImpl.java:212)
   at hogm.hibernateogm_mongodb.FilterCities.jButton1MouseClicked(FilterCities.java:160)
   at hogm.hibernateogm_mongodb.FilterCities.access$000(FilterCities.java:40)
   at hogm.hibernateogm_mongodb.FilterCities$1.mouseClicked(FilterCities.java:71)
   at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:270)
   at java.awt.Component.processMouseEvent(Component.java:6508)
   at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
   at java.awt.Component.processEvent(Component.java:6270)
   at java.awt.Container.processEvent(Container.java:2229)
   at java.awt.Component.dispatchEventImpl(Component.java:4861)
   at java.awt.Container.dispatchEventImpl(Container.java:2287)
   at java.awt.Component.dispatchEvent(Component.java:4687)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
   at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4501)
   at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
   at java.awt.Container.dispatchEventImpl(Container.java:2273)
   at java.awt.Window.dispatchEventImpl(Window.java:2719)
   at java.awt.Component.dispatchEvent(Component.java:4687)
   at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:729)
   at java.awt.EventQueue.access$200(EventQueue.java:103)
   at java.awt.EventQueue$3.run(EventQueue.java:688)
   at java.awt.EventQueue$3.run(EventQueue.java:686)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
   at java.awt.EventQueue$4.run(EventQueue.java:702)
   at java.awt.EventQueue$4.run(EventQueue.java:700)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:699)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)


how can I solve this problem?


Top
 Profile  
 
 Post subject: Re: Unexpected error during MassIndexer operation
PostPosted: Mon Sep 02, 2013 10:23 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Good that we got you past the massindexer problem!

When using OGM, if you see JDBC operations in the stack, that is likely a bug: OGM should never trigger JDBC operations. I thought that OGM itself was quite stable in this regard, but Hibernate Search occasionally makes use of specific features from Hibernate ORM to optimise loading. I think you got in such a situation that your code is triggering a behaviour of Hibernate Search which is not compatible with OGM, it would be very useful for us if you could describe that better?

Do you have a test case that you could make?

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


Top
 Profile  
 
 Post subject: Re: Unexpected error during MassIndexer operation
PostPosted: Mon Sep 02, 2013 10:31 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
I've opened https://hibernate.atlassian.net/browse/OGM-333 to track this problem. Please add more comments there if you find out more!

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


Top
 Profile  
 
 Post subject: Re: Unexpected error during MassIndexer operation
PostPosted: Mon Sep 02, 2013 11:02 am 
Beginner
Beginner

Joined: Thu Jul 11, 2013 7:58 am
Posts: 22
Hi Sanne,

I do that, I want to solve my Problem ;)


Top
 Profile  
 
 Post subject: Re: Unexpected error during MassIndexer operation
PostPosted: Mon Sep 02, 2013 11:06 am 
Beginner
Beginner

Joined: Thu Jul 11, 2013 7:58 am
Posts: 22
could you please say me, what should I write there? ^^ and Which information do you need from my project?


Top
 Profile  
 
 Post subject: Re: Unexpected error during MassIndexer operation
PostPosted: Mon Sep 02, 2013 11:10 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
If you could add more code, you posted "List result=fulltextquery.list();" but I'm pretty sure we have that working in our tests, so I would need to see some more details, like how you created this fulltextquery, if you're enabling more options and/or filters on it, if you have special options in the configuration, etc..

In short, to see some more of your code.

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


Top
 Profile  
 
 Post subject: Re: Unexpected error during MassIndexer operation
PostPosted: Mon Sep 02, 2013 11:35 am 
Beginner
Beginner

Joined: Thu Jul 11, 2013 7:58 am
Posts: 22
also:

I have a collection in MongoDB. It is Users it contains almost 3000 documents, like this:

Code:
{
  "City" : "Newyork",
  "UserID" : 13509,
  "_id" : "43a5228e40c785850140c78588200000"
}

/* 1 */
{
  "City" : "Washington",
  "UserID" : 38007,
  "_id" : "43a5228e40c785850140c78588410001"
}

/* 2 */
{
  "City" : "Vancouver",
  "UserID" : 93154,
  "_id" : "43a5228e40c786a60140c786a8e50000"
}


I want to implement a very simple search with Lucene search and Hibernate search to finde a city based on UserID (I have indexed the values and I have checked it with Luke) here is my code:

Code:
OgmConfiguration cfgogm=new OgmConfiguration();
        cfgogm.configure("hibernate.cfg.xml");
        serviceregistry=new ServiceRegistryBuilder().applySettings(cfgogm.getProperties()).buildServiceRegistry();
        sessionfactory=cfgogm.buildSessionFactory(serviceregistry); 
        Session session=sessionfactory.openSession();     
        FullTextSession fulltextsession= Search.getFullTextSession(session); 
        QueryBuilder querybuilder=fulltextsession.getSearchFactory().buildQueryBuilder().forEntity(User.class).get();
        org.apache.lucene.search.Query lucenequery=querybuilder.keyword().onField("UserID").matching(new Integer(106663)).createQuery();     
        org.hibernate.search.FullTextQuery fulltextquery=fulltextsession.createFullTextQuery( lucenequery,User.class );
        fulltextquery.initializeObjectsWith(ObjectLookupMethod.SKIP, DatabaseRetrievalMethod.FIND_BY_ID);
        int res=fulltextquery.getResultSize();
        fulltextquery.setMaxResults(100);
        List result=fulltextquery.list();
        System.out.println(result.size());


in my pom.xml I have:

Code:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>hogm</groupId>
  <artifactId>HibernateOGM_MongoDB</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>
  <name>HibernateOGM_MongoDB</name>
  <url>http://maven.apache.org</url>
<dependencies>
     <dependency>
         <groupId>org.hibernate.ogm</groupId>
         <artifactId>hibernate-ogm-mongodb</artifactId>
         <version>4.0.0-SNAPSHOT</version>
     </dependency>
     <dependency>
         <groupId>org.hibernate.ogm</groupId>
         <artifactId>hibernate-ogm-core</artifactId>
         <version>4.0.0-SNAPSHOT</version>
     </dependency> 
     <dependency>
    <groupId>org.mongodb</groupId>
    <artifactId>mongo-java-driver</artifactId>
    <version>2.10.1</version>
</dependency>
  <dependency>
   <groupId>junit</groupId>
   <artifactId>junit</artifactId>
   <version>4.11</version>
   <scope>test</scope>
   <type>jar</type>
  </dependency>
  <dependency>
   <groupId>org.hibernate</groupId>
   <artifactId>hibernate-search</artifactId>
   <version>4.3.0.Final</version>
  </dependency>
  <dependency>

   <groupId>org.hibernate</groupId>
   <artifactId>hibernate-entitymanager</artifactId>
   <version>4.2.2.Final</version>
</dependency>
 
  <dependency>
   <groupId>org.apache.avro</groupId>
   <artifactId>avro</artifactId>
   <version>1.6.3</version>
  </dependency>
  <dependency>
   <groupId>org.apache.lucene</groupId>
   <artifactId>lucene-core</artifactId>
   <version>3.6.2</version>
   <type>jar</type>
  </dependency>
  <dependency>
   <groupId>org.jboss.jbossts</groupId>
   <artifactId>jbossjta</artifactId>
   <version>4.16.4.Final</version>
  </dependency>
</dependencies>
</project>


in hibernate.cfg.xml:

Code:
<hibernate-configuration>
  <session-factory>
    <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
    <property name="hibernate.current_session_context_class">thread</property>
    <property name="hibernate.ogm.datastore.provider">MONGODB</property>
    <property name="hibernate.ogm.mongodb.database">rcfdb</property>
    <property name="hibernate.ogm.mongodb.host">127.0.0.1</property>
    <property name="hibernate.ogm.mongodb.port">27017</property>
    <property name="hibernate.search.default.directory_provider">filesystem</property>
    <property name="hibernate.search.default.indexBase">./Indexes</property>
    <property name="hibernate.search.default.locking_strategy">single</property>
    <mapping resource="hibernate-contact.hbm.xml"/>
  </session-factory>
</hibernate-configuration>


and in hibernate-contact.hbm.xml:
Code:
<?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="Untersuchungsraum.User" table="Users">
  <id  column="id" type="java.lang.String" >
      <generator class="uuid">
      </generator>
  </id>
  <property name="city" type="java.lang.String">
      <column name="City"></column>
  </property>

  <property name="UserID" type="java.lang.Integer">
      <column  name="UserID"></column>
  </property>
  </class>
  </hibernate-mapping>


My dependency folder looks like this:

Image


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.