等待依赖项 [(&(component=Simple)(objectClass=org.apache.camel.spi.ComponentResolver))]

Waiting for dependencies [(&(component=Simple)(objectClass=org.apache.camel.spi.ComponentResolver))]

我正在使用 Apache Camel,我正在定义一个我需要访问一些 header 的路由。为此,我使用简单的方法动态访问 header。

from("direct:buildInformation")     
    .setProperty("id", constant(simple("${header.headers[id]}")))
    .to(simple("http://localhost/search?id=${header.headers[id]}"))
    .process("MyProcessor");

但是我收到错误:正在等待依赖项 [(&(component=Simple)(objectClass=org.apache.camel.spi.ComponentResolver))]。在我的 pom.xml 项目中,我导入了所有需要的依赖项,包括 camel-core,这是简单语言正常工作所需的,如您所见。

<dependencies>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-blueprint</artifactId>
        <version>${camel-version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>net.sourceforge.jexcelapi</groupId>
        <artifactId>jxl</artifactId>
        <version>2.6.12</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-core</artifactId>
        <version>${camel-version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-http</artifactId>
        <version>${camel-version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-http4</artifactId>
        <version>${camel-version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-jackson</artifactId>
        <version>${camel-version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-jsonpath</artifactId>
        <version>${camel-version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${slf4j-version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.4</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

此外,从我的 Karaf 控制台我看到 camel-core 处于活动状态,但我的包处于 GracePeriod 状态:[(&(component=Simple)(objectClass=org.apache.camel.spi.ComponentResolver))]。在我的 Karaf 控制台打印屏幕下方。

来自 karaf 控制台的图片显示 camel-core 依赖处于活动状态

在 Karaf 上诊断 mybundle 后出现错误

根据this link,Blueprint需要找到引用。在这种情况下,您可以尝试将如下所示的超时添加到 blueprint.xml:

<reference id="Simple" 
    interface="org.apache.camel.spi.ComponentResolver" 
    timeout="30000"/>