2017-10-16 30 views
1

我目前正在關注Vespa教程,並遇到HTTP API use-case的問題。一切正常,從mvn install packagevespa-deploy prepare target/application.zipVespa教程 - HTTP API用例無法通過IllegalArgumentException激活

vespa-deploy activate的調用正常返回,但應用程序永遠無法在localhost:8080上獲得。縱觀/opt/vespa/logs/vespa/vespa.log(在VM)可以發現下面的堆棧跟蹤:

Container.com.yahoo.jdisc.core.StandaloneMain error Unexpected: 
    exception= 
    java.lang.IllegalArgumentException: Could not create a component with id 'com.mydomain.demo.DemoComponent'. 
    Tried to load class directly, since no bundle was found for spec: sample-app-http-api-searcher. 
    If a bundle with the same name is installed, there is a either a version mismatch or the installed bundle's version contains a qualifier string. 
    at com.yahoo.osgi.OsgiImpl.resolveFromClassPath(OsgiImpl.java:48) 
    ... 

發生這種情況,使用新的碼頭工人形象與sample-apps git倉庫的乾淨克隆。準備和激活基本示例以及其他http示例都無縫工作。

我檢查了源和XML文件的明顯問題,但沒有任何線索有關什麼是失敗和在哪裏。

target/application.zip包含

application/components/http-api-using-searcher-1.0.1-deploy.jar 
application/hosts.xml 
application/searchdefinitions/basic.sd 
application/services.xml 

而且罐子本身確實含有com/mydomain/demo/DemoComponent.class文件(除其他事項外)。

在github上跟蹤潛在相關的問題:https://github.com/vespa-engine/vespa/issues/3479我將發佈一個鏈接到這個問題,有作爲,但我仍然認爲這是值得SO問題,至少要拿到vespa標籤背後的一些行動:)

+0

target/application.zip的內容是什麼?它抱怨說它無法將組件初始化爲'因爲沒有找到規範包:sample-app-http-api-searcher' – jkb

+0

問題已更新。非常感謝您的及時答覆! – Shastick

回答

3

應用程序的services.xml文件中的包ID錯誤。請從git中取出應用程序,然後再試一次。另請參見PR:https://github.com/vespa-engine/sample-apps/pull/18

簡要說明:services.xml中的bundle="<id>"聲明中給出的包ID必須與包的清單中的'Bundle-SymbolicName'匹配。使用Vespa bundle-plugin構建包時,默認情況下,符號名稱與項目的artifactId相同。因此,在大多數情況下,您只需驗證捆綁ID是否與artifactId匹配。

+0

非常感謝!祝你們在挪威愉快的夜晚:) – Shastick