You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by ki...@apache.org on 2015/12/27 23:03:21 UTC
svn commit: r1721852 -
/jena/site/trunk/content/documentation/notes/system-initialization.mdtext
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);
+ }
+