无法解析355.0:缺少需求[355.0] osgi.wiring.package; (osgi.wiring.package = org.apache.camel-的servlet)

时间:2017-01-24 13:22:12

标签: jboss jbossfuse

当我尝试在保险丝服务器中启动该过程但是捆绑包已正确安装时,我收到以下错误。

Unable to resolve 355.0: missing requirement [355.0] osgi.wiring.package; (osgi.wiring.package=org.apache.camel-servlet)

我在POM.xml文件中注入了以下依赖项。

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-servlet</artifactId>
    <version>2.18.0</version>
</dependency>

我还在blueprind.xml文件中包含以下内容:`

<reference id="httpService" interface="org.osgi.service.http.HttpService"/>
<bean
    class="org.apache.camel.component.servlet.CamelHttpTransportServlet" id="camelServlet"/>
<bean
    class="org.apache.camel.component.servlet.osgi.OsgiServletRegisterer"
    destroy-method="unregister" id="registerCamel" init-method="register">
    <property name="alias" value="/restweb"/>
    <property name="httpService" ref="httpService"/>
    <property name="servlet" ref="camelServlet"/>
    <property name="servletName" value="CamelServlet"/>
</bean>

在camelContext中我有以下内容:

<propertyPlaceholder id="properties" location="classpath:properties.sql"/>
    <restConfiguration bindingMode="json" component="servlet"
        contextPath="/restweb" host="localhost" port="9999">
        <dataFormatProperty key="prettyPrint" value="true"/>
    </restConfiguration>

我正在使用Jboss版本10xx和运行时Jboss fuse 6.3。它是一个休息的Web服务,使用bluprint route config。那里有谁可以帮我解决这个问题吗?

提前致谢。

嗨Rugna,谢谢你的回复。我试图安装功能:安装camel-servlet ****并使用此命令我得到以下错误抛出但我不知道如何解决问题并安装我想要的功能。

JBossFuse:karaf@root> features:list | grep camel-servlet
[uninstalled] [2.17.0.redhat-630187 ] camel-servlet                           camel-2.17.0.redhat-630187
[uninstalled] [2.17.0.redhat-630187 ] camel-servletlistener                   camel-2.17.0.redhat-630187
JBossFuse:karaf@root> features:install camel-servlet
Error executing command: The container is managed by fabric, please use fabric:profile-edit --feature camel-servlet/0.0.0 target-profile instead. See fabric:profile-edit --help for more information.
JBossFuse:karaf@root>

1 个答案:

答案 0 :(得分:0)

您的软件包需要camel-servlet工件,这在JBoss Fuse 6.3.0中默认不可用。

JBossFuse:karaf@root> features:list | grep camel-servlet
[uninstalled] [2.17.0.redhat-630187 ] camel-servlet                                 camel-2.17.0.redhat-630187
[uninstalled] [2.17.0.redhat-630187 ] camel-servletlistener                         camel-2.17.0.redhat-630187

使用

安装
features:install camel-servlet
features:install camel-servletlistener

然后验证camel servlet包的可用性:

JBossFuse:karaf@root> exports | grep servlet
...
303 org.apache.camel.component.servlet; version=2.17.0.redhat-630187
303 org.apache.camel.component.servlet.osgi; version=2.17.0.redhat-630187
304 org.apache.camel.component.servletlistener; version=2.17.0.redhat-630187

然后请验证您的软件包是如何构建的,因为Camel servlet所需的软件包是org.apache.camel.component.servlet而不是org.apache.camel-servlet

如果您使用maven-bundle-plugin打包并手动声明依赖项,那么您的POM应如下所示:

<plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <extensions>true</extensions>
    <configuration>
        <instructions>
            ...
            <Import-Package>
                org.apache.camel.component.servlet;version="[2.17,2)",  // package name here
                *
            </Import-Package>
        </instructions>
    </configuration>
</plugin>