【问题标题】:camel jpa waiting for namespace handlers骆驼 jpa 等待命名空间处理程序
【发布时间】:2013-03-23 08:05:49
【问题描述】:

我正在尝试为我的骆驼 jpa 示例编写一个 RouteTest 类,但由于以下行,它无法按预期工作:

Bundle RouteTest 正在等待命名空间处理程序 [http://aries.apache.org/xmlns/jpa/v1.1.0]

请在此处找到 blueprint.xml 文件

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:camel="http://camel.apache.org/schema/blueprint"
        xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
        xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.1.0"
        xsi:schemaLocation="
                http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
                http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
                http://aries.apache.org/xmlns/jpa/v1.1.0 http://aries.apache.org/schemas/jpa/jpa_110.xsd">

    <bean id="jpa" class="org.apache.camel.component.jpa.JpaComponent">
        <jpa:unit unitname="persistence-pu" property="entityManagerFactory" />
    </bean>

    <camelContext trace="true" id="blueprintContext" xmlns="http://camel.apache.org/schema/blueprint">
    <route id="persist">
        <from uri="direct:persist"/>
        <to uri="jpa:Person"/>
    </route>
</camelContext>
</blueprint>

这里还有 RouteTest 类:

public class RouteTest extends CamelBlueprintTestSupport {

    @Override
    protected String getBlueprintDescriptor() {
        return "/OSGI-INF/blueprint/blueprint.xml";
    }

    @Test
    public void testRoute() throws Exception {
        getMockEndpoint("mock:result").expectedMinimumMessageCount(1);
        ProducerTemplate producerTemplate = new DefaultCamelContext().createProducerTemplate(); 
        Person person = new Person();
        person.setName("Bob");
        producerTemplate.sendBody("direct:persist", person);

        // assert expectations
        assertMockEndpointsSatisfied();
    }

}

【问题讨论】:

    标签: jpa osgi fuseesb jbossfuse aries


    【解决方案1】:

    您需要提供 Aries 蓝图,尤其是您需要提供 aries JPA 依赖项。你如何测试你的路线?我建议使用 Pax-Exam,或者最好使用 Pax-Exam-Karaf 并安装 aries jpa 功能。

    【讨论】:

    • 感谢您的回答。我刚刚添加了我正在使用的蓝图和 RouteTest 代码。
    • 你的类路径(maven pom)中有 aries 蓝图吗?哦,顺便说一句。 CamelBlueprintTestSupport 不适用于 JPA,它适用于简单的 Camel 测试,但由于 PojoSR 而与 JPA 搞砸了,我真的建议使用 Pax-Exam 或更好的 Pax-Exam-Karaf。
    • 我已经向 aries 添加了依赖项,现在我有一个新问题 :( [ Blueprint Extender: 1] BlueprintContainerImpl INFO Bundle RouteTest 正在等待依赖项 [(&(&(!(org.apache. aries.jpa.proxy.factory=*))(osgi.unit.name=jpa-example-pu))(objectClass=javax.persistence.EntityManagerFactory))]
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-01-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-11
    • 1970-01-01
    相关资源
    最近更新 更多