2015-06-15 62 views
3

我打算修復Elastic Search開源項目上的錯誤。我分叉它並克隆分叉副本。然後我將它作爲Maven項目導入到Eclipse中,然後創建Maven。到現在爲止還挺好。 我打開ElasticSearchF.java文件並試圖將其作爲Java應用程序運行(這是按照http://www.lindstromhenrik.com/debugging-elasticsearch-in-eclipse/中寫的方向)。彈性搜索錯誤

但是我得到一個錯誤,說path.home沒有爲ElasticSearch設置,並拋出一個錯誤說IllegalStateException。

我的問題是

  1. 爲什麼擺在首位來了這個錯誤。
  2. 正如我所說的,我想修復ElasticSearch項目中的錯誤。這是爲我的目標設置環境的正確方法嗎?或者,我應該讓客戶端將請求發送到ElasticSearch服務器,然後在Elastic Search源代碼中設置調試點。如何實現這一目標?

感謝您的耐心等待。

更新: 我沒有添加虛擬機參數,如其中一個答覆者所述。

然後它拋出不同的錯誤和線索,爲什麼它拋出。

java.io.IOException: Resource not found: "org/joda/time/tz/data/ZoneInfoMap" ClassLoader: [email protected] 
    at org.joda.time.tz.ZoneInfoProvider.openResource(ZoneInfoProvider.java:210) 
    at org.joda.time.tz.ZoneInfoProvider.<init>(ZoneInfoProvider.java:127) 
    at org.joda.time.tz.ZoneInfoProvider.<init>(ZoneInfoProvider.java:86) 
    at org.joda.time.DateTimeZone.getDefaultProvider(DateTimeZone.java:514) 
    at org.joda.time.DateTimeZone.getProvider(DateTimeZone.java:413) 
    at org.joda.time.DateTimeZone.forID(DateTimeZone.java:216) 
    at org.joda.time.DateTimeZone.getDefault(DateTimeZone.java:151) 
    at org.joda.time.chrono.ISOChronology.getInstance(ISOChronology.java:79) 
    at org.joda.time.DateTimeUtils.getChronology(DateTimeUtils.java:266) 
    at org.joda.time.format.DateTimeFormatter.selectChronology(DateTimeFormatter.java:968) 
    at org.joda.time.format.DateTimeFormatter.printTo(DateTimeFormatter.java:672) 
    at org.joda.time.format.DateTimeFormatter.printTo(DateTimeFormatter.java:560) 
    at org.joda.time.format.DateTimeFormatter.print(DateTimeFormatter.java:644) 
    at org.elasticsearch.Build.<clinit>(Build.java:53) 
    at org.elasticsearch.node.Node.<init>(Node.java:138) 
    at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:157) 
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:177) 
    at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:278) 
    at org.elasticsearch.bootstrap.ElasticsearchF.main(ElasticsearchF.java:30) 
[2015-06-16 18:51:36,892][INFO ][node      ] [Kismet Deadly] version[2.0.0-SNAPSHOT], pid[2516], build[9b833fd/2015-06-15T03:38:40Z] 
[2015-06-16 18:51:36,892][INFO ][node      ] [Kismet Deadly] initializing ... 
[2015-06-16 18:51:36,899][INFO ][plugins     ] [Kismet Deadly] loaded [], sites [] 
{2.0.0-SNAPSHOT}: Initialization Failed ... 
- ExceptionInInitializerError 
    IllegalArgumentException[An SPI class of type org.apache.lucene.codecs.PostingsFormat with name 'Lucene50' does not exist. You need to add the corresponding JAR file supporting this SPI to your classpath. The current classpath supports the following names: [es090, completion090, XBloomFilter]] 
+0

你看這個? https://github.com/elastic/elasticsearch/blob/master/CONTRIBUTING.md#contributing-code-and-documentation-changes –

+0

@ user4654你找出解決辦法了嗎? – keety

+0

@ user4654你找到了解決辦法嗎?我也面臨着同樣的錯誤 –

回答

0

編輯您的調試/運行配置,把它放在VM參數:

-Des.path.home = C:\ github上\ elasticsearch \

變化的C:\ github上\ elasticsearch \你elasticsearch根路徑

的原因是在elasticsearch.bat一些參數,當你調試/月食

+0

我也是這樣做的:我在根文件夾中有一個空的config文件夾。然後拋出FileNotFoundException。然後我從另一個安裝中添加了兩個配置文件來解決這個問題。然後它會拋出不同的錯誤和線索 - 爲什麼拋出它。 – user4654

+0

原因是錯誤的Env變量和類路徑。我在用戶變量中設置了ES_HOME ES_HEAP_SIZE ES_MAX_MEM ES_MIN_MEM。 ES_HOME = yourpath/core。我的ES是1.6.0。在調試配置中,我將VM參數設置爲-Delasticsearch -Des-foreground = yes -Des.path.home = C:\ Self \ github \ elasticsearch \ – HarryQ

3

我得到的幫助來自devel的運行錯過在https://github.com/elastic/elasticsearch/issues/12737運行社區,並能夠調試它。總之

過程將是:

1)搜索包org.elasticsearch.bootstrap內的文件Elasticsearch.java/ElasticsearchF.java。

2)右鍵 - >運行配置...

3)在彈出的窗口中,單擊「參數」選項卡,在「程序參數:」部分給出的值作爲啓動 和下「VM參數:」 部分得到的值作爲
-Des.path.home = {路徑到您elasticsearch代碼庫根文件夾} /芯-Des.security.manager.enabled =假

4)點擊「應用「然後點擊」運行「。

它現在運行。 檢查,去爲localhost:9200,你會得到一個消息像

{ 
    "name" : "Raza", 
    "cluster_name" : "elasticsearch", 
    "version" : { 
    "number" : "2.0.0-beta1", 
    "build_hash" : "${buildNumber}", 
    "build_timestamp" : "NA", 
    "build_snapshot" : true, 
    "lucene_version" : "5.2.1" 
    }, 
    "tagline" : "You Know, for Search" 
} 

更多信息有關參數 看到:https://github.com/elastic/elasticsearch/commit/2b9ef26006c0e4608110164480b8127dffb9d6ad