好吧,使用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
嗨克勞斯出口,感謝您的幫助!我能夠按照你的例子,並得到它的工作。 – emmitt1219 2012-03-25 07:30:30