Alan,

Is this an environment where you have several class loaders? Ceki

At 16:47 30.03.2001 -0700, you wrote:
>Hi all,
>
>I'm having a problem I just can't figure out.  I don't know if it's
>Log4J related exactly, but maybe some of you can help.  I have extended
>PatternLayout and am trying to use DOMConfigurator to read in my config
>file.  The config file refers to my version of PatternLayout called
>LoggerPatternLayout in the following manner:
>
> <appender name="TEMP" class="org.apache.log4j.FileAppender">
>  <param name="File" value="temp"/>
>  <layout class="util.log.LoggerPatternLayout">
>   <param name="ConversionPattern"
>    value="%d|%-5p|%h|%m|%l\n"/>
>  </layout>
> </appender>
>
>I get a ClassNotFoundException when DOMConfigurator (through
>Class.forName()) tries to find the class
>'util.log.LoggerPatternLayout'.  However, as you can see from the
>following code, I can call a Class.forName() on that same class name in
>the same code where I try to configure with DOMConfigurator and I don't
>get an exception at that point.
>
>    // the following line throws no exception
>   Object instance =
>Class.forName("util.log.LoggerPatternLayout").newInstance();
>   java.net.URL config =
>java.lang.ClassLoader.getSystemResource("LoggerConfig.xml");
>   String configFile = config.getFile();
>    // this line throws the exception show below
>   DOMConfigurator.configure(configFile);
>
>Ok, now I know the first thing you're thinking is "check your
>classpath".  Well, I've done that.  I've tried including every possible
>directory I can think of in my classpath and nothing helps.  Now, to add
>another twist on this problem, if I jar up my class files and drop that
>jar file in the 'jdk1.2.2/jre/lib/ext/' directory, then DOMConfigurator
>can find that class of mine.  So why can that class be found if it's in
>a jar in the 'ext' directory, but not in the classpath?  Any suggestions
>would be appreciated.
>
>Here's a snippet of the stack trace:
>
>log4j: Parsing layout of class: "util.log.LoggerPatternLayout"
>log4j:ERROR Could not create the Layout. Reported error follows.
>java.lang.ClassNotFoundException: util.log.LoggerPatternLayout
> at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java, Compiled
>Code)
> at java.lang.ClassLoader.loadClass(ClassLoader.java, Compiled Code)
> at java.lang.ClassLoader.loadClass(ClassLoader.java, Compiled Code)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java, Compiled
>Code)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:124)
> at
>org.apache.log4j.xml.DOMConfigurator.parseLayout(DOMConfigurator.java,
>Compiled Code)
> at
>org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java,
>Compiled Code)
> at
>org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java,
>Compiled Code)
> at
>org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java,
>Compiled Code)
> at
>org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java,
>Compiled Code)
> at
>org.apache.log4j.xml.DOMConfigurator.parseChildrenOfCategoryElement(DOMConfigurator.java,
>Compiled Code)
> at
>org.apache.log4j.xml.DOMConfigurator.parseRoot(DOMConfigurator.java:330)
>
> at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java,
>Compiled Code)
> at
>org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:575)
>
> at
>org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:520)
>
> at
>org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:590)
>
> at util.log.test.logger_test.main(logger_test.java:27)
>log4j: Attaching appender named [STDOUT] to appender named [ASYNC].
>
>
>Thanks in advance,
>Alan


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to