classforName() in org.jboss.weld.environment.servlet.util.Reflections.java can fail unnecessarily in an OSGi environment. Sometimes the thread context classloader is set, but the class to be loaded is on the bundle classloader, and not the thread context classloader. This code in classforName() below line 47
if (tccl != null) { return (Class<T>) tccl.loadClass(name); } else { return (Class<T>) Class.forName(name); }
should be replaced with,
if (tccl != null) { try { return (Class<T>) tccl.loadClass(name); } catch (ClassNotFoundException e) { // could add debug trace here } catch (LinkageError e) { // debug trace here also } } return (Class<T>) Class.forName(name);
|