Accessing resource adapter archive ( RAR ) services from a web archive.
peterfry Mar 21, 2012 12:28 PMI am working with JBoss AS 7.1 Final
I have a resource adapter archive (in fact it is the Jackrabbit RAR file with some JBoss 7 tweaks).
the structure of this rar file is:
/META-INF/MANIFEST.MF
/jackrabbit-jcr-commons-2.4.0.jar
plus lots of other jar files in the root directory
In the jackrabbit-jcr-commons-2.4.0.jar file there is a
/META-INF/services/javax.jcr.RepositoryFactory
I then have a WAR file (in fact the JCR bridge war file from the chemistry project).
When I deploy it beside the RAR file (after adding
Dependencies: javax.jcr,deployment.jackrabbit-jca-2.4.0.rar export services
in the META-INF/MANIFEST.MF of the WAR file I get
Exception sending context initialized event to listener instance of class org.apache.chemistry.opencmis.server.impl.CmisRepositoryContextListener: org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException: No JCR repository factory for configured parameters
at org.apache.chemistry.opencmis.jcr.JcrServiceFactory.acquireJcrRepository(JcrServiceFactory.java:119) [chemistry-opencmis-server-jcr-0.6.0.jar:0.6.0]
at org.apache.chemistry.opencmis.jcr.JcrServiceFactory.init(JcrServiceFactory.java:72) [chemistry-opencmis-server-jcr-0.6.0.jar:0.6.0]
at org.apache.chemistry.opencmis.server.impl.CmisRepositoryContextListener.createServiceFactory(CmisRepositoryContextListener.java:126) [chemistry-opencmis-server-bindings-0.6.0.jar:0.6.0]
at org.apache.chemistry.opencmis.server.impl.CmisRepositoryContextListener.contextInitialized(CmisRepositoryContextListener.java:56) [chemistry-opencmis-server-bindings-0.6.0.jar:0.6.0]
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.10.Final.jar:]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.10.Final.jar:]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.0.Final.jar:7.1.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_13]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_13]
at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_13]
This is an exception from a jar file in the WAR file. The pertinent code from the Apache Chemistry class is
/**
* Acquire the JCR repository given a configuration. This implementation used
* {@link javax.imageio.spi.ServiceRegistry#lookupProviders(Class)} for
* locating <code>RepositoryFactory</code> instances. The first instance
* which can handle the <code>jcrConfig</code> parameters is used to
* acquire the repository.
*
* @param jcrConfig configuration determining the JCR repository to be returned
* @return
* @throws RepositoryException
*/
protected Repository acquireJcrRepository(Map<String, String> jcrConfig) {
try {
Iterator<RepositoryFactory> factories = ServiceRegistry.lookupProviders(RepositoryFactory.class);
while (factories.hasNext()) {
RepositoryFactory factory = factories.next();
log.debug("Trying to acquire JCR repository from factory " + factory);
Repository repository = factory.getRepository(jcrConfig);
if (repository != null) {
log.debug("Successfully acquired JCR repository from factory " + factory);
return repository;
}
else {
log.debug("Could not acquire JCR repository from factory " + factory);
}
}
throw new CmisConnectionException("No JCR repository factory for configured parameters");
}
catch (RepositoryException e) {
log.debug(e.getMessage(), e);
throw new CmisConnectionException(e.getMessage(), e);
}
}
So even though I created a dependency from the WAR file deployment to the RAR file deployment unit and added services it still can't find the service via the javax.imageio.spi.ServiceRegistry.lookupProviders(...) mechanism.
Is WAR file to RAR file dependency supported?
Peter.