2014-11-20 81 views
3

当试图在Grails 2.4.4应用程序中添加可搜索的:0.6.9(或更少的)时,我得到了hibernate4抛出的异常,但这只发生在我将“static searchable = true”添加到我的域类中。Grails 2.4.4 +搜索:0.6.9运行时问题

考虑到我的BuildConfig.groovy看起来像这样:

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" 
} 

我得到这个异常:

错误context.GrailsContextLoaderListener - 错误初始化应用程序:组织/休眠/ IMPL/SessionFactoryImpl 消息: org/hibernate/impl/SessionFactoryImpl Line |方法 - >> 95 | injectLifecycle在org.compass.gps.device.hibernate.lifecycle.DefaultHibernateEntityLifecycleInjector 147 DOSTART在org.compass.gps.device.hibernate.HibernateGpsDevice

是否有人知道如何使事情的工作吗?

回答

0

显然,在这篇文章的标题中提到的插件不要混用! GG景观正在迅速变化,并且Searchable 0.6.9不会与Hibernate 4握手。

解决方案?我目前正在考虑ElasticSearch--刚刚维持(截至昨天),并与新插件混合良好。它是否执行了Searchable所做的事情,即最终结束于可用于从我的可搜索域类和/或可搜索属性中检索和显示记录的搜索字段?会查出并报告。

1

我不认为可搜索的插件与Hibernate 4一起工作,但您还没有声明依赖于任何版本的Hibernate,这肯定是行不通的。

在我的Grails 2.4.4的应用程序,我用的是可搜索与Hibernate插件以下版本

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

你是对的,但它只是在粘贴之前错误地删除了依赖项“runtime”:hibernate4:4.3.6.1“”。我现在编辑我的原始帖子,以显示我用来获取该错误的确切设置。 我试过hibernate:3.6.10.18当然,但是我的应用程序甚至不会编译!我正在使用JDK8u25,并且我在Windows 7和Mac OSX 10上都尝试了这一点。我在使用较早的休眠时运行时遇到此问题: 消息:使用名称'transactionManagerPostProcessor'创建bean时出错:Bean初始化失败;嵌套异常是org.springframework.beans.factory.BeanCreationException:... – mohsenmadi 2014-11-21 02:15:06