Nicolas, thanks for looking into this! If you only move the LuceneDataSource into an exported package, for instance org.neo4j.index.lucene, and export it, would that be sufficient to get the registration done?
I don't want to force OSGi upon all Index provider bundles (yet) and keep the impact of making this work at a minimum. Cheers, /peter neubauer GTalk: neubauer.peter Skype peter.neubauer Phone +46 704 106975 LinkedIn http://www.linkedin.com/in/neubauer Twitter http://twitter.com/peterneubauer http://www.neo4j.org - Your high performance graph database. http://startupbootcamp.org/ - Öresund - Innovation happens HERE. http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party. On Sat, Jun 11, 2011 at 10:21 PM, Nicolas Jouanin <nicolas.joua...@gmail.com> wrote: > Hi Peter, > > I've tried to run your test case on my forked version. > First of all, I got a Framework exception when running the test case out of > the box : > [Framework Event Dispatcher] DEBUG > wrap_mvn_org.apache.lucene_lucene-core_3.1.0 - BundleEvent STARTED > [Framework Event Dispatcher] DEBUG org.neo4j.lucene-index - FrameworkEvent > ERROR > org.osgi.framework.BundleException: The bundle > "org.neo4j.lucene-index_1.4.0.SNAPSHOT [9]" could not be resolved. Reason: > Missing Constraint: Import-Package: org.apache.lucene.analysis; > version="3.0.0" > > This shows the lucene-index bundle has a unresolved imported package. That > strange because lucene-core is deployed wrapped into a bundle just before. > There may be a problem with the wrapping process... So, i changed the test > case to use org.apache.servicemix.bundles.lucene:3.0.3_1, which is a bundled > version of lucene 3.0.3 that i've been using during my forking tests. Using > this bundle version and my forked bundles, I get the execution trace shown > below. The test case still fails, but somewhere else. Let me explain: > To manage services loaded using JDK service feature from other bundles, my > forked version automatically registers declared JDK services as OSGi > services. This is done is the OSGiExtensionLoader.registerBundleServices > method > (https://github.com/njouanin/community/blob/master/kernel/src/main/java/org/neo4j/kernel/impl/osgi/OSGiExtensionLoader.java). > So, using my forked version, the LuceneIndexProvider is being exposed as OSGi > service, so it is visible to OSGi loader and > org.neo4j.kernel.IndexManagerImpl.getIndexProvider shouldn't throw > IllegalArgumentException anymore. > BUT, as shown below, i know have a exception during datasource > initialisation. The LuceneDataSource class is not visible to the kernel > bundle, where service registration occurs. So I see two possible solution for > this : > - change lucene-index bundle to export-package org.neo4j.index.impl.lucene > (bad solution) > - add a bundle activator in lucene-index bundle to register > LuceneIndexProvider service on bundle startup, but I don't know its > dependencies. > > Let me know if my analysis is not clear for you ... > PS : changes made to the test case have been comited to > git://github.com/njouanin/neo4j-osgi-examples.git > > > [Framework Event Dispatcher] DEBUG org.ops4j.pax.logging.pax-logging-service > - BundleEvent STARTED > activating null null > [Framework Event Dispatcher] DEBUG com.springsource.javax.transaction - > BundleEvent STARTED > [Framework Event Dispatcher] DEBUG org.neo4j.kernel - BundleEvent STARTED > [Framework Event Dispatcher] DEBUG org.neo4j.kernel - ServiceEvent REGISTERED > [Framework Event Dispatcher] INFO > org.neo4j.kernel.impl.osgi.OSGiExtensionLoader - Bundle org.neo4j.kernel: > Service org.neo4j.kernel.impl.transaction.TransactionManagerProvider > registered with implementation > org.neo4j.kernel.impl.transaction.TransactionManagerProvider[native] > [Framework Event Dispatcher] WARN > org.neo4j.kernel.impl.osgi.OSGiExtensionLoader - Implementation class > org.neo4j.kernel.impl.management.JmxExtension not found by classloader > Kernel: attempting to load extensions of type org.neo4j.kernel.Version > [Framework Event Dispatcher] DEBUG org.neo4j.kernel - ServiceEvent REGISTERED > [Framework Event Dispatcher] INFO > org.neo4j.kernel.impl.osgi.OSGiExtensionLoader - Bundle org.neo4j.kernel: > Service org.neo4j.kernel.Version registered with implementation Neo4j - Graph > Database Kernel 1.4-SNAPSHOT (revision: 1.4.M01-32-g51e2494-dirty) > [Framework Event Dispatcher] DEBUG org.apache.servicemix.bundles.lucene - > BundleEvent STARTED > [Framework Event Dispatcher] DEBUG org.neo4j.lucene-index - BundleEvent > STARTED > [Framework Event Dispatcher] DEBUG org.neo4j.lucene-index - ServiceEvent > REGISTERED > [Framework Event Dispatcher] INFO > org.neo4j.kernel.impl.osgi.OSGiExtensionLoader - Bundle > org.neo4j.lucene-index: Service org.neo4j.graphdb.index.IndexProvider > registered with implementation org.neo4j.graphdb.index.IndexProvider[lucene] > Kernel: attempting to load extensions of type org.neo4j.kernel.KernelExtension > Kernel: attempting to load extensions of type > org.neo4j.graphdb.index.IndexProvider > org.neo4j.graphdb.TransactionFailureException: Could not create data source > lucene-index[lucene-index] > at > org.neo4j.kernel.impl.transaction.TxModule.registerDataSource(TxModule.java:181) > at > org.neo4j.index.impl.lucene.LuceneIndexImplementation.<init>(LuceneIndexImplementation.java:72) > at > org.neo4j.index.impl.lucene.LuceneIndexProvider.load(LuceneIndexProvider.java:38) > at > org.neo4j.kernel.KernelData.loadIndexImplementations(KernelData.java:146) > at > org.neo4j.kernel.EmbeddedGraphDbImpl$2.initializeIndexProviders(EmbeddedGraphDbImpl.java:179) > at org.neo4j.kernel.GraphDbInstance.start(GraphDbInstance.java:159) > at > org.neo4j.kernel.EmbeddedGraphDbImpl.<init>(EmbeddedGraphDbImpl.java:189) > at > org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:79) > at > org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:63) > at org.neo4j.examples.osgi.Neo4jActivator.start(Neo4jActivator.java:41) > at > org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783) > at java.security.AccessController.doPrivileged(Native Method) > at > org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774) > at > org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755) > at > org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370) > at > org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:374) > at > org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1067) > at > org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:561) > at > org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:546) > at > org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:459) > at > org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243) > at > org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:440) > at > org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227) > at > org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:337) > Caused by: java.lang.ClassNotFoundException: > org.neo4j.index.impl.lucene.LuceneDataSource > at > org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506) > at > org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422) > at > org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410) > at > org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107) > at java.lang.ClassLoader.loadClass(ClassLoader.java:248) > at java.lang.Class.forName0(Native Method) > at java.lang.Class.forName(Class.java:169) > at > org.neo4j.kernel.impl.transaction.XaDataSourceManager.create(XaDataSourceManager.java:67) > at > org.neo4j.kernel.impl.transaction.TxModule.registerDataSource(TxModule.java:175) > ... 23 more > Kernel: attempting to load extensions of type org.neo4j.kernel.Version > [Start Level Event Dispatcher] DEBUG > BuildByTinyBundlestinybundles3494323386071429083UID - ServiceEvent REGISTERED > [Start Level Event Dispatcher] DEBUG > BuildByTinyBundlestinybundles3494323386071429083UID - ServiceEvent > UNREGISTERING > [Framework Event Dispatcher] DEBUG > BuildByTinyBundlestinybundles3494323386071429083UID - BundleEvent STOPPED > [Framework Event Dispatcher] DEBUG > BuildByTinyBundlestinybundles3494323386071429083UID - FrameworkEvent ERROR > org.osgi.framework.BundleException: Exception in > org.neo4j.examples.osgi.Neo4jActivator.start() of bundle > BuildByTinyBundlestinybundles3494323386071429083UID. > at > org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:806) > at > org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755) > at > org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370) > at > org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:374) > at > org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1067) > at > org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:561) > at > org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:546) > at > org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:459) > at > org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243) > at > org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:440) > at > org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227) > at > org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:337) > Caused by: java.lang.IllegalArgumentException: No index provider 'lucene' > found > at > org.neo4j.kernel.IndexManagerImpl.getIndexProvider(IndexManagerImpl.java:71) > at > org.neo4j.kernel.IndexManagerImpl.findIndexConfig(IndexManagerImpl.java:104) > at > org.neo4j.kernel.IndexManagerImpl.getOrCreateIndexConfig(IndexManagerImpl.java:173) > at > org.neo4j.kernel.IndexManagerImpl.forNodes(IndexManagerImpl.java:244) > at org.neo4j.examples.osgi.Neo4jActivator.start(Neo4jActivator.java:43) > at > org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783) > at java.security.AccessController.doPrivileged(Native Method) > at > org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774) > ... 11 more > [Framework Event Dispatcher] DEBUG org.eclipse.osgi - FrameworkEvent > STARTLEVEL CHANGED > [Framework Event Dispatcher] DEBUG > org.ops4j.pax.exam.spi.probesupport.intern.DefaultResourceWriter_4102799c - > BundleEvent INSTALLED > [Framework Event Dispatcher] DEBUG > org.ops4j.pax.exam.spi.probesupport.intern.DefaultResourceWriter_4102799c - > BundleEvent RESOLVED > [main] DEBUG org.ops4j.pax.exam.raw.extender.intern.Probe - Test > PaxExam-ba231db7-7981-48bb-9b52-94ec505fc5e6 to be in > PaxExam-ba231db7-7981-48bb-9b52-94ec505fc5e6,PaxExam-e4039d86-ad59-4cc1-a568-f54ab0b5867f,PaxExam-02ae9fca-aaa3-4028-9297-568a1a4b8dfd,PaxExam-5b5978e7-93ad-4676-aa3b-6565370ad4d6, > [main] DEBUG org.ops4j.pax.exam.raw.extender.intern.Probe - Registering > Service: org.ops4j.pax.exam.ProbeInvoker with > Probe-Signature="PaxExam-ba231db7-7981-48bb-9b52-94ec505fc5e6" and > expression="org.ops4j.pax.exam.testforge.BundlesInState;probe" > [main] DEBUG org.ops4j.pax.exam.raw.extender.intern.Probe - Test > PaxExam-Executable to be in > PaxExam-ba231db7-7981-48bb-9b52-94ec505fc5e6,PaxExam-e4039d86-ad59-4cc1-a568-f54ab0b5867f,PaxExam-02ae9fca-aaa3-4028-9297-568a1a4b8dfd,PaxExam-5b5978e7-93ad-4676-aa3b-6565370ad4d6, > [main] DEBUG org.ops4j.pax.exam.raw.extender.intern.Probe - Test > PaxExam-e4039d86-ad59-4cc1-a568-f54ab0b5867f to be in > PaxExam-ba231db7-7981-48bb-9b52-94ec505fc5e6,PaxExam-e4039d86-ad59-4cc1-a568-f54ab0b5867f,PaxExam-02ae9fca-aaa3-4028-9297-568a1a4b8dfd,PaxExam-5b5978e7-93ad-4676-aa3b-6565370ad4d6, > [main] DEBUG org.ops4j.pax.exam.raw.extender.intern.Probe - Registering > Service: org.ops4j.pax.exam.ProbeInvoker with > Probe-Signature="PaxExam-e4039d86-ad59-4cc1-a568-f54ab0b5867f" and > expression="org.ops4j.pax.exam.testforge.CountBundles;probe" > [main] DEBUG org.ops4j.pax.exam.raw.extender.intern.Probe - Test > PaxExam-02ae9fca-aaa3-4028-9297-568a1a4b8dfd to be in > PaxExam-ba231db7-7981-48bb-9b52-94ec505fc5e6,PaxExam-e4039d86-ad59-4cc1-a568-f54ab0b5867f,PaxExam-02ae9fca-aaa3-4028-9297-568a1a4b8dfd,PaxExam-5b5978e7-93ad-4676-aa3b-6565370ad4d6, > [main] DEBUG org.ops4j.pax.exam.raw.extender.intern.Probe - Registering > Service: org.ops4j.pax.exam.ProbeInvoker with > Probe-Signature="PaxExam-02ae9fca-aaa3-4028-9297-568a1a4b8dfd" and > expression="org.ops4j.pax.exam.testforge.WaitForService;probe" > [main] DEBUG org.ops4j.pax.exam.raw.extender.intern.Probe - Test > PaxExam-5b5978e7-93ad-4676-aa3b-6565370ad4d6 to be in > PaxExam-ba231db7-7981-48bb-9b52-94ec505fc5e6,PaxExam-e4039d86-ad59-4cc1-a568-f54ab0b5867f,PaxExam-02ae9fca-aaa3-4028-9297-568a1a4b8dfd,PaxExam-5b5978e7-93ad-4676-aa3b-6565370ad4d6, > [main] DEBUG org.ops4j.pax.exam.raw.extender.intern.Probe - Registering > Service: org.ops4j.pax.exam.ProbeInvoker with > Probe-Signature="PaxExam-5b5978e7-93ad-4676-aa3b-6565370ad4d6" and > expression="org.ops4j.pax.exam.testforge.WaitForService;probe" > [main] DEBUG > org.ops4j.pax.exam.spi.probesupport.intern.DefaultResourceWriter_4102799c - > ServiceEvent REGISTERED > [main] DEBUG > org.ops4j.pax.exam.spi.probesupport.intern.DefaultResourceWriter_4102799c - > ServiceEvent REGISTERED > [main] DEBUG > org.ops4j.pax.exam.spi.probesupport.intern.DefaultResourceWriter_4102799c - > ServiceEvent REGISTERED > [main] DEBUG > org.ops4j.pax.exam.spi.probesupport.intern.DefaultResourceWriter_4102799c - > ServiceEvent REGISTERED > [Framework Event Dispatcher] DEBUG > org.ops4j.pax.exam.spi.probesupport.intern.DefaultResourceWriter_4102799c - > BundleEvent STARTED > Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 6.141 sec <<< > FAILURE! > > Results : > > Failed tests: > neo4jStartupTest(org.neo4j.examples.osgi.OSGiTest) > > Tests run: 1, Failures: 1, Errors: 0, Skipped: 0 > > > > Le 10 juin 2011 à 10:00, Peter Neubauer a écrit : > >> Yeah, >> that would be great Nicolas! The only thing is that you will need to >> build Pax Tinybundles, >> >> g...@github.com:ops4j/org.ops4j.pax.tinybundles.git since I am using >> SNAPSHOT dep there. >> >> Lemme know if you need help! >> >> Cheers, >> >> /peter neubauer >> >> GTalk: neubauer.peter >> Skype peter.neubauer >> Phone +46 704 106975 >> LinkedIn http://www.linkedin.com/in/neubauer >> Twitter http://twitter.com/peterneubauer >> >> http://www.neo4j.org - Your high performance graph database. >> http://startupbootcamp.org/ - Öresund - Innovation happens HERE. >> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party. >> >> >> >> On Fri, Jun 10, 2011 at 9:43 AM, Nicolas Jouanin >> <nicolas.joua...@gmail.com> wrote: >>> Hi, >>> I'll try this during the weekend if you agree and I'll let you know. >>> >>> >>> 2011/6/9 Peter Neubauer <peter.neuba...@neotechnology.com> >>> >>>> Nicolas, >>>> I have now a failing testcase (albeit using snapshot versions of PAX >>>> stuff, trying to relax that ASAP) at >>>> https://github.com/neo4j/neo4j-osgi-examples that exposes the >>>> IndexProvider not being found in OSGi environments. >>>> >>>> Is your fork of Neo4j Community fixing this issue? In that case, it >>>> would be great to verify it against the testcase and merge it in! >>>> >>>> Cheers, >>>> >>>> /peter neubauer >>>> >>>> GTalk: neubauer.peter >>>> Skype peter.neubauer >>>> Phone +46 704 106975 >>>> LinkedIn http://www.linkedin.com/in/neubauer >>>> Twitter http://twitter.com/peterneubauer >>>> >>>> http://www.neo4j.org - Your high performance graph database. >>>> http://startupbootcamp.org/ - Öresund - Innovation happens HERE. >>>> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party. >>>> >>>> >>>> >>>> On Thu, Jun 2, 2011 at 10:33 AM, Nicolas Jouanin >>>> <nicolas.joua...@gmail.com> wrote: >>>>> Hi, >>>>> >>>>> This page may help you : >>>> http://wiki.escapek.org/display/DEV/Neo4j+community+edition+installation >>>>> >>>>> >>>>> Le 2 juin 2011 à 09:30, Super Wang a écrit : >>>>> >>>>>> I've tried to expose org.neo4j.graphdb.GraphDatabaseService as a service >>>>>> component directly and use a delegate class as implementation, but >>>> failed... >>>>>> >>>>>> >>>>>> On Thu, Jun 2, 2011 at 12:34, Andreas Kollegger < >>>>>> andreas.kolleg...@neotechnology.com> wrote: >>>>>> >>>>>>> Hey, >>>>>>> >>>>>>> The Neo4j libraries should be usable within OSGi, though we're a bit >>>> lax in >>>>>>> keeping on top of that. The best approach would be to use one bundle to >>>>>>> instantiate the database and advertise the reference as a service for >>>> use by >>>>>>> other bundles. >>>>>>> >>>>>>> Cheers, >>>>>>> Andreas >>>>>>> >>>>>>> On Jun 1, 2011, at 8:25 PM, Super Wang wrote: >>>>>>> >>>>>>>> Hi folks, >>>>>>>> >>>>>>>> I'm new to neo4j and I'm going to embed neo4j to my OSGI >>>>>>> environment(without >>>>>>>> Spring) as a component, so I can keep a single instance of graph >>>> database >>>>>>>> and can make it available for all other bundles. >>>>>>>> >>>>>>>> Any ideas about how to implement this? >>>>>>>> >>>>>>>> Thank you very much. >>>>>>>> _______________________________________________ >>>>>>>> Neo4j mailing list >>>>>>>> User@lists.neo4j.org >>>>>>>> https://lists.neo4j.org/mailman/listinfo/user >>>>>>> >>>>>>> _______________________________________________ >>>>>>> Neo4j mailing list >>>>>>> User@lists.neo4j.org >>>>>>> https://lists.neo4j.org/mailman/listinfo/user >>>>>>> >>>>>> _______________________________________________ >>>>>> Neo4j mailing list >>>>>> User@lists.neo4j.org >>>>>> https://lists.neo4j.org/mailman/listinfo/user >>>>> >>>>> _______________________________________________ >>>>> Neo4j mailing list >>>>> User@lists.neo4j.org >>>>> https://lists.neo4j.org/mailman/listinfo/user >>>>> >>>> _______________________________________________ >>>> Neo4j mailing list >>>> User@lists.neo4j.org >>>> https://lists.neo4j.org/mailman/listinfo/user >>>> >>> _______________________________________________ >>> Neo4j mailing list >>> User@lists.neo4j.org >>> https://lists.neo4j.org/mailman/listinfo/user >>> >> _______________________________________________ >> Neo4j mailing list >> User@lists.neo4j.org >> https://lists.neo4j.org/mailman/listinfo/user > > _______________________________________________ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > _______________________________________________ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user