Grails 2.4.4 + searchable:0.6.9 runtime issues

800 views Asked by At

When trying to add the searchable:0.6.9 (or lesser ones) on a Grails 2.4.4 app I get an exception thrown by hibernate4, but this only happens when I add the "static searchable = true" to my domain class.

Considering that my BuildConfig.groovy looks like this:

repositories {
    inherits true // Whether to inherit repository definitions from plugins

    grailsPlugins()
    grailsHome()
    mavenLocal()
    grailsCentral()
    mavenCentral()

    mavenRepo "https://repo.grails.org/grails/core"
    mavenRepo "https://oss.sonatype.org/content/repositories/releases/"
    mavenRepo "http://repo.spring.io/milestone"

}

dependencies {

    compile "org.compass-project:compass:2.2.1"
    compile('org.apache.lucene:lucene-highlighter:4.10.2',
              'org.apache.lucene:lucene-spellchecker:3.6.2')

    test "org.grails:grails-datastore-test-support:1.0.2-grails-2.4"
    compile "javax.validation:validation-api:1.1.0.Final"
    runtime "org.hibernate:hibernate-validator:5.0.3.Final"
}

plugins {
    // plugins for the build system only
    build ":tomcat:7.0.55"

    // plugins for the compile step
    compile ":scaffolding:2.1.2"
    compile ':cache:1.1.8'
    compile ":asset-pipeline:1.9.9"

    runtime ":hibernate4:4.3.6.1" // or ":hibernate:3.6.10.18"
    runtime ":database-migration:1.4.0"
    runtime ":jquery:1.11.1"
    runtime ":searchable:0.6.9"
}

I get this exception:

ERROR context.GrailsContextLoaderListener - Error initializing the application: org/hibernate/impl/SessionFactoryImpl Message: org/hibernate/impl/SessionFactoryImpl Line | Method ->> 95 | injectLifecycle in org.compass.gps.device.hibernate.lifecycle.DefaultHibernateEntityLifecycleInjector 147 doStart in org.compass.gps.device.hibernate.HibernateGpsDevice

Does someone know how to make things work please?

2

There are 2 answers

0
mohsenmadi On BEST ANSWER

Apparently, the plugins mentioned in the title of this post don't mix! The GG landscape is changing rapidly and Searchable 0.6.9 won't shake hands with Hibernate 4.

Solution? I am currently considering ElasticSearch instead - freshly maintained (as of yesterday in fact) and mixes well with the fresh plugins. Does it do what Searchable does, meaning, ending up eventually with a search field that can be used to retrieve and display records from my searchable domain classes and/or searchable properties within? Will find out and report.

1
Dónal On

I don't think the searchable plugin works with Hibernate 4, but you haven't declared a dependency on any version of Hibernate, which definitely won't work.

In my Grails 2.4.4 app, I use the searchable with the following version of the Hibernate plugin

plugins {
    runtime ':hibernate:3.6.10.18'
    // other plugins
}