卡拉夫开发
我目前正在为 karaf 开发捆绑包,并且有一些问题...
我编写了一个基于 cxf 的捆绑包/网络服务,我尝试将其部署在 karaf 中,但它无法启动该捆绑包,因为它无法解析某些包,例如
org.osgi.framework .BundleException:捆绑包org.springframework.aop [56]中未解决的约束:无法解析56.0:丢失 要求[56.0]包; (&(package=org.aopalliance.aop)(version>=1.0.0)(!(version>=2.0.0)))
所以这里有一个问题,这个包依赖来自 spring-aop (3.1.0 .RELEASE),那么问题出在哪里呢?缺少什么依赖项?我该如何解决这些问题?
那样的话我就不清楚开发流程了。我应该在部署中部署所有缺少的包吗?因为我想将第三方库从我开发的捆绑包中分离出来。我必须部署哪些捆绑包?这是一个反复试验的过程吗?有没有一个通用的方法让maven做依赖的事情?
我发现了一个文件夹“system”,并在文档中读到它是一个像 Maven 一样的存储库,是为了功能吗?
我有一个带有一些预先部署的捆绑包的 karaf 测试用例,并将我的 webservice 捆绑包放入其中,但再次出现异常...
引起:java.lang.ClassNotFoundException:javax.servlet.http.HttpServlet
缺少什么依赖项?
我已经阅读了有关camel和karaf的教程,但它没有解释部署的内容,所以有人能给我推荐一个好的教程吗?
谢谢! 克里斯
Im currently develop bundles for karaf and have some questions...
I wrote a bundle/webservice based on cxf, I try to deploy it in karaf but it could not start that bundle because it could not resolve some packages e.g.
org.osgi.framework.BundleException: Unresolved constraint in bundle org.springframework.aop [56]: Unable to resolve 56.0: missing
requirement [56.0] package; (&(package=org.aopalliance.aop)(version>=1.0.0)(!(version>=2.0.0)))
so here is a question, this package dependency comes from spring-aop (3.1.0.RELEASE), so where is the problem? what dependency is missing? how can I solve such problems?
In that case i did not clearly understand the development process. should i deploy all missing bundles in deploy? because i would like to keep thirdparty libs spereated from my developed bundles. And what bundles i have to deploy? Is it a trial and error process? Is there a common way to let maven do the dependency stuff?
I discovered a folder "system" and read on the docu that it is a repository like maven, is it for the features?
I had for test cases a karaf with some pre deployed bundles and put my webservice bundle into it, but again execeptions...
Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpServlet
What dependency is missing?
I already read the tutorial about camel and karaf, but it did not explain the deployment stuff, so could anyone suggest me a good tutorial?
Thanks!
Chris
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
简短回答
向下滚动到引用“camel-cxf”的部分,然后运行两个命令 features:addurl 和 features:install。我有一种感觉,这会解决你所有的问题。
spring-aop
在 Karaf 控制台上输入:
我想你会看到类似这样的行:
因此,虽然 spring-aop 包有正确的包,但它们是错误的版本,所请求的范围是 >= 1.0.0 和 <2.0.0,所以 3.1.0 不满足这一点。
部署/安装
您可以将捆绑包放入 ${karaf.home}/deploy 中或使用控制台。
您可以通过以下方式从 Karaf 控制台安装 Maven 捆绑包:
其中
-s
启动捆绑包,并且打包/分类器是可选的。你可以在这里找到很多 OSGi 就绪的 Maven 依赖项 http://ebr.springsource.com/repository/app / - 我快速浏览了一下,但是您的 spring aop 依赖项非常旧,您使用的是哪个版本的 CXF?
了解 Karaf 功能 - 它们基本上是 XML 文件,列出了可以安装的捆绑包套件。对于部署大量包非常有用,它们可以安装到 Maven 存储库中。
Karaf 中提供了一些标准功能,请尝试:
这将为您提供一个 jetty web 容器,并可能解决您的 ClassNotFoundException: javax.servlet.http.HttpServlet 只要它是正确的版本
Camel 还有一个功能文件,可能可以解决您所有的问题,试试这个:
教程
有很多可用的内容,其中一些位于 http://karaf.apache.org 和 http://fusesource.com还可以查看 Karaf 发行版中附带的 PDF 手册。
始终注意信息可能已过时
Short answer
Scroll down to the bit referring to "camel-cxf" and run the two commands features:addurl and features:install. I have a feeling this will resolve all your problems.
spring-aop
On Karaf console type:
I think you'll see lines like:
So while the spring-aop bundle has the right packages they're the wrong version, the range being requested is >=1.0.0 and <2.0.0, so 3.1.0 doesn't satisfy that.
Deploying/Installing
You can drop bundles into ${karaf.home}/deploy or use the console.
You can install maven bundles from the Karaf console with:
Where
-s
starts the bundle and packaging/classifier are optional.You can find a lot of OSGi ready maven dependencies here http://ebr.springsource.com/repository/app/ - I had a quick look but your spring aop dependency is very old, what version of CXF are you using?
Read up about Karaf features - they're basically XML files that list suites of bundles that can be installed. Very useful for deploying large numbers of bundles and they can be installed into a maven repository.
There are some standard features available in Karaf, try:
This will give you a jetty webcontainer and may resolve your ClassNotFoundException: javax.servlet.http.HttpServlet as long as it's the right version
Camel also has a features file which probably sort all your issues, try this:
Tutorials
There's quite a bit available, some on http://karaf.apache.org and http://fusesource.com but also take a look at the PDF manual that comes in the Karaf distribution.
Always beware that info may be out-of-date
请发布您的 MANIFEST.MF 文件。我认为您没有提到 maven-bundle-plugin 依赖项中的标签。
Please post your MANIFEST.MF file. I think you didn't not mention the tag in maven-bundle-plugin dependency.