You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2016/04/11 15:38:30 UTC

jena git commit: Fixes for jena-osgi for new initialization

Repository: jena
Updated Branches:
  refs/heads/osgi-fix-init [created] fd60b0dda


Fixes for jena-osgi for new initialization


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/fd60b0dd
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/fd60b0dd
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/fd60b0dd

Branch: refs/heads/osgi-fix-init
Commit: fd60b0ddaa0c141c50c762d9aea93f9de754d6bf
Parents: 7b5b48a
Author: Andy Seaborne <an...@apache.org>
Authored: Mon Apr 11 14:32:10 2016 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Mon Apr 11 14:32:10 2016 +0100

----------------------------------------------------------------------
 apache-jena-osgi/jena-osgi-test/pom.xml         | 161 ++++---------------
 .../org/apache/jena/osgi/test/JenaOSGITest.java | 111 +++++--------
 apache-jena-osgi/jena-osgi/pom.xml              |  28 +++-
 .../java/org/apache/jena/osgi/Activator.java    |  65 ++++++++
 .../jena/system/JenaSubsystemRegistryBasic.java |   2 +-
 5 files changed, 165 insertions(+), 202 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/fd60b0dd/apache-jena-osgi/jena-osgi-test/pom.xml
----------------------------------------------------------------------
diff --git a/apache-jena-osgi/jena-osgi-test/pom.xml b/apache-jena-osgi/jena-osgi-test/pom.xml
index 2e63b54..2bd9f53 100644
--- a/apache-jena-osgi/jena-osgi-test/pom.xml
+++ b/apache-jena-osgi/jena-osgi-test/pom.xml
@@ -1,41 +1,40 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements.  See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
 -->
 
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" 
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.apache.jena</groupId>
     <artifactId>jena-parent</artifactId>
-    <version>15-SNAPSHOT</version>
-    <relativePath>../../jena-parent</relativePath>
-  </parent> 
+    <version>16-SNAPSHOT</version>
+  </parent>
 
   <artifactId>jena-osgi-test</artifactId>
-  <version>3.0.1-SNAPSHOT</version>
+  <!-- Same as jena-osgi -->
+  <version>3.1.0-SNAPSHOT</version>
   <name>Apache Jena - OSGi integration tests</name>
   <description>Tests for jena-osgi as a bundle</description>
   <packaging>bundle</packaging>
 
   <properties>
-    <felix.version>4.6.0</felix.version>
     <pax.exam.version>4.4.0</pax.exam.version>
-    <pax.url.version>1.6.0</pax.url.version>
-    <pax.logging.version>1.8.1</pax.logging.version>
   </properties>
 
   <repositories>
@@ -46,50 +45,21 @@ limitations under the License.
       <releases>
         <enabled>false</enabled>
       </releases>
-    </repository>
+    </repository>       
   </repositories>
 
   <dependencies>
     <dependency>
       <groupId>org.apache.jena</groupId>
       <artifactId>jena-osgi</artifactId>
-      <version>${project.version}</version>
+      <version>3.1.0-SNAPSHOT</version>
       <type>bundle</type>
       <scope>test</scope>
     </dependency>
 
     <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>org.osgi.core</artifactId>
-      <version>5.0.0</version>
-      <scope>provided</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <!-- needed to get a org.slf4j bundle for PAX 
-         as we exclude slf4j-log4j due to 
-         "Fragment bundle" warning -->
-    <dependency>
-      <groupId>org.ops4j.pax.logging</groupId>
-      <artifactId>pax-logging-log4j2</artifactId>
-      <version>${pax.logging.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.ops4j.pax.logging</groupId>
-      <artifactId>pax-logging-api</artifactId>
-      <version>${pax.logging.version}</version>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
       <groupId>org.ops4j.pax.exam</groupId>
-      <artifactId>pax-exam-container-native</artifactId>
+      <artifactId>pax-exam-container-karaf</artifactId>
       <version>${pax.exam.version}</version>
       <scope>test</scope>
     </dependency>
@@ -107,95 +77,20 @@ limitations under the License.
       <version>${pax.exam.version}</version>
       <scope>test</scope>
     </dependency>
-
-    <dependency>
-      <groupId>org.ops4j.pax.url</groupId>
-      <artifactId>pax-url-aether</artifactId>
-      <version>${pax.url.version}</version>
-      <scope>test</scope>
-    </dependency>
-
-    <!-- OSGi Frameworks -->
-    <dependency>
-      <groupId>org.eclipse</groupId>
-      <artifactId>osgi</artifactId>
-      <version>3.9.1-v20140110-1610</version>
-      <scope>test</scope>
-    </dependency>
-    <!-- NOTE: Make sure eclipse-osgi (equinox) is first -->
-    <dependency>
-      <groupId>org.apache.felix</groupId>
-      <artifactId>org.apache.felix.framework</artifactId>
-      <version>${felix.version}</version>
-      <scope>test</scope>
-    </dependency>
-    
   </dependencies>
 
   <build>
     <plugins>
       <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <!-- re-enable extensions here for older Mavens -->
-        <extensions>true</extensions>
-      </plugin>
-      <plugin>
-        <!-- generate target/pax-exam-links -->
-        <groupId>org.ops4j.pax.exam</groupId>
-        <artifactId>exam-maven-plugin</artifactId>
-        <version>${pax.exam.version}</version>
-        <executions>
-          <execution>
-            <id>generate-link-files</id>
-            <goals>
-              <goal>generate-link-files</goal>
-            </goals>
-            <phase>generate-test-resources</phase>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <executions>
-          <execution>
-            <!-- delay test compilation until pre-integration-test phase -->
-            <id>default-testCompile</id>
-            <goals>
-              <goal>testCompile</goal>
-            </goals>
-            <phase>pre-integration-test</phase>
-          </execution>
-        </executions>
-        <configuration>
-        </configuration>
-
-      </plugin>
-      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <classpathDependencyExcludes>
-            <classpathDependencyExclude>org.slf4j:slf4j-log4j12</classpathDependencyExclude>
-          </classpathDependencyExcludes>
-          <systemPropertyVariables>
-            <!-- So the test can find the current version of jena-osgi -->
-            <jena-osgi.version>${project.version}</jena-osgi.version>
-            <!-- not so noisy OSGi logging -->
-            <org.ops4j.pax.logging.DefaultServiceLog.level>WARN</org.ops4j.pax.logging.DefaultServiceLog.level>
-          </systemPropertyVariables>
-        </configuration>
-        <!-- Explicit execution to run in a phase after the OSGi bundle
-             has been created -->
+        <artifactId>maven-failsafe-plugin</artifactId>
         <executions>
           <execution>
-            <id>default-test</id>
+            <id>verify</id>
             <goals>
-              <goal>test</goal>
+              <goal>integration-test</goal>
+              <goal>verify</goal>
             </goals>
-            <!-- delay until integration-test phase -->
-            <phase>integration-test</phase>
           </execution>
         </executions>
       </plugin>

http://git-wip-us.apache.org/repos/asf/jena/blob/fd60b0dd/apache-jena-osgi/jena-osgi-test/src/test/java/org/apache/jena/osgi/test/JenaOSGITest.java
----------------------------------------------------------------------
diff --git a/apache-jena-osgi/jena-osgi-test/src/test/java/org/apache/jena/osgi/test/JenaOSGITest.java b/apache-jena-osgi/jena-osgi-test/src/test/java/org/apache/jena/osgi/test/JenaOSGITest.java
index ef0d85e..1d468f1 100644
--- a/apache-jena-osgi/jena-osgi-test/src/test/java/org/apache/jena/osgi/test/JenaOSGITest.java
+++ b/apache-jena-osgi/jena-osgi-test/src/test/java/org/apache/jena/osgi/test/JenaOSGITest.java
@@ -20,10 +20,10 @@ package org.apache.jena.osgi.test;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
-import static org.ops4j.pax.exam.CoreOptions.junitBundles;
-import static org.ops4j.pax.exam.CoreOptions.linkBundle;
+import static org.ops4j.pax.exam.CoreOptions.maven;
 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
 import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
 
 import java.io.OutputStream;
 import java.io.StringWriter;
@@ -31,22 +31,8 @@ import java.io.Writer;
 import java.nio.file.Files;
 import java.nio.file.Path;
 
-import javax.inject.Inject;
-
 import org.apache.jena.iri.IRI;
 import org.apache.jena.iri.IRIFactory;
-import org.apache.jena.riot.Lang;
-import org.apache.jena.riot.RDFDataMgr;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.CoreOptions;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerClass;
-import org.osgi.framework.BundleContext;
-
 import org.apache.jena.ontology.Individual;
 import org.apache.jena.ontology.ObjectProperty;
 import org.apache.jena.ontology.OntModel;
@@ -61,12 +47,19 @@ import org.apache.jena.query.QuerySolution;
 import org.apache.jena.query.ReadWrite;
 import org.apache.jena.query.ResultSet;
 import org.apache.jena.rdf.model.Model;
-import org.apache.jena.ontology.OntModel ;
-import org.apache.jena.ontology.OntModelSpec ;
 import org.apache.jena.rdf.model.ModelFactory;
 import org.apache.jena.rdf.model.Property;
 import org.apache.jena.rdf.model.Resource;
+import org.apache.jena.riot.Lang;
+import org.apache.jena.riot.RDFDataMgr;
 import org.apache.jena.tdb.TDBFactory;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
 
 /**
  * Brief tests of the Jena modules covered by jena-osgi
@@ -76,35 +69,33 @@ import org.apache.jena.tdb.TDBFactory;
 @ExamReactorStrategy(PerClass.class)
 public class JenaOSGITest {
 
-	@Inject
-	private BundleContext bc;
-
 	@Configuration
 	public Option[] config() {
+
 		return options(
-        // bundle with org.slf4j implementation
-				linkBundle("org.ops4j.pax.logging.pax-logging-log4j2"),
-				linkBundle("org.ops4j.pax.logging.pax-logging-api"),
-
-        // jena-osgi
-				mavenBundle("org.apache.jena", "jena-osgi", 
-          System.getProperty("jena-osgi.version", "LATEST")),
-
-        // dependencies of jena-osgi
-				linkBundle("org.apache.httpcomponents.httpclient"),
-				linkBundle("org.apache.httpcomponents.httpcore"),
-				linkBundle("com.github.jsonld-java"),
-				linkBundle("org.apache.commons.csv"),
-				linkBundle("org.apache.thrift"),
-				linkBundle("jcl.over.slf4j"),
+				// OSGi container configuration
+				karafDistributionConfiguration().frameworkUrl(
+						maven().groupId("org.apache.karaf")
+								.artifactId("apache-karaf").type("zip")
+								.version("3.0.6")).useDeployFolder(false),
 				
-				linkBundle("com.fasterxml.jackson.core.jackson-core"),
-				linkBundle("com.fasterxml.jackson.core.jackson-databind"),
-				linkBundle("com.fasterxml.jackson.core.jackson-annotations"),
-				linkBundle("org.apache.commons.lang3"),
-				
-				junitBundles()
-				);
+				//mavenBundle("org.apache.aries.spifly","org.apache.aries.spifly.dynamic.bundle", "1.0.8"),
+
+				mavenBundle("org.apache.jena", "jena-osgi", "3.1.0-SNAPSHOT"),
+				mavenBundle("com.github.andrewoma.dexx", "collection", "0.6.0-SNAPSHOT"),
+				mavenBundle("com.github.jsonld-java", "jsonld-java", "0.8.0"),
+				mavenBundle("org.apache.httpcomponents", "httpcore-osgi","4.4.4"),
+				mavenBundle("org.apache.httpcomponents", "httpclient-osgi","4.5.1"),
+				mavenBundle("commons-cli", "commons-cli", "1.3.1"),
+				mavenBundle("org.apache.commons", "commons-csv", "1.2"),
+				mavenBundle("org.apache.commons", "commons-lang3", "3.4"),
+				mavenBundle("org.apache.thrift", "libthrift", "0.9.3"),
+				mavenBundle("com.fasterxml.jackson.core", "jackson-core","2.6.3"),
+				mavenBundle("com.fasterxml.jackson.core", "jackson-databind","2.6.3"),
+				mavenBundle("com.fasterxml.jackson.core","jackson-annotations", "2.6.3")
+
+		);
+
 	}
 
 	private static final String EXAMPLE_COM_GRAPH = "http://example.com/graph";
@@ -115,19 +106,13 @@ public class JenaOSGITest {
 	@Test
 	public void testJenaCore() throws Exception {
 		Model model = makeModel();
-
-		// Does Model's Class.forName() still work?
-		model.setWriterClassName("someWriter",
-				"com.hp.hpl.jena.rdf.model.impl.NTripleWriter");
 		Writer writer = new StringWriter();
-		model.write(writer, "someWriter");
-		// yes, but only as long as that classname is accessible within
-		// jena-osgi bundle
+		model.write(writer, "N-Triples");		
+
 		assertEquals(
 				"<http://example.com/alice> <http://xmlns.com/foaf/0.1/knows> <http://example.com/bob> .",
 				writer.toString().trim());
-
-		// Let's also test com.hp.hpl.jena.ontology
+		
 		OntModel ontModel = ModelFactory
 				.createOntologyModel(OntModelSpec.OWL_DL_MEM_RULE_INF);
 		ObjectProperty knowsObjProp = ontModel.createObjectProperty(knows
@@ -142,15 +127,6 @@ public class JenaOSGITest {
 		assertTrue(aliceIndividual.hasProperty(knowsObjProp, bobIndividiual));
 	}
 
-	private Model makeModel() {
-		Model model = ModelFactory.createDefaultModel();
-		alice = model.createResource("http://example.com/alice");
-		knows = model.createProperty("http://xmlns.com/foaf/0.1/knows");
-		bob = model.createResource("http://example.com/bob");
-		model.add(model.createStatement(alice, knows, bob));
-		return model;
-	}
-
 	@Test
 	public void testJenaArq() throws Exception {
 		Dataset dataset = DatasetFactory.createMem();
@@ -209,11 +185,12 @@ public class JenaOSGITest {
 		dataset.end();
 	}
 
-	/*
-	@Test
-	public void createOntModel()
-	{ 
-	    final OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
+	private Model makeModel() {
+		Model model = ModelFactory.createDefaultModel();
+		alice = model.createResource("http://example.com/alice");
+		knows = model.createProperty("http://xmlns.com/foaf/0.1/knows");
+		bob = model.createResource("http://example.com/bob");
+		model.add(model.createStatement(alice, knows, bob));
+		return model;
 	}
-    */
 }

http://git-wip-us.apache.org/repos/asf/jena/blob/fd60b0dd/apache-jena-osgi/jena-osgi/pom.xml
----------------------------------------------------------------------
diff --git a/apache-jena-osgi/jena-osgi/pom.xml b/apache-jena-osgi/jena-osgi/pom.xml
index f42c09e..5f25533 100644
--- a/apache-jena-osgi/jena-osgi/pom.xml
+++ b/apache-jena-osgi/jena-osgi/pom.xml
@@ -219,6 +219,11 @@
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-lang3</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <version>5.0.0</version>
+    </dependency>
   </dependencies>
 
   <build>
@@ -231,10 +236,31 @@
         <configuration>
           <instructions>
             <Export-Package>org.apache.jena.*,!org.apache.jena.ext.*</Export-Package>
+            <Embed-Dependency>artifactId=jena*;inline=true</Embed-Dependency>
+            <!--
             <Embed-Dependency>artifactId=jena*;inline=true,artifactId=xercesImpl;inline=true,artifactId=xml-apis;inline=true</Embed-Dependency>
+            -->
             <Embed-Transitive>true</Embed-Transitive>
-            <Import-Package>!sun.io,!org.apache.avalon.framework.logger,!com.ibm.uvm.tools,!com.sun.jdmk.comm,!org.apache.log,!org.apache.xml.*,!org.apache.xerces.*,!org.apache.jena.ext.*,sun.misc;resolution:=optional,*</Import-Package>
+            <!-- Do not embed but import Xerces classes via OSGi -->
+            <Import-Package>org.osgi.framework.*,org.apache.xml.*,org.apache.xerces.*,!sun.io,!org.apache.avalon.framework.logger,!com.ibm.uvm.tools,!com.sun.jdmk.comm,!org.apache.log,!org.apache.jena.ext.*,sun.misc;resolution:=optional,*</Import-Package>
+            <!--
+            <Import-Package>org.osgi.framework.*,!sun.io,!org.apache.avalon.framework.logger,!com.ibm.uvm.tools,!com.sun.jdmk.comm,!org.apache.log,!org.apache.xml.*,!org.apache.xerces.*,!org.apache.jena.ext.*,sun.misc;resolution:=optional,*</Import-Package>
+            -->
             <Private-Package>org.apache.jena.ext.*</Private-Package>
+            <!--<Bundle-Activator>org.apache.jena.osgi.Activator</Bundle-Activator>-->
+            <!-- Standard headers according to OSGi 133 Service Loader Mediator Specification -->
+      <!-- Not needed, if JenaSubsystemRegistryBasic (jena-core) uses an explicit classloader
+      <Require-Capability>
+        osgi.extender; filter:="(|(osgi.extender=osgi.serviceloader.registrar)(osgi.extender=osgi.serviceloader.processor))",
+        osgi.serviceloader; filter:="(osgi.serviceloader=org.apache.jena.system.JenaSubsystemLifecycle)";cardinality:=multiple            
+      </Require-Capability>
+      <Provide-Capability>osgi.serviceloader; osgi.serviceloader=org.apache.jena.system.JenaSubsystemLifecycle</Provide-Capability>           
+      -->
+      <!-- SPI-* headers work only with Apache Aries SPI Fly -->
+            <!--
+        <SPI-Consumer>*</SPI-Consumer>
+        <SPI-Provider>*</SPI-Provider>  
+      -->
           </instructions>
         </configuration>
       </plugin>

http://git-wip-us.apache.org/repos/asf/jena/blob/fd60b0dd/apache-jena-osgi/jena-osgi/src/main/java/org/apache/jena/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/apache-jena-osgi/jena-osgi/src/main/java/org/apache/jena/osgi/Activator.java b/apache-jena-osgi/jena-osgi/src/main/java/org/apache/jena/osgi/Activator.java
new file mode 100644
index 0000000..59e3263
--- /dev/null
+++ b/apache-jena-osgi/jena-osgi/src/main/java/org/apache/jena/osgi/Activator.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.osgi;
+
+import org.apache.jena.system.JenaSubsystemRegistry;
+import org.apache.jena.system.JenaSubsystemRegistryBasic;
+import org.apache.jena.system.JenaSystem;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+	
+	/* 
+	 * Based on http://svn.apache.org/repos/asf/aries/trunk/spi-fly/spi-fly-examples/spi-fly-example-provider-consumer-bundle/src/main/java/org/apache/aries/spifly/pc/bundle/Activator.java
+	 * the Activator#start() waits for bundle extension by Aries SPI Fly, configures JenaSystem logging and requests for initialization.     
+	 */
+	public void start(BundleContext context) throws Exception {
+
+		Thread t = new Thread(new Runnable() {
+			@Override
+			public void run() {
+				try {
+					Thread.sleep(500);
+				} catch (InterruptedException e) {
+				}				
+				setUpJena();
+			}
+		});
+		t.start();
+	}
+
+	private void setUpJena() {
+		JenaSubsystemRegistry r = new JenaSubsystemRegistryBasic() {
+			@Override
+			public void load() {
+				super.load();
+			}
+		};
+		JenaSystem.setSubsystemRegistry(r);
+		JenaSystem.DEBUG_INIT = true;
+		JenaSystem.init();
+		System.out.println("Jena-OSGi bundle configuration done!");
+		
+	}
+
+	public void stop(BundleContext context) throws Exception {
+
+	}
+}

http://git-wip-us.apache.org/repos/asf/jena/blob/fd60b0dd/jena-core/src/main/java/org/apache/jena/system/JenaSubsystemRegistryBasic.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/system/JenaSubsystemRegistryBasic.java b/jena-core/src/main/java/org/apache/jena/system/JenaSubsystemRegistryBasic.java
index fd50072..db37924 100644
--- a/jena-core/src/main/java/org/apache/jena/system/JenaSubsystemRegistryBasic.java
+++ b/jena-core/src/main/java/org/apache/jena/system/JenaSubsystemRegistryBasic.java
@@ -40,7 +40,7 @@ public class JenaSubsystemRegistryBasic implements JenaSubsystemRegistry {
     public void load() {
         synchronized (registryLock) {
             // Find subsystems asking for initialization. 
-            ServiceLoader<JenaSubsystemLifecycle> sl = ServiceLoader.load(JenaSubsystemLifecycle.class) ;
+            ServiceLoader<JenaSubsystemLifecycle> sl = ServiceLoader.load(JenaSubsystemLifecycle.class,this.getClass().getClassLoader()) ;
             sl.forEach(this::add) ;
         }
     }