我是骆驼世界的新手,在与 jcr 组件建立连接时遇到问题。看看我的测试代码:
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.jcr.JcrConstants;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
public class ObjectToJCRRouteTest extends CamelTestSupport {
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:a")
.setProperty(JcrConstants.JCR_NODE_NAME,
constant("node"))
.setProperty("my.contents.property", body())
.to("jcr://admin:admin@localhost:8080/home/test");
}
};
}
@Test
public void putJCRNode() throws Exception {
template.sendBodyAndHeader("direct:a", null, null, null);
Thread.sleep(1000);
}
}
我试过 jcr://admin:admin@localhost/home/test", "jcr://admin:admin@localhost:8080/home/test" , "jcr://admin:admin@localhost:8080/repository /家/测试”
我使用 rmi 使用存储库浏览器( http://www.subshel l.com/en/toromiro/index.html )测试了jackrabbit,并且连接成功
提前感谢任何帮助!
我的jackrabit服务器是:
jmartinez@jmartinez:~/software/jackrabbit$ java -jar jackrabbit-standalone-2.4.3.jar
欢迎来到 Apache Jackrabbit!
使用存储库目录jackrabbit
将日志消息写入jackrabbit/log
启动服务器...
Apache Jackrabbit 现在运行在http://localhost:8080/
pom配置
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jcr</artifactId>
<version>2.10.4</version>
</dependency>
异常代码是
org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> To[jcr://admin:admin@localhost:8080/rmi/home/test] <<< in route: Route[[From[direct:a]] -> [SetProperty[CamelJcrNodeName, {no... **because of Failed to resolve endpoint: jcr://admin:admin@localhost:8080/rmi/home/test due to: No JCR repository defined under 'localhost'**
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:879)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:172)
at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:722)
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1789)
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1575)
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1444)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1412)
at org.apache.camel.test.junit4.CamelTestSupport.startCamelContext(CamelTestSupport.java:184)
at org.apache.camel.test.junit4.CamelTestSupport.setUp(CamelTestSupport.java:115)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: jcr://admin:admin@localhost:8080/rmi/home/test due to: No JCR repository defined under 'localhost'
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:479)
at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:50)
at org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:187)
at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:108)
at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:114)
at org.apache.camel.model.SendDefinition.resolveEndpoint(SendDefinition.java:61)
at org.apache.camel.model.SendDefinition.createProcessor(SendDefinition.java:55)
at org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:461)
at org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:179)
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:876)
... 32 more
Caused by: org.apache.camel.RuntimeCamelException: No JCR repository defined under 'localhost'
at org.apache.camel.component.jcr.JcrEndpoint.<init>(JcrEndpoint.java:65)
at org.apache.camel.component.jcr.JcrComponent.createEndpoint(JcrComponent.java:31)
at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:91)
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:461)
... 41 more