2014-09-02 103 views
0

我已經在grails 2.4.2中安裝了可搜索插件。grails 2.4.2可搜索插件

compile ":searchable:0.6.9" 

它正在成功安裝,但是當我運行該應用程序時,它會出現此錯誤。我沒有任何控制器。只有一個聲明可搜索的域類。如何解決這個問題?

Sep 2, 2014 7:34:11 PM org.codehaus.groovy.runtime.m12n.MetaInfExtensionModule newModule 
WARNING: Module [groovy-all] - Unable to load extension class [org.codehaus.groovy.runtime.NioGroovyMethods] 
Sep 2, 2014 7:34:11 PM org.codehaus.groovy.runtime.m12n.MetaInfExtensionModule newModule 
| Running Grails application 
Sep 2, 2014 7:34:24 PM org.codehaus.groovy.runtime.m12n.MetaInfExtensionModule newModule 
WARNING: Module [groovy-all] - Unable to load extension class [org.codehaus.groovy.runtime.NioGroovyMethods] 
Error | 
2014-09-02 19:34:57,557 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializing the application: 
Error creating bean with name 'grails.plugin.searchable.SearchableController': Initialization of bean failed; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'searchableService': Initialization of be 
an failed; 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.NullPointerException 
Message: Error creating bean with name 'grails.plugin.searchable.SearchableController': Initialization of bean failed; nested exc 
eption is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'searchableService': Initializat 
ion of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'c 
ompass': FactoryBean threw exception on object creation; nested exception is java.lang.NullPointerException 
    Line | Method 
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
| 138 | run  in java.util.concurrent.FutureTask 
| 885 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker 
| 907 | run  in  '' 
^ 619 | run . . in java.lang.Thread 
Caused by BeanCreationException: Error creating bean with name 'searchableService': Initialization of bean failed; nested excepti 
on is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compass': FactoryBean threw excepti 
on on object creation; nested exception is java.lang.NullPointerException 
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
| 138 | run  in java.util.concurrent.FutureTask 
| 885 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker 
| 907 | run  in  '' 
^ 619 | run . . in java.lang.Thread 
Caused by BeanCreationException: Error creating bean with name 'compass': FactoryBean threw exception on object creation; nested 
exception is java.lang.NullPointerException 
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
| 138 | run  in java.util.concurrent.FutureTask 
| 885 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker 
| 907 | run  in  '' 
^ 619 | run . . in java.lang.Thread 
Caused by NullPointerException: null 
->> 303 | addAll in java.util.AbstractCollection 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
| 121 | configure in grails.plugin.searchable.internal.compass.config.DefaultGrailsDomainClassMappingSearchableCompassConfigura 
tor 
| 39 | configure in grails.plugin.searchable.internal.compass.config.CompositeSearchableCompassConfigurator 
| 93 | buildCompass in grails.plugin.searchable.internal.compass.spring.SearchableCompassFactoryBean 
| 58 | getObject in  '' 
| 41 | getObject in  '' 
| 303 | innerRun in java.util.concurrent.FutureTask$Sync 
| 138 | run  in java.util.concurrent.FutureTask 
| 885 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker 
| 907 | run  in  '' 
^ 619 | run . . in java.lang.Thread 
| Error Forked Grails VM exited with error 
+0

我相信這是因爲Grails 2.4.x使用Hibernate 4,而可搜索插件只支持Hibernate 3.在你的BuildConfig.groovy文件中查找。你應該可以使用Hibernate 3和Grails 2.4.x – sbglasius 2014-09-05 04:26:36

+0

你應該去閱讀這個博客條目:http://jolorenz.wordpress.com/2013/10/02/how-to-use-searchable-plugin-with -grails-2-3-0-and-hibernate-4-x/ – sbglasius 2014-09-05 04:51:31

回答

0

您可以嘗試使用安裝可搜索插件的命令行。

Grails的安裝,插件搜索(我假設你使用的是Java 1.5+)

一旦安裝了該插件,然後嘗試有讓您的站點搜索,因爲我相信在創建可搜索的控制器和服務類安裝。

+0

它不工作@ user1313900。它說installPlugin不會在Grails版本2.3以上工作 – Shashank 2014-09-02 17:27:17

+0

grails install-plugin searchable 0.6.9 – user1313900 2014-09-03 16:20:42

0

你使用的是什麼版本的Hibernate插件?請注意,可搜索插件不適用於Hibernate 4;你必須改用Hibernate 3。