I'm working on apache camel and adobe cq5.
I wrote a program using apache camel to create a jcr node in the adobe cq5. I'm using Apache camel JCR component (http://camel.apache.org/jcr.html) to create a route to the cq5 repository and running the code outside cq.
I'm using apache camel version 2.13.
My apache camel route :
from("direct:start").routeId("myRoute")
.setHeader(JcrConstants.JCR_NODE_NAME, constant("node/subnode"))
setHeader("my.contents.property", body())
.to("jcr://admin:admin@repository/content/sam")
While Excecuting the program I'm getting "javax.jcr.RepositoryException: Remote repository not found" and "java.io.StreamCorruptedException: invalid stream header: 3C68746D" Exceptions.
My Exception Stack
Exception in thread "main" org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: javax.jcr.RepositoryException: Remote repository not found: The resource at http://127.0.0.1:4502/crx/server could not be retrieved
at org.apache.jackrabbit.rmi.repository.URLRemoteRepositoryFactory.getRemoteRepository(URLRemoteRepositoryFactory.java:84)
at org.apache.jackrabbit.rmi.repository.AbstractRemoteRepositoryFactory.getRepository(AbstractRemoteRepositoryFactory.java:58)
at org.apache.jackrabbit.rmi.repository.ProxyRepository.login(ProxyRepository.java:199)
at org.apache.jackrabbit.rmi.repository.ProxyRepository.login(ProxyRepository.java:233)
at org.apache.camel.component.jcr.JcrProducer.openSession(JcrProducer.java:153)
at org.apache.camel.component.jcr.JcrProducer.process(JcrProducer.java:47)
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:110)
at org.apache.camel.management.InstrumentationProcessor.pro... [Body clipped after 1000 chars, total length is 3105]]
at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1379)
at org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:622)
at org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:467)
at org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:463)
at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:139)
at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:144)
at com.cq.camel.contextclasses.HttpRoute.callMethod(HttpRoute.java:43)
at com.cq.camel.mainclass.App.main(App.java:18)
Caused by: javax.jcr.RepositoryException: Remote repository not found: The resource at http://localhost:4502/crx/server could not be retrieved
at org.apache.jackrabbit.rmi.repository.URLRemoteRepositoryFactory.getRemoteRepository(URLRemoteRepositoryFactory.java:84)
at org.apache.jackrabbit.rmi.repository.AbstractRemoteRepositoryFactory.getRepository(AbstractRemoteRepositoryFactory.java:58)
at org.apache.jackrabbit.rmi.repository.ProxyRepository.login(ProxyRepository.java:199)
at org.apache.jackrabbit.rmi.repository.ProxyRepository.login(ProxyRepository.java:233)
at org.apache.camel.component.jcr.JcrProducer.openSession(JcrProducer.java:153)
at org.apache.camel.component.jcr.JcrProducer.process(JcrProducer.java:47)
at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:110)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at org.apache.camel.processor.TryProcessor.process(TryProcessor.java:109)
at org.apache.camel.processor.TryProcessor.process(TryProcessor.java:81)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:51)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:73)
at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:378)
at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:346)
at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:242)
at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:346)
at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:184)
at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:124)
at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:137)
... 3 more
Caused by: java.io.StreamCorruptedException: invalid stream header: 3C68746D
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream.<init>(Unknown Source)
at org.apache.jackrabbit.rmi.repository.URLRemoteRepositoryFactory.getRemoteRepository(URLRemoteRepositoryFactory.java:61)
... 29 more
I even tried with changing repository url "http://localhost:4502/crx/server". When I changed the url to "http://localhost:4502/crx/repository", I'm getting " java.io.IOException: Server returned HTTP response code: 401 for URL: http://localhost:4502/crx/repository/crx.default" Exception.
Please, help me to resolve this exception.....
Thank you.
Solved! Go to Solution.
Views
Replies
Total Likes
As already posted to the Camel User mailing list (http://camel.465427.n5.nabble.com/Apache-camel-and-Adobe-CQ5-td5751597.html#a5751634):
After reviewing the stack trace you have posted, it looks as if you want to access the repository via WebDAV, but Jackrabbit is trying to use RMI over HTTP to connect to it. Jackrabbit uses a service provider approach to find an appropriate implementation for the javax.jcr.RepositoryFactory interface, so you should use the following dependencies when connecting via WebDAV:
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-core</artifactId>
<version>2.6.5</version>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-jcr2dav</artifactId>
<version>2.6.5</version>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-webdav</artifactId>
<version>2.6.5</version>
</dependency>
Thanks,
Gregor
Views
Replies
Total Likes
As already posted to the Camel User mailing list (http://camel.465427.n5.nabble.com/Apache-camel-and-Adobe-CQ5-td5751597.html#a5751634):
After reviewing the stack trace you have posted, it looks as if you want to access the repository via WebDAV, but Jackrabbit is trying to use RMI over HTTP to connect to it. Jackrabbit uses a service provider approach to find an appropriate implementation for the javax.jcr.RepositoryFactory interface, so you should use the following dependencies when connecting via WebDAV:
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-core</artifactId>
<version>2.6.5</version>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-jcr2dav</artifactId>
<version>2.6.5</version>
</dependency>
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-webdav</artifactId>
<version>2.6.5</version>
</dependency>
Thanks,
Gregor
Views
Replies
Total Likes
Views
Likes
Replies