Skip navigation
ermag
Currently Being Moderated

How to use a custom Persistence Manager

May 3, 2012 1:28 AM

Tags: #configuration #crx #jackrabbit #cq5.5 #osgi

I'm experimenting with implementing a custom Persistence Manager for CRX/CQ5. How the underlying implementation works is not important, the issue I'm having seems instead to be related to classloading or OSGi inside CQ5.

 

I've implemented a custom Persistence Manager (implements org.apache.jackrabbit.core.persistence.PersistenceManager) and a custom FileSystem (implements org.apache.jackrabbit.core.fs.FileSystem).

 

I've verified that both implementations function correctly with plain Apache Jackrabbit (version 2.4.0, the same version used internally by CQ5.5).

 

I've packaged my implementation and all its dependencies as an OSGi bundle and installed it to CQ5.5. All dependencies as resolved and the bundle status in the OSGi console is "Active".

 

I then followed these instructions for configuring the CQ 5.5 repository to use my PersistenceManager and FileSystem implementations:

http://dev.day.com/docs/en/cq/current/core/administering/persistence_m anagers.html#The%20Tar%20Persistence%20Manager

 

The configuration seems to be read just fine but I get the following exception when restarting CQ:

 

 

23.04.2012 09:20:23.714 *ERROR* [FelixStartLevel] com.day.crx.sling.server [com.day.crx.sling.server.impl.jmx.ManagedRepository] 
The activate method has thrown an exception (org.apache.jackrabbit.core.config.ConfigurationException: 
Configured class com.example.XXFileSystem does not implement org.apache.jackrabbit.core.fs.FileSystem. Please fix the repository configuration.) org.apache.jackrabbit.core.config.ConfigurationException: Configured class com.example.XXFileSystem does not implement org.apache.jackrabbit.core.fs.FileSystem. Please fix the repository configuration.
    at org.apache.jackrabbit.core.config.BeanConfig.newInstance(BeanConfig.java:179)
    at org.apache.jackrabbit.core.config.RepositoryConfigurationParser$6.getFileSystem(RepositoryConfigurationParser.java:1077)
    at org.apache.jackrabbit.core.config.VersioningConfig.getFileSystem(VersioningConfig.java:94)
    at com.day.crx.core.CRXRepositoryImpl.createVersionManager(CRXRepositoryImpl.java:841)
    at org.apache.jackrabbit.core.RepositoryImpl.<init>(RepositoryImpl.java:305)
    at com.day.crx.core.CRXRepositoryImpl.<init>(CRXRepositoryImpl.java:283)
    at com.day.crx.core.CRXRepositoryImpl.create(CRXRepositoryImpl.java:258)
    at com.day.crx.core.CRXRepositoryImpl.create(CRXRepositoryImpl.java:243)
    at com.day.crx.sling.server.impl.jmx.ManagedRepository.activate(ManagedRepository.java:164)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:227)
    at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:38)
    at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:591)
    at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:472)
    at org.apache.felix.scr.impl.helper.ActivateMethod.invoke(ActivateMethod.java:146)
    at org.apache.felix.scr.impl.manager.ImmediateComponentManager.createImplementationObject(ImmediateComponentManager.java:226)
    at org.apache.felix.scr.impl.manager.ImmediateComponentManager.createComponent(ImmediateComponentManager.java:118)
    at org.apache.felix.scr.impl.manager.DelayedComponentManager.createRealComponent(DelayedComponentManager.java:95)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager$Registered.getService(AbstractComponentManager.java:1296)
    at org.apache.felix.scr.impl.manager.DelayedComponentManager.getService(DelayedComponentManager.java:88)
    at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:310)
    at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:221)
    at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:292)
    at org.apache.felix.framework.Felix.getService(Felix.java:3010)
    at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:329)
    at org.osgi.util.tracker.ServiceTracker.addingService(ServiceTracker.java:442)
    at org.apache.aries.jmx.whiteboard.Activator$MBeanTracker.addingService(Activator.java:101)
    at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:896)
    at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:261)
    at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:233)
    at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:840)
    at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:871)
    at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:733)
    at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:662)
    at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3765)
    at org.apache.felix.framework.Felix.registerService(Felix.java:2877)
    at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:251)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.registerService(AbstractComponentManager.java:456)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.registerComponentService(AbstractComponentManager.java:508)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager$Unsatisfied.activate(AbstractComponentManager.java:1157)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:334)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:158)
    at org.apache.felix.scr.impl.config.ImmediateComponentHolder.enableComponents(ImmediateComponentHolder.java:313)
    at org.apache.felix.scr.impl.BundleComponentActivator.loadDescriptor(BundleComponentActivator.java:241)
    at org.apache.felix.scr.impl.BundleComponentActivator.initialize(BundleComponentActivator.java:147)
    at org.apache.felix.scr.impl.BundleComponentActivator.<init>(BundleComponentActivator.java:111)
    at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:274)
    at org.apache.felix.scr.impl.Activator.bundleChanged(Activator.java:192)
    at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:807)
    at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:729)
    at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:610)
    at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:3754)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:1780)
    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1156)
    at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:266)
    at java.lang.Thread.run(Thread.java:662)

 

 

Anyone have any idea how to get past this?

My FileSystem class most certainly does implement org.apache.jackrabbit.core.fs.FileSystem, as verified by that it works just fine with Jackrabbit.

 

I've also made sure that I use the exact same jackrabbit-core jar file in my bundle that is included in the com.day.crx.sling.server bundle.

 
Replies
  • Currently Being Moderated
    May 3, 2012 5:29 AM   in reply to ermag

    I've also made sure that I use the exact same jackrabbit-core jar file in my bundle that is included in the com.day.crx.sling.server bundle.

    As in statically including the .jar in your OSGI bundle? If so, you might be implementing the correct interface, but a different "instance" of the interface than what's already loaded by CRX - import via it OSGI instead.

     
    |
    Mark as:
  • Justin Edelson
    276 posts
    Nov 24, 2010
    Currently Being Moderated
    May 3, 2012 5:59 AM   in reply to ermag

    In CQ 5.5, any repository extensions (like custom PMs) need to be implemented in fragment bundles. You should not include any jackrabbit-core code inside your fragment - instead the custom PM will load the jackrabbit (or CRX) core classes from the host bundle.

     

    This mostly applies to LoginModules (see last item on http://dev.day.com/content/kb/home/cq5/CQ5Troubleshooting/cq55prerelea se-installandconfigchanges.html), but would apply to PersistenceManagers as well.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points