Hi,

We have just migrated our JackRabbit from version 2.16 (circa 2018) to the
most recent (2.21.25)

We realize that some of the bundles have changed a bit but we are having an
issue with the following code:

private Repository getRepository() throws Exception {

if (repository == null) {

String repositoryHome = getBaseRepoFolder().getAbsolutePath();

String configFile = FileLocator.toFileURL(bundle.getEntry(
REPOSITORY_CONFIG_FILE)).getPath();

Map<String, String> parameters = new HashMap<>();

parameters.put(RepositoryFactoryImpl.REPOSITORY_HOME, repositoryHome);

parameters.put(RepositoryFactoryImpl.REPOSITORY_CONF, configFile);


JackrabbitRepositoryFactory repositoryFactory = new RepositoryFactoryImpl();

repository = repositoryFactory.getRepository(parameters);

// repository = JcrUtils.getRepository(parameters);

}


return repository;

}



Which throws the following exception:
Caused by: java.lang.NoClassDefFoundError:
org/apache/jackrabbit/core/config/RepositoryConfig
    at
org.apache.jackrabbit.core.TransientRepository.<init>(TransientRepository.java:263)
    at
org.apache.jackrabbit.core.RepositoryFactoryImpl.getOrCreateRepository(RepositoryFactoryImpl.java:148)
    at
org.apache.jackrabbit.core.RepositoryFactoryImpl.getRepository(RepositoryFactoryImpl.java:105)
    at
org.apache.jackrabbit.core.RepositoryFactoryImpl.getRepository(RepositoryFactoryImpl.java:76)
    at
com.castortech.iris.ba.file.provider.internal.RepositoryManager.getRepository(RepositoryManager.java:122)
Caused by: java.lang.ClassNotFoundException:
org.apache.jackrabbit.core.config.RepositoryConfig cannot be found by
org.apache.jackrabbit.core_2.21.25
    at
org.eclipse.osgi.internal.loader.BundleLoader.generateException(BundleLoader.java:541)
    at
org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:487)
    at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:416)
    at
org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:168)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    ... 119 common frames omitted

Line 222 is the repositoryFactory.getRepository above (last real line)

What we are seeing is that the RepositoryConfig class ultimately expects to
have access to o.a.jr.core.data and o.a.jr.core.fs that come from the data
bundle, which packages seem to clash with one another. For reference note
that we are using Eclipse PDE OSGI.

Is there any particular setup required to have both bundles loaded here? Is
that a case of needing to use fragments?

Thanks
Alain

Reply via email to