I think I found the problem. If I don't put the log4j file into my WEB-INF/lib directory, then it's fine. If it is put there, then it gets the conflicting version (regardless of whether or not I launch HostedMode with log4j on the class path). So am I doing it wrong?
Am I supposed to place it elsewhere & then copy it over to WEB-INF/lib when I'm packaging it up only? On Wed, Mar 25, 2009 at 5:13 PM, Scott Blum <sco...@google.com> wrote: > Hmm, but GWT doesn't use log4j internally. Is it possible you've got > conflicting versions, one on the system classpath and one in your war > directory? > > > On Wed, Mar 25, 2009 at 4:40 PM, Vitali Lovich <vlov...@gmail.com> wrote: > >> og4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable >> to a "org.apache.log4j.Appender" variable. >> log4j:ERROR The class "org.apache.log4j.Appender" was loaded by >> log4j:ERROR [sun.misc.launcher$appclassloa...@64601bb1] whereas object of >> type >> log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by >> [contextloa...@null([file:/home/vlovich/workspace/sacred_heart/war/WEB-INF/classes/, >> file:/home/vlovich/workspace/sacred_heart/war/WEB-INF/lib/gwt-servlet.jar, >> file:/home/vlovich/workspace/sacred_heart/war/WEB-INF/lib/log4j-1.2.15.jar, >> file:/home/vlovich/workspace/sacred_heart/war/WEB-INF/lib/mysql-connector-java-5.1.7-bin.jar]) >> / >> com.google.gwt.dev.shell.jetty.jettylauncher$webappcontextwithreloa...@e1651fe >> ]. >> log4j:ERROR Could not instantiate appender named "dest". >> log4j:WARN No appenders could be found for logger >> (org.apache.jasper.compiler.JspRuntimeContext). >> log4j:WARN Please initialize the log4j system properly. >> >> Seems like GWT is loading log4j (at least partially) but then I'm using >> the actual log4j form the website, so the class loader throws up. This >> could also be fixed by just bundling log4j into gwt-servlet - odds are, >> people are going to want to use log4j on the server anyways. >> >> >> On Wed, Mar 25, 2009 at 4:17 PM, Scott Blum <sco...@google.com> wrote: >> >>> Vitali, can you remind me what your issue is? >>> >>> >>> On Wed, Mar 25, 2009 at 4:10 PM, Vitali Lovich <vlov...@gmail.com>wrote: >>> >>>> This didn't fix my log4j issue, but there's a workaround: >>>> >>>> adding -Dlog4j.ignoreTCL to the VM arguments fixes it. >>>> >>>> On Wed, Mar 25, 2009 at 3:51 PM, Toby Reyelts <to...@google.com> wrote: >>>> >>>>> Overall, the change to treat server classes vs system classes >>>>> separately, such that system classes are "API classes" and server classes >>>>> are "implementation classes" looks good. >>>>> >>>>> I'm concerned that there will still be places where things will clash - >>>>> such as the sharing of log4j across both server and webapps. Given the >>>>> complexity of the situation, I understand the desire to change behavior as >>>>> little as possible in this area, though. There's also an argument that, >>>>> since this is the way Jetty currently functions, you're just exposing >>>>> Jetty >>>>> behavior, as is. >>>>> >>>>> I think the situation would be simpler if GWT didn't treat the system >>>>> classpath as a "user-level" classpath. >>>>> >>>>> >>>>> On Wed, Mar 25, 2009 at 9:15 AM, <codesite-nore...@google.com> wrote: >>>>> >>>>>> >>>>>> Author: sco...@google.com >>>>>> Date: Wed Mar 25 05:43:19 2009 >>>>>> New Revision: 5078 >>>>>> >>>>>> Modified: >>>>>> >>>>>> >>>>>> releases/1.6/dev/core/src/com/google/gwt/dev/shell/jetty/JettyLauncher.java >>>>>> >>>>>> Log: >>>>>> Amending r5077: >>>>>> - Catch ClassNotFound in outside loader and allow internal load >>>>>> - Allow "system" resources to be loaded internally if they're not >>>>>> found >>>>>> externally >>>>>> - jat suggestion to extract constant >>>>>> - Fix comments >>>>>> >>>>>> Review by: tobyr (TBR) >>>>>> >>>>>> Modified: >>>>>> >>>>>> releases/1.6/dev/core/src/com/google/gwt/dev/shell/jetty/JettyLauncher.java >>>>>> >>>>>> ============================================================================== >>>>>> --- >>>>>> >>>>>> releases/1.6/dev/core/src/com/google/gwt/dev/shell/jetty/JettyLauncher.java >>>>>> (original) >>>>>> +++ >>>>>> >>>>>> releases/1.6/dev/core/src/com/google/gwt/dev/shell/jetty/JettyLauncher.java >>>>>> Wed Mar 25 05:43:19 2009 >>>>>> @@ -249,6 +249,8 @@ >>>>>> */ >>>>>> private class WebAppClassLoaderExtension extends >>>>>> WebAppClassLoader { >>>>>> >>>>>> + private static final String META_INF_SERVICES = >>>>>> "META-INF/services/"; >>>>>> + >>>>>> public WebAppClassLoaderExtension() throws IOException { >>>>>> super(bootStrapOnlyClassLoader, >>>>>> WebAppContextWithReload.this); >>>>>> } >>>>>> @@ -257,17 +259,21 @@ >>>>>> public URL findResource(String name) { >>>>>> // Specifically for >>>>>> META-INF/services/javax.xml.parsers.SAXParserFactory >>>>>> String checkName = name; >>>>>> - if (checkName.startsWith("META-INF/services/")) { >>>>>> - checkName = >>>>>> checkName.substring("META-INF/services/".length()); >>>>>> + if (checkName.startsWith(META_INF_SERVICES)) { >>>>>> + checkName = >>>>>> checkName.substring(META_INF_SERVICES.length()); >>>>>> } >>>>>> >>>>>> - // For system/server path, just try the outside world >>>>>> quietly. >>>>>> + // For a system path, load from the outside world. >>>>>> + URL found; >>>>>> if (isSystemPath(checkName)) { >>>>>> - return systemClassLoader.getResource(name); >>>>>> + found = systemClassLoader.getResource(name); >>>>>> + if (found != null) { >>>>>> + return found; >>>>>> + } >>>>>> } >>>>>> >>>>>> // Always check this ClassLoader first. >>>>>> - URL found = super.findResource(name); >>>>>> + found = super.findResource(name); >>>>>> if (found != null) { >>>>>> return found; >>>>>> } >>>>>> @@ -303,14 +309,18 @@ >>>>>> >>>>>> @Override >>>>>> protected Class<?> findClass(String name) throws >>>>>> ClassNotFoundException { >>>>>> - // For system/server path, just try the outside world >>>>>> quietly. >>>>>> + // For system path, always prefer the outside world. >>>>>> if (isSystemPath(name)) { >>>>>> - return systemClassLoader.loadClass(name); >>>>>> + try { >>>>>> + return systemClassLoader.loadClass(name); >>>>>> + } catch (ClassNotFoundException e) { >>>>>> + } >>>>>> } >>>>>> >>>>>> try { >>>>>> return super.findClass(name); >>>>>> } catch (ClassNotFoundException e) { >>>>>> + // Don't allow server classes to be loaded from the >>>>>> outside. >>>>>> if (isServerPath(name)) { >>>>>> throw e; >>>>>> } >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>> >>> >>> >> >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---