I'm working on integrating Wicket into OSGi container. Classloader schema in the container is more complex than the one used by j2se app servers, so simple Class.forName does not always work. For example, Class.forName in LazyInitProxyFactory will use org.apache.catalina.loader.WebappClassLoader if you deploy the app on Tomcat. This is OK for j2se app environment, but in the container I'm working with this classloader cannot see application-specific classes.
Basically, Class.forName works in Tomcat because Wicket libraries and application-specific Wicket reside in the same classloader (WebappClassLoader instance for that application). Now, suppose you want to separate the two, i.e. make your application running on top of wicket libraries, much the same as any j2se app running on top of j2se container. Without using context classloaders, wicket won't be able to see any of the application-specific classes. Btw, quote from the article: It is possible that the context loader is a better choice for framework components, and the current loader is better for business logic. Also read "Why do thread context classloaders exist in the first place?" section from the article. Alexei. --- Eelco Hillenius <[EMAIL PROTECTED]> wrote: > So, why do you think using the context classloader > is a good idea? > There are some pretty dangerous issues with it, and > our current way of > depending on the current class loader seems more > robust. For instance, > read: > http://www.javaworld.com/javaworld/javaqa/2003-06/01-qa-0606-load.html > > Do you have specific problems that makes you submit > this request? > > Eelco > > > On 3/29/06, Alexei Sokolov <[EMAIL PROTECTED]> > wrote: > > One more thing... > > > > In wicket-spring integration package, the > following > > line: > > > > clazz = Class.forName(type); > > > > should be replaced with > > > > clazz = Class.forName(type, true, > > Thread.currentThread().getContextClassLoader()); > > > > If RFE stands for Request for Enhancement, than > please > > let me know how to file it. > > > > Thank you, > > Alexei > > > > --- Johan Compagner <[EMAIL PROTECTED]> wrote: > > > > > Make a RFE for this. > > > > > > > > > On 3/29/06, Alexei Sokolov > > > <[EMAIL PROTECTED]> wrote: > > > > > > > > Hello, > > > > > > > > This is my first post here, so please don't > yell > > > at me > > > > right away... > > > > > > > > Anyway, I was wondering what you think about > > > changing > > > > two places in wicket, both related to class > > > loading. > > > > > > > > in ContextParamWebApplicationFactory: > > > > > > > > final Class applicationClass = > > > > getClass().getClassLoader().loadClass( > > > > applicationClassName); > > > > > > > > change to: > > > > > > > > final Class applicationClass = > > > > > > > > > > Thread.currentThread().getContextClassLoader().loadClass( > > > > > > > applicationClassName); > > > > > > > > and in DefaultClassResolver: > > > > > > > > change: > > > > return > > > > > > > > > > DefaultClassResolver.class.getClassLoader().loadClass(classname); > > > > > > > > to: > > > > return > > > > > > > > > > Thread.currentThread().getContextClassLoader().loadClass(classname); > > > > > > > > I don't think it'll brake anything in the > existing > > > > apps, but the changes allow for easy > integration > > > with > > > > OSGi containers. > > > > > > > > Alexei > > > > > > > > > __________________________________________________ > > > > Do You Yahoo!? > > > > Tired of spam? Yahoo! Mail has the best spam > > > protection around > > > > http://mail.yahoo.com > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > This SF.Net email is sponsored by xPML, a > > > groundbreaking scripting > > > > language > > > > that extends applications into web and mobile > > > media. Attend the live > > > > webcast > > > > and join the prime developer group breaking > into > > > this new coding > > > > territory! > > > > > > > > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > > > > > _______________________________________________ > > > > Wicket-develop mailing list > > > > [email protected] > > > > > > > > > > https://lists.sourceforge.net/lists/listinfo/wicket-develop > > > > > > > > > > > > > __________________________________________________ > > Do You Yahoo!? > > Tired of spam? Yahoo! Mail has the best spam > protection around > > http://mail.yahoo.com > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by xPML, a > groundbreaking scripting language > > that extends applications into web and mobile > media. Attend the live webcast > > and join the prime developer group breaking into > this new coding territory! > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > > _______________________________________________ > > Wicket-develop mailing list > > [email protected] > > > https://lists.sourceforge.net/lists/listinfo/wicket-develop > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a > groundbreaking scripting language > that extends applications into web and mobile media. > Attend the live webcast > and join the prime developer group breaking into > this new coding territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642 > _______________________________________________ > Wicket-develop mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/wicket-develop > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
