带有可搜索插件的grails应用抛出NoClassDefFoundError



我正在尝试使用grails独立应用程序运行器插件(v.1.3)构建一个独立的grails (v.2.5.0)应用程序。使用run-app和run-war,一切工作正常,我还可以将WAR文件部署到tomcat 7实例中,而不会出现任何问题。但是,如果我用grails build-standalone构建一个独立的JAR,由于下面的ClassNotFoundException,我无法启动JAR:

2015-08-17 10:52:48,523 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener  - Error initializing the application: Error creating bean with name 'searchableMethodFactory': Cannot resolve reference to bean 'compass' while setting bean property 'compass'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compass': FactoryBean threw exception on object creation; nested exception is java.lang.NoClassDefFoundError: grails/plugin/searchable/internal/compass/mapping/DefaultSearchableCompassClassMappingXmlBuilder$_buildClassMappingXml_closure1$_closure4$_closure12$_closure13
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'searchableMethodFactory': Cannot resolve reference to bean 'compass' while setting bean property 'compass'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compass': FactoryBean threw exception on object creation; nested exception is java.lang.NoClassDefFoundError: grails/plugin/searchable/internal/compass/mapping/DefaultSearchableCompassClassMappingXmlBuilder$_buildClassMappingXml_closure1$_closure4$_closure12$_closure13
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compass': FactoryBean threw exception on object creation; nested exception is java.lang.NoClassDefFoundError: grails/plugin/searchable/internal/compass/mapping/DefaultSearchableCompassClassMappingXmlBuilder$_buildClassMappingXml_closure1$_closure4$_closure12$_closure13
    ... 4 more
Caused by: java.lang.NoClassDefFoundError: grails/plugin/searchable/internal/compass/mapping/DefaultSearchableCompassClassMappingXmlBuilder$_buildClassMappingXml_closure1$_closure4$_closure12$_closure13
    at grails.plugin.searchable.internal.compass.mapping.DefaultSearchableCompassClassMappingXmlBuilder$_buildClassMappingXml_closure1$_closure4$_closure12.doCall(DefaultSearchableCompassClassMappingXmlBuilder.groovy:188)
    at grails.plugin.searchable.internal.compass.mapping.DefaultSearchableCompassClassMappingXmlBuilder$_buildClassMappingXml_closure1$_closure4.doCall(DefaultSearchableCompassClassMappingXmlBuilder.groovy:187)
    at grails.plugin.searchable.internal.compass.mapping.DefaultSearchableCompassClassMappingXmlBuilder$_buildClassMappingXml_closure1.doCall(DefaultSearchableCompassClassMappingXmlBuilder.groovy:72)
    at grails.plugin.searchable.internal.compass.mapping.DefaultSearchableCompassClassMappingXmlBuilder.buildClassMappingXml(DefaultSearchableCompassClassMappingXmlBuilder.groovy:65)
    at grails.plugin.searchable.internal.compass.config.mapping.SearchableClassPropertySearchableGrailsDomainClassMappingConfigurator.configureMappings(SearchableClassPropertySearchableGrailsDomainClassMappingConfigurator.java:99)
    at grails.plugin.searchable.internal.compass.config.DefaultGrailsDomainClassMappingSearchableCompassConfigurator.configure(DefaultGrailsDomainClassMappingSearchableCompassConfigurator.java:140)
    at grails.plugin.searchable.internal.compass.config.CompositeSearchableCompassConfigurator.configure(CompositeSearchableCompassConfigurator.java:39)
    at grails.plugin.searchable.internal.compass.spring.SearchableCompassFactoryBean.buildCompass(SearchableCompassFactoryBean.java:93)
    at grails.plugin.searchable.internal.compass.spring.SearchableCompassFactoryBean.getObject(SearchableCompassFactoryBean.java:58)
    at grails.plugin.searchable.internal.compass.spring.SearchableCompassFactoryBean.getObject(SearchableCompassFactoryBean.java:41)
    ... 4 more
Caused by: java.lang.ClassNotFoundException: grails.plugin.searchable.internal.compass.mapping.DefaultSearchableCompassClassMappingXmlBuilder$_buildClassMappingXml_closure1$_closure4$_closure12$_closure13
    ... 14 more
2015-08-17 10:52:48,528 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener  - Error initializing Grails: Error creating bean with name 'searchableMethodFactory': Cannot resolve reference to bean 'compass' while setting bean property 'compass'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compass': FactoryBean threw exception on object creation; nested exception is java.lang.NoClassDefFoundError: grails/plugin/searchable/internal/compass/mapping/DefaultSearchableCompassClassMappingXmlBuilder$_buildClassMappingXml_closure1$_closure4$_closure12$_closure13
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'searchableMethodFactory': Cannot resolve reference to bean 'compass' while setting bean property 'compass'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compass': FactoryBean threw exception on object creation; nested exception is java.lang.NoClassDefFoundError: grails/plugin/searchable/internal/compass/mapping/DefaultSearchableCompassClassMappingXmlBuilder$_buildClassMappingXml_closure1$_closure4$_closure12$_closure13
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compass': FactoryBean threw exception on object creation; nested exception is java.lang.NoClassDefFoundError: grails/plugin/searchable/internal/compass/mapping/DefaultSearchableCompassClassMappingXmlBuilder$_buildClassMappingXml_closure1$_closure4$_closure12$_closure13
    ... 4 more
Caused by: java.lang.NoClassDefFoundError: grails/plugin/searchable/internal/compass/mapping/DefaultSearchableCompassClassMappingXmlBuilder$_buildClassMappingXml_closure1$_closure4$_closure12$_closure13
    at grails.plugin.searchable.internal.compass.mapping.DefaultSearchableCompassClassMappingXmlBuilder$_buildClassMappingXml_closure1$_closure4$_closure12.doCall(DefaultSearchableCompassClassMappingXmlBuilder.groovy:188)
    at grails.plugin.searchable.internal.compass.mapping.DefaultSearchableCompassClassMappingXmlBuilder$_buildClassMappingXml_closure1$_closure4.doCall(DefaultSearchableCompassClassMappingXmlBuilder.groovy:187)
    at grails.plugin.searchable.internal.compass.mapping.DefaultSearchableCompassClassMappingXmlBuilder$_buildClassMappingXml_closure1.doCall(DefaultSearchableCompassClassMappingXmlBuilder.groovy:72)
    at grails.plugin.searchable.internal.compass.mapping.DefaultSearchableCompassClassMappingXmlBuilder.buildClassMappingXml(DefaultSearchableCompassClassMappingXmlBuilder.groovy:65)
    at grails.plugin.searchable.internal.compass.config.mapping.SearchableClassPropertySearchableGrailsDomainClassMappingConfigurator.configureMappings(SearchableClassPropertySearchableGrailsDomainClassMappingConfigurator.java:99)
    at grails.plugin.searchable.internal.compass.config.DefaultGrailsDomainClassMappingSearchableCompassConfigurator.configure(DefaultGrailsDomainClassMappingSearchableCompassConfigurator.java:140)
    at grails.plugin.searchable.internal.compass.config.CompositeSearchableCompassConfigurator.configure(CompositeSearchableCompassConfigurator.java:39)
    at grails.plugin.searchable.internal.compass.spring.SearchableCompassFactoryBean.buildCompass(SearchableCompassFactoryBean.java:93)
    at grails.plugin.searchable.internal.compass.spring.SearchableCompassFactoryBean.getObject(SearchableCompassFactoryBean.java:58)
    at grails.plugin.searchable.internal.compass.spring.SearchableCompassFactoryBean.getObject(SearchableCompassFactoryBean.java:41)
    ... 4 more
Caused by: java.lang.ClassNotFoundException: grails.plugin.searchable.internal.compass.mapping.DefaultSearchableCompassClassMappingXmlBuilder$_buildClassMappingXml_closure1$_closure4$_closure12$_closure13
    ... 14 more

为了表明这个问题是可重复的,我在github上准备了一个最小的例子:

https://github.com/mlist/grails-standalone-search-bug

我创建了一个bug报告:https://jira.grails.org/browse/GPSTANDALONE-22

我已经尝试从默认的tomcat 8切换到tomcat 7和jetty(相同的结果)。我还尝试了java 7和java 8,两者都有相同的结果。

以下是Burt Beckwith对我的bug报告的回答:

很抱歉这样做,但我不能花任何时间在这个问题上。你不应该使用可搜索插件-它只适用于Hibernate 3,它不能扩展,因为它使用基于本地文件的索引。它是基于指南针的(http://sourceforge.net/projects/compass/files/compass/),这是最近更新于2009年。ElasticSearch是一个更好的选择http://thedudeabides.com/articles/the_future_of_compass/

相关内容

  • 没有找到相关文章

最新更新