简体   繁体   中英

Grails hibernate/Searchable stops server to start by giving the exception below

We are using Grails 2.1.1 and Searchable plugin 0.6.4 in our Grails applications and implemented searchable on some domains which are indicated below with all the mappings.

class User {
      .....
      static hasMany = [userEducations : UserEducations , userWorkings : UserWorkings ]
      ......
      static searchable = {
        content: spellCheck 'include'
        all termVector: "yes"
        userEducations  component: true
        userWorkings component: true
      }
      ......
}

class UserEducations {
    .....
    Schools schools 
    .....
    static belongsTo = [user : User ]
    ......
    static searchable = {
        content: spellCheck 'include'
        all termVector: "yes"
        schools  component: true
    }
      ......
}

class UserWorkings {
      .....
      Organizations organizations 
      .....
     static belongsTo = [user : User ]
     ....
     static searchable = {
        content: spellCheck 'include'
        all termVector: "yes"
        organizations  component: true
     }
     ......
}

class Schools {
      ......
      static searchable = true
      ......
}

class Organizations {
      ......
       static searchable = true
      ......
}

The data is saving successfully with correct mapping and constraints.

The problem starts when we have the drowslike below in table user with relationship

User a1 -> UserEducations b1 -> Schools d1

and

User a2 -> UserEducations b2 -> Schools d1

or

User a1 -> UserWorkings c1 -> Organizations e1

and

User a2 - > UserWorkings c2 -> Organizations e1

(We are not sure about above fact may be the problem happened due to large no. of data.)

Then when we try to start the server then we receive below exception and server wouldn't start

We have tried by removing searchable index and restarting again then it also not start.

The server starts only when we truncate tables corresponding to above 5 domains.

18:30:54,133 [Compass Gps Index [pool-5-thread-5]] ERROR indexer.ScrollableHibernateIndexEntitiesIndexer  - {hibernate}: Failed to index the database
org.compass.core.engine.SearchEngineException: Processor [4]: Failed to add job [Job Create [alias [Organizations] uid [Organizations#456#]] Resource [{Organizations} [stored/uncompressed,indexed,omitNorms<alias:Organizations>],[stored/uncompressed,indexed,omitNorms,omitTf<$/Organizations/id:456>],[stored/uncompressed,indexed<active:true>],[stored/uncompressed,indexed<dateCreated:2013-02-28-14-03-05-0-PM>],[stored/uncompressed,indexed,tokenized<aaa:109122482450911>],[stored/uncompressed,indexed<lastUpdated:2013-02-28-14-03-05-0-PM>],[stored/uncompressed,indexed,tokenized<name:Asc>],[stored/uncompressed,indexed<version:0>],[stored/uncompressed,indexed,omitNorms,omitTf<$/uid:Bs#456#>]]] after [10000ms] and backlog size [100]
        at org.compass.core.lucene.engine.transaction.support.AbstractConcurrentTransactionProcessor$Processor.addJob(AbstractConcurrentTransactionProcessor.java:496)
        at org.compass.core.lucene.engine.transaction.support.AbstractConcurrentTransactionProcessor.create(AbstractConcurrentTransactionProcessor.java:158)
        at org.compass.core.lucene.engine.LuceneSearchEngine.createOrUpdate(LuceneSearchEngine.java:290)
        at org.compass.core.lucene.engine.LuceneSearchEngine.create(LuceneSearchEngine.java:268)
        at org.compass.core.impl.DefaultCompassSession.create(DefaultCompassSession.java:413)
        at org.compass.core.impl.DefaultCompassSession.create(DefaultCompassSession.java:397)
        at org.compass.core.impl.ExistingCompassSession.create(ExistingCompassSession.java:305)
        at org.compass.gps.device.hibernate.indexer.ScrollableHibernateIndexEntitiesIndexer$RowBuffer.flush(ScrollableHibernateIndexEntitiesIndexer.java:212)
        at org.compass.gps.device.hibernate.indexer.ScrollableHibernateIndexEntitiesIndexer$RowBuffer.close(ScrollableHibernateIndexEntitiesIndexer.java:206)
        at org.compass.gps.device.hibernate.indexer.ScrollableHibernateIndexEntitiesIndexer.performIndex(ScrollableHibernateIndexEntitiesIndexer.java:151)
        at org.compass.gps.device.support.parallel.ConcurrentParallelIndexExecutor$1$1.doInCompassWithoutResult(ConcurrentParallelIndexExecutor.java:104)
        at org.compass.core.CompassCallbackWithoutResult.doInCompass(CompassCallbackWithoutResult.java:29)
        at org.compass.core.CompassTemplate.execute(CompassTemplate.java:133)
        at org.compass.gps.impl.SingleCompassGps.executeForIndex(SingleCompassGps.java:147)
        at org.compass.gps.device.support.parallel.ConcurrentParallelIndexExecutor$1.call(ConcurrentParallelIndexExecutor.java:102)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:679)

Our problem is similar to below post

http://grails.1312388.n4.nabble.com/hibernate-Searchable-failing-to-index-on-program-start-td4119566.html

We have tried our best to sort out the problem but no luck. Please help us to solve this problem.

Go to your console and enter:

grails install-searchable-config

Then open myproject/grails-app/conf/Searchable.groovy and search for the following and change the values as I pointed out.

mirrorChanges = false
bulkIndexOnStartup = false

in Bootstrap.groovy:

class BootStrap {
   def searchableService

   def init = { servletContext ->
      // do any data loading you would normally do

      // Manually start the mirroring process to ensure that it comes after the automated migrations.
      println "Performing bulk index"
      searchableService.reindex()
      println "Starting mirror service"
      searchableService.startMirroring()
   }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM