2012-03-18 115 views
0

我在servicemix 4.4.1上運行。我找不到camel-dns模塊。駱駝DNS缺失

我運行了features:listosgi:list,而我沒有看到camel-dns。當我執行

<to uri="dns:lookup"/> 

我得到一個

org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: 
dns://lookup due to: No component found with scheme: dns 

任何想法?

回答

1

好吧,使用SMX開箱即可工作有點棘手,因爲SMX並未公開DNS套件需要的JVM包。所以,你會得到一個錯誤這樣的:

ERROR: Error starting file:bundles/dnsjava_2.1.1.jar (org.osgi.framework.BundleException: Unresolved constraint in bundle dnsjava [69]: Unable to resolve 69.0: missing requirement [69.0] package; (package=sun.net.spi.nameservice)) 
org.osgi.framework.BundleException: Unresolved constraint in bundle dnsjava [69]: Unable to resolve 69.0: missing requirement [69.0] package; (package=sun.net.spi.nameservice) 
    at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3404) 
    at org.apache.felix.framework.Felix.startBundle(Felix.java:1714) 
    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1143) 
    at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264) 
    at java.lang.Thread.run(Thread.java:680) 

所以,你需要調整SMX的配置,在etc/jre.properties

添加以下

sun.net.spi.nameservice 

到導出Java平臺包,例如我的文件現在以

結尾
org.xml.sax, \ 
org.xml.sax.ext, \ 
org.xml.sax.helpers, \ 
sun.net.spi.nameservice 

您需要重新啓動ESB要使此更改生效。

要安裝camel-dns,首先需要安裝junit所需的依賴項。這是這個包在這裏:http://repo2.maven.org/maven2/org/apache/servicemix/bundles/org.apache.servicemix.bundles.junit/4.10_1/

在基本的Apache Karaf 2.2.5我設法得到它安裝

[email protected]> osgi:list 
START LEVEL 100 , List Threshold: 50 
    ID State   Blueprint  Spring Level Name 
[ 49] [Active  ] [   ] [  ] [ 60] Apache ServiceMix :: Bundles :: junit (4.10.0.1) 
[ 50] [Active  ] [   ] [  ] [ 60] dnsjava (2.1.1) 
[ 65] [Active  ] [   ] [  ] [ 50] camel-core (2.10.0.SNAPSHOT) 
[ 66] [Active  ] [Created  ] [  ] [ 50] camel-karaf-commands (2.10.0.SNAPSHOT) 
[ 73] [Active  ] [   ] [  ] [ 50] geronimo-jta_1.1_spec (1.1.1) 
[ 74] [Active  ] [   ] [  ] [ 50] camel-spring (2.10.0.SNAPSHOT) 
[ 75] [Active  ] [   ] [  ] [ 60] camel-dns (2.10.0.SNAPSHOT) 
[ 76] [Active  ] [   ] [Started] [ 60] IPCheck.xml (0.0.0) 

而且我複製了IPCheck。XML駱駝樣本航線,從這裏開始: https://svn.apache.org/repos/asf/camel/trunk/components/camel-dns/src/test/resources/ ,到deploy目錄,並有駱駝應用程序的啓動:

[email protected]> camel:context-list 
Name     Status    Uptime    
[camel    ] [Started   ] [22.339 seconds ] 
[email protected]> camel:context-info camel 
Camel Context camel 
    Name: camel 
    Version: 2.10-SNAPSHOT 
    Status: Started 
    Uptime: 25.835 seconds 

Advanced 
    Auto Startup: true 
    Starting Routes: false 
    Suspended: false 
    Tracing: true 

Properties 

Components 
    direct 
    mock 
    dns 
    spring-event 

Endpoints 
    direct://start 
    dns://ip 
    mock://result 
    spring-event://default 

Routes 
    IPCheck 
+0

嗨克勞斯出口,感謝您的幫助!我能夠按照你的例子,並得到它的工作。 – emmitt1219 2012-03-25 07:30:30

1

並非所有的第三方庫都符合OSGi標準,因此我們不能包含此類組件的功能。但是,您可以嘗試自己將JAR安裝爲包裹包。我認爲DNS的一個問題是它的SUN JDK依賴或類似的問題。

見包裝部署:http://karaf.apache.org/manual/2.2.5/users-guide/deployer.html

見駱駝DNS組件的pom.xml文件,看它需要在運行時哪些依賴關係:https://svn.apache.org/repos/asf/camel/trunk/components/camel-dns/pom.xml

但是它似乎是一個最近dnsjava的版本現已OSGi包。 所以我們可以爲它添加一個功能,所以期待在下一個Camel發佈。

您可以手動在您的SMX與

osgi:install mvn:dnsjava/dnsjava/2.1.1 

然後駱駝的DNS束

osgi:install mvn:org.apache.camel/camel-dns/2.9.0 

心靈使用正確的駱駝版本上安裝它,我輸入了2.9.0。但SMX 4.4.1可能使用2.9.1,我不記得了。

+0

的dnsjava束取決於太陽API,它是最有可能不是由ESB – 2012-03-19 09:37:39