好吧,使用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