jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ki...@apache.org
Subject svn commit: r1721852 - /jena/site/trunk/content/documentation/notes/system-initialization.mdtext
Date Sun, 27 Dec 2015 22:03:21 GMT
Author: kinow
Date: Sun Dec 27 22:03:21 2015
New Revision: 1721852

URL: http://svn.apache.org/viewvc?rev=1721852&view=rev
Log:
Add note about systems with many classloaders

Modified:
    jena/site/trunk/content/documentation/notes/system-initialization.mdtext

Modified: jena/site/trunk/content/documentation/notes/system-initialization.mdtext
URL: http://svn.apache.org/viewvc/jena/site/trunk/content/documentation/notes/system-initialization.mdtext?rev=1721852&r1=1721851&r2=1721852&view=diff
==============================================================================
--- jena/site/trunk/content/documentation/notes/system-initialization.mdtext (original)
+++ jena/site/trunk/content/documentation/notes/system-initialization.mdtext Sun Dec 27 22:03:21
2015
@@ -100,3 +100,20 @@ in the current JVM.
 
     // Initialize Jena
     JenaSystem.init() ;
+
+## Jena initialization in multi-classloader environments
+
+In some applications with multiple classloaders, or different classloader strategies, Jena
initialization may
+not work as expected. If the Jena initialization debug information shows that components
were not loaded correctly,
+trying to switch the context class loader may fix the initialization process.
+
+    ClassLoader contextClassLoader = null;
+    try {
+        contextClassLoader = Thread.currentThread().getContextClassLoader();
+        Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+        JenaSystem.DEBUG_INIT = true;
+        // ...
+    } finally {
+        Thread.currentThread().setContextClassLoader(contextClassLoader);
+    }
+



Mime
View raw message