这是一个复杂的配置问题 我这里有一个示例项目(开发分支) - > https://github.com/gadieichhorn/play.karaf.calculator/tree/develop
我打包了这些功能,并使用了karaf-assembly工件来尝试创建一个已经部署了我的项目的自定义karaf发行版。
到目前为止,我可以在我的本地karaf上部署feature / kar,但是当我创建自定义karaf程序集时,cxf REST服务无效。
包装过程自动化: 构建 - > feature / kar - >装配 - >集成测试(pax-exam) - > docker - >验收。
2016-09-12 02:14:52,245 | WARN | qtp18647439-126 | AbstractJAXBProvider | 40 - org.apache.cxf.cxf-rt-frontend-jaxrs - 3.1.6 | javax.xml.bind.JAXBException
- with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory not found by cxf-dosgi-ri-dsw-cxf [13]]
```
以下是我的功能依赖项:
<feature>scr</feature>
<feature>aries-rsa-core</feature>
<feature>cxf-jaxrs</feature>
<feature>cxf-dosgi-provider-cxf</feature>
这是我的集会:
<configuration>
<startupFeatures>
<feature>eventadmin</feature>
</startupFeatures>
<bootFeatures>
<feature>minimal</feature>
<feature>shell</feature>
<feature>shell-compat</feature>
<feature>aries-blueprint</feature>
<feature>scr</feature>
<feature>aries-rsa-core</feature>
<feature>cxf-jaxrs</feature>
<feature>cxf-dosgi-provider-cxf</feature>
<feature>calculator</feature>
</bootFeatures>
</configuration>
我的REST服务API
@Component(
name = "org.play.karaf.calculator.proxy.root",
service = {ProxyRoot.class},
property = {
"service.exported.interfaces=*",
"service.exported.configs=org.apache.cxf.rs",
"org.apache.cxf.rs.httpservice.context=/calculator",
"org.apache.cxf.rs.address=/proxy"
}
)
public class ProxyRootProvider implements ProxyRoot { ...
我的模型仍然是JAXB实现,它应该由CXF的默认提供程序提供。我需要添加提供商吗?
我尝试过:
Karaf 4.0.5&amp; 4.0.6
CXF 3.1.6&amp; 3.1.7
白羊座1.8.0。 &安培; 1.9.0
DOSGi 1.8.0
我在装配阶段错过了什么让发行版工作?
感谢。
答案 0 :(得分:0)
您的功能有拼写错误:cxf-dosgi-provider- cxf 必须是cxf-dosgi-provider- rs
还要比较自定义karaf程序集中karaf_home / lib / endorsed中的库和karaf的默认分布。 如果不一样,请在配置中添加所有已签名的库。
例如:
<libraries>
<library>mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxp-api-1.4/2.8.0;type:=endorsed</library>
<!-- ... other libraries -->
</libraries>