You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Franck Quinard <fr...@yahoo.fr> on 2001/11/18 09:26:53 UTC
Problem initializing Log4J in JUnit
Hello,
Could any one tell me where I should initialize log4J so JUnit don't stop
with this exception:
Failed to invoke suite():java.lang.LinkageError: Class
org/xml/sax/InputSource violates loader constraints.
What I liked to do, is to initialize log4J with this:
URL url = ClassLoader.getSystemResource("log.xml");
if (url != null) {
DOMConfigurator.configure(url);
cat.debug("Configuration file found\n");
} else {
BasicConfigurator.configure();
cat.error("Configuration file not found\n");
}
But, if I put that in the setUp method of FooTest.java or in here,
public static Test suite() {
return new TestSuite(MoneyTest.class);
}
I get the Exception.
If I put the initialization in the constructor of FooTest.java, I get this
junit.framework.AssertionFailedError: Exception in Constructor:
testFooEquals (java.lang.LinkageError: Class org/xml/sax/InputSource
violates loader constraints
When I don't initialize Log4J everything work well.
Does anybody could help me with that.
Thanks a lot
Franck
P.S.: I'm sorry for my English, But I'm working on it
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Problem initializing Log4J in JUnit
Posted by Ceki Gulcu <ce...@qos.ch>.
Frank,
What are these loading constraints? That would seem to be the key... Regards, Ceki
At 09:26 18.11.2001 +0100, you wrote:
>Hello,
>
>Could any one tell me where I should initialize log4J so JUnit don't stop
>with this exception:
>
>Failed to invoke suite():java.lang.LinkageError: Class
>org/xml/sax/InputSource violates loader constraints.
>
>What I liked to do, is to initialize log4J with this:
>
>
> URL url = ClassLoader.getSystemResource("log.xml");
> if (url != null) {
> DOMConfigurator.configure(url);
> cat.debug("Configuration file found\n");
> } else {
> BasicConfigurator.configure();
> cat.error("Configuration file not found\n");
> }
>
>But, if I put that in the setUp method of FooTest.java or in here,
>
> public static Test suite() {
> return new TestSuite(MoneyTest.class);
> }
>
>I get the Exception.
>
>If I put the initialization in the constructor of FooTest.java, I get this
>
>junit.framework.AssertionFailedError: Exception in Constructor:
>testFooEquals (java.lang.LinkageError: Class org/xml/sax/InputSource
>violates loader constraints
>
>When I don't initialize Log4J everything work well.
>
>Does anybody could help me with that.
>Thanks a lot
>
>Franck
>
>P.S.: I'm sorry for my English, But I'm working on it
>
>
>
>_________________________________________________________
>Do You Yahoo!?
>Get your free @yahoo.com address at http://mail.yahoo.com
>
>
>--
>To unsubscribe, e-mail: <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>