I thought the Thread.currentThread().getContextClassLoader() is to support this kind of situation ?
Cameron > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:wicket-develop- > [EMAIL PROTECTED] On Behalf Of Eelco Hillenius > Sent: Tuesday, 16 August 2005 1:20 AM > To: Wicket Develop List > Subject: [Wicket-develop] problem with loading markup for components with > other classloaders > > There is a problem with how we currently load markup. In > ClassLoaderResourceStreamLocator, which is the default thing to use in > Wicke: > > protected IResourceStream locate(final String path) > { > // Ensure classloader > if (classloader == null) > { > classloader = getClass().getClassLoader(); > } > > // Log attempt > log.debug("Attempting to locate resource '" + path + "' using > classloader " + classloader); > > // Try loading path using classloader > final URL url = classloader.getResource(path); > if (url != null) > { > return new UrlResourceStream(url); > } > return null; > } > > The problem with this is that it allways uses the classloader of > ClassLoaderResourceStreamLocator, or in other words, the classloader > that is used to load wicket.jar. This is a problem for components with > markup that are /not/ loaded that way. Martijn just found out when > running in JBoss with Oscar, but it is obviously a problem anyway. > > A fix would be to pass the component for which the markup should be > loaded and use it's classloader, like: > > protected IResourceStream locate(final Component callee, final > String path) > { > // Ensure classloader > if (classloader == null) > { > classloader = callee.getClass().getClassLoader(); > } > ... > } > > etc. That would mean passing the calling component everywhere, but I > think it is the only way to get it right. > > Your thoughts? > > Eelco > > > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & EXPO > September 19-22, 2005 * San Francisco, CA * Development Lifecycle > Practices > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf > _______________________________________________ > Wicket-develop mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/wicket-develop ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
