Marshall Schor wrote: > Here's my current better(?) thought that avoids injecting and doesn't > presume the SystemClassLoader is a subclass of URLClassLoader, and > avoids permission issues that could arise in some environments when > later adding to the URL set via addURL(): > > Use the defined property > -Djava.system.class.loader=org.apache.uima.bootstrap.SystemClassLoader > > and add a class SystemClassLoader which is defined to be a subclass of > URL ClassLoader, and delegates to it. Define the constructor > SystemClassLoader(ClassLoader parent) to call its parent with the proper > list of URLs as before. > > No reflection is needed. > > Now to get this tested :-)
Testing: works on Sun Java, fails on IBM Java. This is because the IBM java doesn't load the logger-specified classes from the ClassLoader.getSystemClassLoader() object, even though the Javadocs say so. I'm going back to using "injection" approach, that at least works (has been tested) on both Javas. -Marshall > -Marshall > > Marshall Schor wrote: > >> Marshall Schor wrote: >> >> >>> Thilo Goetz wrote: >>> >>> >>> >>>> Marshall Schor wrote: >>>> [...] >>>> >>>> >>>> >>>> >>>>> Both of these approaches put uimaj-core classes at the "root" level of >>>>> the application (i.e., "System") class-loader chain. I can't think of >>>>> any cases where that would not be OK; can anyone else? >>>>> >>>>> >>>>> >>>>> >>>> I think that may not work because the UIMA >>>> framework classes need to access the annotator classes. >>>> If the core is loaded by the system classloader, it >>>> will not have access to classes loaded by the bs loader. >>>> >>>> >>>> >>>> >>> Yes, this sounds right. >>> >>> How about this "fix": put a copy of the UIMALogFormatter into the >>> bootstrap loader Jar. This class does not reference any uima classes, >>> only Java JRE classes. >>> >>> >>> >> I think this issue is general, not restricted to the Formatter class. >> The Javadocs for the LogManager say that the class objects named in the >> configuration are loaded by using the System class loader. It actually >> says the classes are "first searched on the system class path before any >> user class path." But it seems that only the application initial class >> path that is used to launch things, is searched. >> >> So maybe the only approach will be to inject all the urls into the >> system class loader, as Jerry was trying to do (Jars and directories, >> not individual classes). >> >> Any other ideas? >> >> -Marshall >> >> >>> -Marshall >>> >>> >>> >>> >>>> --Thilo >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>> >>> >>> >> >> > > >