Hi Everyone,

This is a question for advanced developers. I notice that OFBiz uses a
custom class loader called NativeLibClassLoader which extends
URLClassLoader from the JDK

There is a comment in the class which mentions that the "class is necessary
because the bootstrap ClassLoader caches the native library path - so any
changes to the library path are ignored (changes that might have been made
by loading OFBiz components)"

I don't quite understand what is meant by that even after digging into the
related classes. It seems like the design is saying that hey, we might load
components dynamically and therefore, we will keep their effects in this
field -> "CopyOnWriteArrayList<String> libPaths"

However, as far as I understand, ofbiz does not load libraries or
components dynamically, they either load or not on start, and you cannot
call start twice as that would shoot an exception.

I guess my question is: Why does ofbiz have a custom ClassLoader? Why
bypassing the bootstrapping loader and even then, why not use one of the
standard JDK implementations in the ClassLoader hierarchy.

I really appreciate your insights on this.

Taher Alkhateeb

Reply via email to