Hi Christian,
Why do you want to register the Session as a service ?
While I cannot tell about the problems with Equinox (over in Apache
Sling we are using Felix Framework, to tests with Equinox show no
problems at all...)
Anywy, regarding OSGi-fication of Jackrabbit: Some libraries are OSGi
bundles already: the Jackrabbit API, the Jackrabbit JCR Commons,
Jackrabbit JCR RMI. Others might follow.
With the embedded Jackrabbit Repository it is not so simple, because
repository has quite an extensive list of dependencies and you would
have to decide whether to include these in the bundle or import them.
In Apache Sling, we have created a Jackrabbit Server bundle which
provides an embedded Jackrabbit Repository and registers it as a
service. See also the Sling wiki page [1] about launching Jackrabbit
inside Eclipse.
Hope this helps.
Regards
Felix
[1]
http://cwiki.apache.org/SLING/launching-a-jcr-repository-inside-equinox.html
Christian Trutz schrieb:
Hello,
i am trying to register a jackrabbit javax.jcr.Session as OSGi
Service, something like:
/**
* {...@inheritdoc}
*
* @see BundleActivator#start(BundleContext)
*/
public void start(BundleContext context) throws Exception {
this.repository = new TransientRepository();
Session session = repository.login();
sessionServiceRegistration =
context.registerService(Session.class.getName(), session, new
Properties());
}
and it does not work because of:
org.eclipse.osgi.framework.internal.core.AbstractBundle$BundleStatusException
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.beginStateChange(AbstractBundle.java:1144)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:263)
at
org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:400)
at
org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:111)
at
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:427)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:193)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findLocalClass(BundleLoader.java:368)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findClassInternal(BundleLoader.java:444)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:397)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:385)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:87)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at
org.apache.lucene.index.DocumentsWriterThreadState.<init>(DocumentsWriterThreadState.java:38)
at
org.apache.lucene.index.DocumentsWriter.getThreadState(DocumentsWriter.java:680)
at
org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:755)
at
org.apache.lucene.index.DocumentsWriter.addDocument(DocumentsWriter.java:743)
at
org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1917)
at
org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1895)
at
org.apache.jackrabbit.core.query.lucene.AbstractIndex$1.call(AbstractIndex.java:183)
at
org.apache.jackrabbit.core.query.lucene.DynamicPooledExecutor$1.call(DynamicPooledExecutor.java:109)
at EDU.oswego.cs.dl.util.concurrent.FutureResult$1.run(Unknown Source)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown
Source)
at java.lang.Thread.run(Thread.java:619)
All jackrabbit jars dependencies are included into my bundle, they are
NOT registred as extra bundles.
I see that only jackrabbit-api is a OSGi bundle ... Is it planed for
release 2.0 to bundlefy all jackrabbit
components? (and theirs related dependencies)
Regards
Christian