2013-06-03 76 views
0

這是後續對這個問題 Grails elasticsearch plugin with "text" mapping彈性搜索+ Grails的拋出NPE

我跟着答案給出的步驟,現在下面的NPE被拋出。另外,如果我打開使用盧克話,我沒有看到任何文件,在它的Lucene索引..

時候,雖然重新啓動應用程序服務器給了我下面的調試消息

2013-06-03 16:20:49,364 [localhost-startStop-1] DEBUG mapping.SearchableClassMappingConfigurator - Retrieved index settings 
2013-06-03 16:20:49,365 [localhost-startStop-1] DEBUG mapping.SearchableClassMappingConfigurator - Installing mappings... 
2013-06-03 16:20:49,370 [localhost-startStop-1] DEBUG mapping.SearchableClassMappingConfigurator - Index com.ecw.wellness does not exists, initiating creation... 
2013-06-03 16:20:49,370 [localhost-startStop-1] DEBUG mapping.SearchableClassMappingConfigurator - Waiting at least yellow status on com.ecw.wellness ... 
2013-06-03 16:21:19,869 [localhost-startStop-1] DEBUG mapping.SearchableClassMappingConfigurator - {com_ecw_wellness_answer={properties={answer={type=string, include_in_all=true, term_vector=with_positions_offsets}, votes={type=object}, dateCreated={type=date, include_in_all=true}, lastUpdated={type=date, include_in_all=true}, question={type=object}}}} 
2013-06-03 16:21:19,869 [localhost-startStop-1] DEBUG mapping.SearchableClassMappingConfigurator - [com_ecw_wellness_answer] => {com_ecw_wellness_answer={properties={answer={type=string, include_in_all=true, term_vector=with_positions_offsets}, votes={type=object}, dateCreated={type=date, include_in_all=true}, lastUpdated={type=date, include_in_all=true}, question={type=object}}}} 
2013-06-03 16:21:19,925 [localhost-startStop-1] DEBUG mapping.SearchableClassMappingConfigurator - [com_ecw_wellness_comment] => {com_ecw_wellness_comment={properties={post={type=object}, vote={type=integer, include_in_all=true}, dateCreated={type=date, include_in_all=true}, lastUpdated={type=date, include_in_all=true}, comment={type=string, include_in_all=true, term_vector=with_positions_offsets}}}} 
2013-06-03 16:21:19,977 [localhost-startStop-1] DEBUG mapping.SearchableClassMappingConfigurator - [com_ecw_wellness_post] => {com_ecw_wellness_post={properties={tags={type=object}, body={type=string, include_in_all=true, term_vector=with_positions_offsets}, title={type=string, include_in_all=true, term_vector=with_positions_offsets}, dateCreated={type=date, include_in_all=true}, lastUpdated={type=date, include_in_all=true}, comments={properties={post={type=object}, vote={type=integer, include_in_all=true}, dateCreated={type=date, include_in_all=true}, lastUpdated={type=date, include_in_all=true}, comment={type=string, include_in_all=true, term_vector=with_positions_offsets}, id={type=long, index=not_analyzed, include_in_all=false}, class={type=string, index=no, include_in_all=false}, ref={type=string, index=no, include_in_all=false}}, type=object}}}} 
2013-06-03 16:21:20,005 [localhost-startStop-1] DEBUG mapping.SearchableClassMappingConfigurator - [com_ecw_wellness_question] => {com_ecw_wellness_question={properties={tags={type=object}, title={type=string, include_in_all=true, term_vector=with_positions_offsets}, answers={type=object}, dateCreated={type=date, include_in_all=true}, lastUpdated={type=date, include_in_all=true}, question={type=string, include_in_all=true, term_vector=with_positions_offsets}}}} 
2013-06-03 16:21:20,010 [localhost-startStop-1] DEBUG mapping.SearchableClassMappingConfigurator - Cluster status: GREEN 

以下是NPE堆棧跟蹤。原始問題中給出了域類。

| Error 2013-06-03 16:17:00,891 [http-bio-8080-exec-8] ERROR errors.GrailsExceptionResolver - NullPointerException occurred when processing request: [GET] /wellness/search - parameters: 
q: smoking 
Stacktrace follows: 
Message: null 
    Line | Method 
->> 181 | unmarshallProperty in org.grails.plugins.elasticsearch.conversion.unmarshall.DomainClassUnmarshaller 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|  73 | buildResults  in  '' 
| 435 | doCall . . . . . . in org.grails.plugins.elasticsearch.ElasticSearchService$_doSearch_closure7 
|  14 | withElasticSearch in org.grails.plugins.elasticsearch.ElasticSearchHelper 
| 426 | doSearch . . . . . in org.grails.plugins.elasticsearch.ElasticSearchService 
|  86 | search    in  '' 
|  6 | index . . . . . . in com.ecw.wellness.SearchController 
| 195 | doFilter   in grails.plugin.cache.web.filter.PageFragmentCachingFilter 
|  63 | doFilter . . . . . in grails.plugin.cache.web.filter.AbstractFilter 
| 1110 | runWorker   in java.util.concurrent.ThreadPoolExecutor 
| 603 | run . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker 
^ 722 | run    in java.lang.Thread 

如果我跑運輸模式的項目,下面的信息,然後我得到「沒有節點可用的錯誤」

elasticSearch.client.mode = 'transport' 
     elasticSearch.client.hosts = [ 
      [host:'localhost', port:9300] 
    ] 
    } 

如果我加入後

static searchable = { 
    except = ["user"] 
comments reference:true 

} 

,這下在評論

static searchable = { 
    except = ["user"] 
    post reference:true 
} 

然後我得到以下SO例外。而如果我只在後級做然後我得到運行時

ERROR errors.GrailsExceptionResolver - StackOverflowError occurred when processing request: [GET] /wellness/search - parameters: 
q: smoking 
Stacktrace follows: 
Message: Executing action [index] of controller [com.ecw.wellness.SearchController] caused exception: Runtime error executing action 
    Line | Method 
->> 195 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|  63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter 
| 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor 
| 603 | run  in java.util.concurrent.ThreadPoolExecutor$Worker 
^ 722 | run . . . in java.lang.Thread 
Caused by ControllerExecutionException: Runtime error executing action 
->> 195 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|  63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter 
| 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor 
| 603 | run  in java.util.concurrent.ThreadPoolExecutor$Worker 
^ 722 | run . . . in java.lang.Thread 
Caused by InvocationTargetException: null 
->> 195 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|  63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter 
| 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor 
| 603 | run  in java.util.concurrent.ThreadPoolExecutor$Worker 
^ 722 | run . . . in java.lang.Thread 
Caused by StackOverflowError: null 
->> 354 | findClass in java.net.URLClassLoader 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
| 171 | oldFindClass in org.codehaus.groovy.tools.RootLoader 
| 143 | loadClass in  '' 
| 356 | loadClass in java.lang.ClassLoader 
| 263 | unmarshallDomain in org.grails.plugins.elasticsearch.conversion.unmarshall.DomainClassUnmarshaller 
| 256 | unmarshallReference in  '' 
| 178 | unmarshallProperty in  '' 
| 204 | unmarshallProperty in  '' 
| 268 | unmarshallDomain in  '' 
| 256 | unmarshallReference in  '' 
| 178 | unmarshallProperty in  '' 
| 268 | unmarshallDomain in  '' 
| 256 | unmarshallReference in  '' 
| 178 | unmarshallProperty in  '' 
| 204 | unmarshallProperty in  '' 
| 268 | unmarshallDomain in  '' 
| 256 | unmarshallReference in  '' 
| 178 | unmarshallProperty in  '' 
| 268 | unmarshallDomain in  '' 
| 256 | unmarshallReference in  '' 
| 178 | unmarshallProperty in  '' 
| 204 | unmarshallProperty in  '' 

回答

0

Property Comment.post is not mapped as [component], but broken search hit found.錯誤添加elasticSearch.unmarshallComponents = trueConfig.groovy。 默認值應該在插件的grails-app/conf/DefaultElasticSearch.groovy文件中提供,但不知何故它不能正確加載。

Also see issue#62 on the Github repository

傳輸模式需要一個獨立的ES實例的Grails應用程序外運行。


編輯: 關於這個問題:

物業Comment.post不映射爲[成分],但破碎的搜索命中發現。

您需要在搜索關閉您的關聯映射爲可搜索componentreference。該插件文檔指出,默認情況下使用可搜索引用,但它不再是真實的,並且文檔有點過時。

在以前的版本,我不能在此刻召回原因除去默認爲搜索的引用,所以也許是默認行爲將在未來版本中恢復......下面

例子:

class Comment { 
    Post post 
    static belongsTo = [post:Post] 

    static searchable = { 
      post component:true 
    } 
} 

The documentation explaining the difference between the 2 behaviors

+0

>> 「運輸模式需要一個獨立的ES實例是Grails應用程序外運行。」 我讓它運行。謝謝你的回答,希望這能讓我啓動並運行 – Sap

+0

同樣的問題,我在COnfig.groovy中添加了標誌,清理了數據目錄並重新啓動了應用程序並得到了 - >> 181 | unmarshallProperty在DomainClassUnmarshaller.java – Sap

+0

我的不好,我用'unmarshallProperty'對'elasticSearch.unmarshallComponents'進行了拼寫...我更新了這個帖子。要添加的配置鍵是** elasticSearch.unmarshallComponents ** – mstein