Servicemix 4,DOSGi和Zookeeper [英] Servicemix 4, DOSGi, and Zookeeper

查看:101
本文介绍了Servicemix 4,DOSGi和Zookeeper的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是从 fusesource论坛 servicemmix论坛.

我无法让DOSGi在FUSE中工作.我正在尝试通过Zookeeper发现将CXF的DOSGi 1.1-SNAPSHOT导入FUSE 4.1.0.2.我也在使用Zookeepr 3.2.1.

一切都在Felix 2.0.0上完美运行.我只是按照 DOSGi发现页上的说明进行操作,然后安装发现演示捆绑包.对于DOSGi,我只需使用 cxf-dosgi-ri-discovery-singlebundle-distribution-1.1-SNAPSHOT.jar 用于发现守望者.然后,当在一台计算机上使用示例服务impl启动示例捆绑包时,我看到了在zookeeper中创建的节点.然后,在另一台计算机上启动示例客户端,然后在服务计算机上看到输出.效果很好.我确实警告过xml错误,因为没有找到某些XSD,但是它被忽略了,但似乎没有任何影响.哦,我还必须先安装OSGi纲要包.

当我转到Fuse时,我没有这种运气. OSGi纲要包随附保险丝,因此无需安装.我应该能够安装dosgi-ri单捆绑包和dosgi-ri-discovery单捆绑包,但这是行不通的. dosgi-ri单束具有与servicemix的各种重叠束.我收到有关端口8081的错误?或任何正在使用的osgi.http.service参数.显然dosgi-ri singlebundle是pax webservice附带的,它读取的属性与servicemix附带的servicemix http服务捆绑包相同.那就是当我切换到 http:的传输类: //schemas.xmlsoap.org/soap/http .好吧,所以日志记录搞砸了,我缺少一些传输类.好吧,很明显,这是因为ri multibundle在felix上无法正常安装而导致的.所以里面还有什么是必要的.检查时的cxf-minimum-bundle具有缺少的类,从而导致了最后一个错误.所以我安装了.尝试启动发现捆绑包,但最终导致了某种corbabroker异常. Wtf.谁在所有这些中使用corba?然后,我返回并撤消所有操作,并尝试使用ri和ri-discovery的单捆绑发行版,但只需关闭servicemix http服务.这会使servicemix崩溃,并且由于cxf jbi组件最终具有不满意的依赖关系,因此我无法重新启动它.奇怪的.我只是忽略了这一点,因为无论如何我都不会使用它们,而是尝试开始我的示例.无法启动样本,因为它说码头由于已经在使用中而无法启动.没有任何意义,因为我已经关闭了servicemix http服务.然后,我重新启动码头.作品?可能是.我的服务已注册,我可以使用firefox浏览到wsdl,但没有在Zookeeper中注册.尝试关闭ri-discovery捆绑包并重新启动它,但是我得到了nullpointerexception.显然,由于上述错误之一,ri发现实际上从未启动过.然后,我开始尝试拆解ri发现单束并拉出内部零件.那没有用,因为它显然是必须的,即使我们里面有些库也可以不用.

故事的结尾.无法正常工作.有人可以让它工作吗?我只想在SMX4中运行发现示例.我很确定这只是一个捆绑冲突问题.这不是OSGi应该修复的吗???这比告诉我您所依赖的jar并使我设置类路径更糟糕.至少到那时,我最终会把事情运行起来.

我认为,我的下一步将是尝试使用ri-multibundle,仅使用dsw和jdom,再加上ri-discovery单束.然后,我将尝试使用某些cxf-fuse捆绑包或某些cxf-rt捆绑包来解决肥皂运输问题.

编辑注释:我不仅需要显示处于活动状态的DOSGi捆绑软件,还需要做更多的工作.在您尝试通过它们公开服务之前,它们实际上并不会做很多事情.我确实需要看到多台计算机向Zookeeper实例注册服务,以及其他使用这些服务的计算机,就像正在运行的DOSGi Discovery Sample.

通过使用提到的最小cxf捆绑包,我可以使cxf将分发的服务示例公开为soap web服务,方法是删除原始cxf捆绑包的一部分并重新启动码头服务,然后启动示例服务. ..或通过安装cxf Minimum buundle,然后启动我的服务,然后立即卸载cxf Minimum Bundle,然后重新启动码头...我想就是这样.这些都不是从干净启动时就可以使用的,而且必须重新启动服务才能使DOSGi正常运行是很糟糕的.我什至不知道为什么先安装然后卸载会做任何事情-它不应该留下任何工件.

解决方案

首先,看一下CXF DOSGi大型捆绑包,我认为这仅适用于在裸露的OSGi运行时中进行快速n肮脏的黑客攻击,基本上是最小的环境由Equinox和Felix提供.它似乎不适用于FUSE或Servicemix之类的更丰富的环境,因为您可能会看到捆绑包和平台中的服务,就像您看到的那样.

我能够干净地启动Servicemix 4.0(在Windows上),然后进行热部署:

  • com.springsource.org.jdom-1.0.0.jar
  • cxf-bundle-minimal-2.2.1.jar
  • cxf-dosgi-ri-discovery-local-1.0.jar
  • cxf.dosgi-ri-dws.cxf-1.0.jar

使用Servicemix控制台,我列出了所有捆绑软件,并发现上述所有捆绑软件均处于Active状态(符合预期).我列出了服务,并且2个CXF DOSGi捆绑包正在导出服务,因此看来工作正常.日志中未报告任何错误.

您对OSGi的熟悉程度如何? Servicemix看起来很大,并且一起学习OSGi,Servicemix和CXF/DOSGi并不容易.

提供的控制台不适用于OSGi,我建议为fusesource forum and the servicemmix forum.

I can't get DOSGi working in FUSE. I'm trying to get CXF's DOSGi 1.1-SNAPSHOT with Zookeeper discovery onto FUSE 4.1.0.2. I'm also using Zookeepr 3.2.1.

Everything works perfectly on Felix 2.0.0. I just follow the instructions on the DOSGi Discovery page and then install the Discovery Demo bundles. For DOSGi, I just use the cxf-dosgi-ri-singlebundle-distribution-1.1-SNAPSHOT.jar for DSW and cxf-dosgi-ri-discovery-singlebundle-distribution-1.1-SNAPSHOT.jar for zookeepr discovery. Then when I start the sample bundles with the sample service impl on one machine, I see the node creation in zookeeper. Then I start the sample client on another machine and I see the output on the service machine. Works great. I do have an warning about an xml error being ignored because some XSD coudln't be found, but it doesn't seem to affect anything. Oh, I also have to install the OSGi compendium bundle first.

When I move to Fuse, I have no such luck. The OSGi compendium bundle comes with fuse, so no need to install that. I should just be able to install the dosgi-ri singlebundle, and the dosgi-ri-discovery single bundle, but that doesn't work. The dosgi-ri singlebundle has all kinds of overlapping bundles with servicemix. I get an error about port 8081? or whatever the osgi.http.service parameter is, being already in use. Apparently the dosgi-ri singlebundle comes with pax webservice, which reads the same property as the servicemix http service bundle that comes with servicemix. Thats when I switch to the cxf-dosgi-ri-multibundle-distribution-1.1-SNAPSHOT.zip and unzip it to take the parts I want. I take the dsw bundle out of the dosgi-ri multibundle and install that. No luck because of the jdom dependency. Then I install the jdom that comes in the ri multibundle, which works fine. Then go back to dsw, and that installs, so I think i'm getting somewhere. Time to go back and install the ri-discovery singlebundle. When I start that I get a pax logging service classcastexception saying it can't be cast to a osgi logservice or something. But thats just a logging error, and at the bottom it says it can't find the transport class for http://schemas.xmlsoap.org/soap/http. Ok, so logging is screwed up and I'm missing some transport class. Well, clearly this comes from not installing enough from the ri multibundle because it worked on felix. So what else in there is necessary. The cxf-minimal-bundle upon inspection has the missing class causing that last error. So I install that. Try to start the discovery bundle, but I end up with some kind of corbabroker exception. Wtf. Whose using corba in all of this? Then I go back and undo all of that and try to stick with the singlebundle distros of ri and ri-discovery, but just turn off the servicemix http service. That crashes servicemix and I can't restart it becauuse the cxf jbi components end up with an unsatisfied dependency. Odd. I'll just ignore that because I don't use those anyway, and try to start my samples. Can't start the samples because it says jetty can't start because the ports already in use. Doesn't make sense because I shutdown the servicemix http service already. Then I restart jetty. Works? Maybe. My service gets registered and I can browse to the wsdl using firefox, but no registration in zookeeper. Try to shutdown the ri-discovery bundle and restart it, but I get a nullpointerexception. Appparently the ri-discovery never actually started up due to one of the aforementioned errors. Then I started trying to take apart the ri-discovery singlebundle and pull out the internals. That didn't work because its all apparently necessary, even though theres some libs inside we could do without.

End of the story. Can't get it to work. Can anybody else get it to work? I just want to run the discovery samples in SMX4. I'm pretty sure its just a bundle conflict problem. Isn't this what OSGi is supposed to fix??? This is worse than just telling me what jars you depend on and making me setup my classpath. At least then I'd eventually get the thing running.

My next steps, I think, will be to try again with the ri-multibundle, just the dsw and jdom, plus the ri-discovery singlebundle. Then I'll try some of the cxf-fuse bundles or some of the cxf-rt bundles to get around the soap transport issue.

Edit notes: I need more than just showing the DOSGi bundles in an Active state. They don't actually do much until you try to expose a service through them. I do need to see multiple machines registering services with a zookeeper instance and other machines consuming those services -- just like the running DOSGi Discovery Sample.

I've been able to get cxf to expose the distributed service sample as a soap webservice by using the minimal cxf bundle mentioned by either removing parts of the original cxf bundles and restarting the jetty service, and then starting the sample service... or by installing the cxf minimal buundle, then starting my service, then immediately uninstalling the cxf minimal bundle, then restarting jetty... I think that was the order. Neither of these will work from a clean startup, and having to restart services as a procedure to get DOSGi working is just bad. I don't even know why installing then uninstalling would do anything -- it shouldn't be leaving any artifacts around.

解决方案

First point, looking at the CXF DOSGi mega-bundle I think this is only for quick-n-dirty hacking in a bare OSGi runtime, basically the minimal environment provided by Equinox and Felix. It will not be intended for richer environments like FUSE or Servicemix as you will likely clash on services from the bundle and the platform, as you appear to have seen.

I was able to get Servicemix 4.0 to start cleanly (this is on Windows) and then I hot-deployed:

  • com.springsource.org.jdom-1.0.0.jar
  • cxf-bundle-minimal-2.2.1.jar
  • cxf-dosgi-ri-discovery-local-1.0.jar
  • cxf.dosgi-ri-dws.cxf-1.0.jar

Using the Servicemix console I listed all bundles and saw that all of the above were in the Active state (as expected). I listed the services and the 2 CXF DOSGi bundles were exporting services, so that appeared to have worked correctly. No errors were reported in the log.

How familiar are you with OSGi? Servicemix looks quite large and learning OSGi, Servicemix and CXF/DOSGi together isn't going to be easy (in my opinion).

The supplied console isn't great for the OSGi stuff and I'd suggest installing the Apache Felix console bundles for a web interface.

这篇关于Servicemix 4,DOSGi和Zookeeper的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆