How do I use JNDI to connect to CRX from an external application ?
Hi ,
I am trying to access the repository using jcr-2.0.jar API through eclipse environment. Getting the same error.
Looking for an appropriate method of connecting DAY CQ crx.default repository and updating privilege rights for a node.
Could you please help in:
1. Connecting Day CRX repository through Eclipse environment.
2. Creating read, write privilege for a node.
Regards,
Sugeet Sharma
I'm unable to access the Repository object via JNDI with the code from the link above.
I'm running CQ5.5 on JBoss 5.1 and trying to access the Repository object via JNDI from a separate web application (separate WAR file).
When the JcrUtils.getRepository() method is executed it throws the following exception:
javax.jcr.RepositoryException: Unable to access a repository with the following settings:
org.apache.jackrabbit.repository.uri: jndi://crx?org.apache.jackrabbit.repository.jndi.name=crx&java.naming .factory.initial=com.day.util.jndi.provider.MemoryInitialContextFactor y&java.naming.provider.url=http://jcr.day.com
The following RepositoryFactory classes were consulted:
org.apache.jackrabbit.core.RepositoryFactoryImpl: declined
org.apache.jackrabbit.commons.JndiRepositoryFactory: failed
because of RepositoryException: Failed to look up crx from JNDI environment {java.naming.provider.url=http://jcr.day.com, java.naming.factory.initial=com.day.util.jndi.provider.MemoryInitialC ontextFactory, org.apache.jackrabbit.repository.uri=jndi://crx}
because of NameNotFoundException: null
Perhaps the repository you are trying to access is not available at the moment.
...
I tried all the approaches listed in the documentation (e.g. ServiceRegistry.lookupProviders()) without any luck. I noticed that a couple of RepositoryFactory objects are found, but when queried none of them resolves to a Repository object.
Any ideas on how to make it work ?
PS: I had tried this exact same scenario with CQ5.4 and used to work just fine, so I'm guessing it's a CQ5.5 issue.
At least with CQ 5.5 GA version it is a known issue, that Remoting via RMI is not working. Might have changed with SP1 or SP2 (haven't checked the release notes regarding this aspect).
Nevertheless, Remoting via WebDAV (davex) is working properly, and AFAIK its performance has been improved, so it's supposed to be faster than Remoting via RM.
Jörg
I'm having the same problem Daniel was having. This problem happens when connecting via JNDI only. Might be the reason why the "crx" name cannot be resolved because it is not defined. I remember, for CQ 5.4 the JNDI name was declared in the web.xml as follows:
<servlet>
<servlet-name>JackrabbitRepositoryAccessServlet</servlet-name>
<servlet-class>org.apache.jackrabbit.j2ee.RepositoryAccessServlet</se rvlet-class>
<init-param>
<param-name>repository-name</param-name>
<param-value>crx</param-value>
</init-param>
<init-param>
<param-name>java.naming.provider.url</param-name>
<param-value>http://jcr.day.com</param-value>
</init-param>
<init-param>
<param-name>java.naming.factory.initial</param-name>
<param-value>com.day.util.jndi.provider.MemoryInitialContextFactory</ param-value>
</init-param>
<load-on-startup>10</load-on-startup>
</servlet>
The documentation on accessing crx remotely(http://dev.day.com/docs/en/crx/current/developing/accessing_the_crx.ht ml#Accessing%20via%20the%20CRX%20web%20application) suggests that we could use either rmi or webdav. Since 5.5 no longer supports rmi, the only option left is webdav. I followed the documentation and when i tried the below code from the client it threw an exception. The documentation mentions that the libraries needed are available under this folder crx-quickstart/opt/examples/davex-client/lib. But i was not able to locate this folder in my installation. Is there a way to get these libraries that are needed for web dav to work? Any help in this regard would be greatly appreciated.
// WebDAV remoting access to a CRX server
JcrUtils.getRepository("http://localhost:7402/crx/server");
Thanks
North America
Europe, Middle East and Africa
Asia Pacific