Автономное приложение grails app с возможностью поиска подключаемого модуля NoClassDefFoundError
Я пытаюсь создать отдельное приложение Grails (v.2.5.0) с помощью плагина для запуска приложения Grails (v.1.3). С run-app и run-war все работает отлично, и я также могу без проблем развернуть WAR-файл в экземпляре tomcat 7. Однако, если я создаю автономный JAR-файл с Grails build-standalone, я не могу запустить JAR из-за следующего ClassNotFoundException:
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
Я создал отчет об ошибке по адресу: https://jira.grails.org/browse/GPSTANDALONE-22
Я уже пробовал переключаться с tomcat 8 по умолчанию на tomcat 7 и jetty (тот же результат). Я также попробовал Java 7 и Java 8, оба с тем же результатом.
1 ответ
Вот ответ, который дал Берт Беквит в моем сообщении об ошибке:
Извините за это, но я не могу тратить время на работу над этим вопросом. Не следует использовать плагин с возможностью поиска - он работает только с Hibernate 3 и не масштабируется, поскольку использует локальный файловый индекс. Он основан на Compass ( http://sourceforge.net/projects/compass/files/compass/), который последний раз обновлялся в 2009 году. ElasticSearch - намного лучший вариант - см. http://thedudeabides.com/articles/the_future_of_compass/