JCL uses an isolated log4j logger, which sometimes spits out a lot of lines on the console. The default log level has now been lowered to INFO but to disable it entirely and use the parent log config, pass the following argument to JVM.
-Djcl.isolateLogging=false
Programmatically it is possible to override the spring's default classloader with JCL. Though at the moment this is not supported as part of JCL xml extension, and each bean loaded with JCL must have a jcl-ref element pointing to a jcl bean. Programmatically this is done as follows:
JarClassLoader jcl=new JarClassLoader();
jcl.add("myjar.jar"); // Add some class source
ClassPathXmlApplicationContext c=new ClassPathXmlApplicationContext("applicationContext.xml");
c.setClassLoader( jcl ); // Override the default classloader with JCL
As of JCL 2.1, JclContext can be loaded from XML files, either by using the JclContextLoaderListener or by using XmlContextLoader class. The code snippet below shows how to use the XmlContextLoader
XmlContextLoader context=new XmlContextLoader("/home/user/jcl.xml");
context.loadContext();
//Access the named jcl instance
JarClassLoader jcl=JclContext.get("jclname");