You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Dimitar Georgievski <dg...@horizonk.com> on 2004/10/19 21:07:56 UTC
commons logging problem with JUnit/Cactus
Hi,
I am using Cactus to run J2EE tests. Normally cactus runs from Ant and it
works just fine. The problem is when I try to run the same tests from a
command line using JUnit test runner. I receive an error related to commons
logging. No matter which logging framework I tried to use I receive the same
error: Class org.apache.commons.logging.impl.xxxx does not implement Log.
Even if I try to disable logging explicitly
using -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpL
og option I receive the same error.
I tried to move common logs at the top of class path. It didn't work. The
same error was generated. I am running out of ideas. Any help would be
appreciated.
Is there any way to disable the common logging?
I am using
- J2SE 1.4.2 on Win 2000
- jakarta-cactus-13-1.6.1
- commons-logging-1.0.3.jar
- junit-3.8.1.jar
Thanks,
Dimitar
This is the output of the exception stack.
junit.framework.AssertionFailedError: Exception in constructor: testUserFind
(org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException: Class
org.apache.commons.logging.impl.Log4JLogger does not implement Log at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.ja
va:532) at
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.ja
va:272) at
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.ja
va:246) at
org.apache.commons.logging.LogFactory.getLog(LogFactory.java:395) at
org.apache.cactus.internal.server.ServerTestCaseCaller.setDelegatedTest_arou
ndBody3$advice(ServerTestCaseCaller.java:109) at
org.apache.cactus.internal.server.ServerTestCaseCaller.setDelegatedTest(Serv
erTestCaseCaller.java) at
org.apache.cactus.internal.server.ServerTestCaseCaller.<init>(ServerTestCase
Caller.java:66) at
org.apache.cactus.internal.AbstractCactusTestCase.init(AbstractCactusTestCas
e.java:200) at
org.apache.cactus.internal.AbstractCactusTestCase.<init>(AbstractCactusTestC
ase.java:102) at
org.apache.cactus.ServletTestCase.<init>(ServletTestCase.java:93) at
com.wiley.tes.uni.user.TestUserManager.<init>(Unknown Source) at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAcces
sorImpl.java:39) at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstruc
torAccessorImpl.java:27) at
java.lang.reflect.Constructor.newInstance(Constructor.java:274) at
com.wiley.tes.uni.user.TestUserManager.suite(Unknown Source) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25) at junit.runner.BaseTestRunner.getTest(BaseTestRunner.java:111)
Caused by: org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException: Class
org.apache.commons.logging.impl.Log4JLogger does not implement Log at
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryI
mpl.java:416) at
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.ja
va:525) ... 26 more Caused by:
org.apache.commons.logging.LogConfigurationException: Class
org.apache.commons.logging.impl.Log4JLogger does not implement Log at
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryI
mpl.java:412) ... 27 more )
Re: commons logging problem with JUnit/Cactus
Posted by Kazuhito SUGURI <su...@lab.ntt.co.jp>.
Hi,
In article <GO...@horizonk.com>,
Mon, 25 Oct 2004 11:55:29 -0400,
"Dimitar Georgievski" <dg...@horizonk.com> wrote:
dgeorgievski> I have a folder called c:\junit\runner that contains execluded.properties
dgeorgievski> with the following content
'c:\junit\runner' or 'c:\ejb\junit\runner' ?
dgeorgievski> java -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog
dgeorgievski> -cp .;C:\ejb\junit\runner;
I guess 'C:\ejb\junit\runner ' should be 'C:\ejb'.
# execlude.properties should be found in the junit.runner package.
Is it helps you?
----
Kazuhito SUGURI
mailto:suguri.kazuhito@lab.ntt.co.jp
RE: commons logging problem with JUnit/Cactus
Posted by Dimitar Georgievski <dg...@horizonk.com>.
Hi Kazuhito,
I have a folder called c:\junit\runner that contains execluded.properties
with the following content
excluded.0=sun.*
excluded.1=com.sun.*
excluded.2=org.omg.*
excluded.3=javax.*
excluded.4=sunw.*
excluded.5=java.*
excluded.6=org.w3c.dom.*
excluded.7=org.xml.sax.*
excluded.8=net.jini.*
excluded.9=org.apache.commons.*
I have created BAT file that constructs the CLASSPATH and calls one of
JUnit's test runners. The output of this file looks like this:
java -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLo
g -cp .;C:\ejb\junit\runner;C:\programs\Apac
heGroup\jakarta-cactus-13-1.6.1\lib\cactus-1.6.1.jar;C:\programs\ApacheGroup
\jakarta-cactus-13-1.6.1\lib\commons-httpcli
ent-2.0.jar;C:\programs\ApacheGroup\jakarta-cactus-13-1.6.1\lib\commons-logg
ing-1.0.3.jar;C:\programs\junit3.8.1\junit.j
ar;C:\programs\ApacheGroup\jakarta-cactus-13-1.6.1\lib\aspectjrt-1.1.1.jar;
...other JARs... junit.awtui.TestRunner
com.wiley.tes.uni.user.TestUserManager
excluded.properties is in a folder preceding junit.jar file and the error
still appears. org.apache.commons classes are not excluded from loading by
TestRunner class loader.
I have to edit the exclude.properties file in juni.jar archive to make
either awtui.TestRunner or swingui.TestRunner work.
Thanks,
Dimitar
-----Original Message-----
From: Kazuhito SUGURI [mailto:suguri.kazuhito@lab.ntt.co.jp]
Sent: Sunday, October 24, 2004 6:10 AM
To: cactus-user@jakarta.apache.org
Subject: Re: commons logging problem with JUnit/Cactus
Hi,
In article <GO...@horizonk.com>,
Fri, 22 Oct 2004 16:41:10 -0400,
"Dimitar Georgievski" <dg...@horizonk.com> wrote:
dgeorgievski> - renaming the file to junit.runner.execluded.properties
It should not work.
dgeorgievski> - putting it into junit\runner folder
Do you mean you have junit\runner\execluded.properties?
If so, please confirm the thing that the directory where the junit directory
exists in your classpath is proceeding to junit.jar.
Regards,
----
Kazuhito SUGURI
mailto:suguri.kazuhito@lab.ntt.co.jp
---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-user-help@jakarta.apache.org
Re: commons logging problem with JUnit/Cactus
Posted by Kazuhito SUGURI <su...@lab.ntt.co.jp>.
Hi,
In article <GO...@horizonk.com>,
Fri, 22 Oct 2004 16:41:10 -0400,
"Dimitar Georgievski" <dg...@horizonk.com> wrote:
dgeorgievski> - renaming the file to junit.runner.execluded.properties
It should not work.
dgeorgievski> - putting it into junit\runner folder
Do you mean you have junit\runner\execluded.properties?
If so, please confirm the thing that the directory where the junit directory
exists in your classpath is proceeding to junit.jar.
Regards,
----
Kazuhito SUGURI
mailto:suguri.kazuhito@lab.ntt.co.jp
RE: commons logging problem with JUnit/Cactus
Posted by Dimitar Georgievski <dg...@horizonk.com>.
Hi Kazuhito,
I tried both
- renaming the file to junit.runner.execluded.properties
- putting it into junit\runner folder
It didn't work in both cases.
By the way do you know of any tool that you can use with Cactus to simulate
concurrent user access? Cactus is good if you want to do functionality
testing but what do you do when you use to measure the performance of the
middle tier. I have tried Grinder. Is there anything else you might know
about?
Thanks,
dimitar
-----Original Message-----
From: Kazuhito SUGURI [mailto:suguri.kazuhito@lab.ntt.co.jp]
Sent: Wednesday, October 20, 2004 7:02 PM
To: cactus-user@jakarta.apache.org
Subject: Re: commons logging problem with JUnit/Cactus
Hi Dimitar,
In article <GO...@horizonk.com>,
Wed, 20 Oct 2004 14:11:32 -0400,
"Dimitar Georgievski" <dg...@horizonk.com> wrote:
dgeorgievski> First I have stored this file in a location that comes before
junit.jar in
dgeorgievski> the class path. According to JUnit documentation properties
set in this file
dgeorgievski> would override the settings in the excluded.properties in the
JAR archive.
dgeorgievski> It didn't work.
Did you put execluded.properties file to be accessible
as junit.runner.execluded.properties, i.e junit\runner\execluded.properties?
Hope this helps.
----
Kazuhito SUGURI
mailto:suguri.kazuhito@lab.ntt.co.jp
---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-user-help@jakarta.apache.org
Re: commons logging problem with JUnit/Cactus
Posted by Kazuhito SUGURI <su...@lab.ntt.co.jp>.
Hi Dimitar,
In article <GO...@horizonk.com>,
Wed, 20 Oct 2004 14:11:32 -0400,
"Dimitar Georgievski" <dg...@horizonk.com> wrote:
dgeorgievski> First I have stored this file in a location that comes before junit.jar in
dgeorgievski> the class path. According to JUnit documentation properties set in this file
dgeorgievski> would override the settings in the excluded.properties in the JAR archive.
dgeorgievski> It didn't work.
Did you put execluded.properties file to be accessible
as junit.runner.execluded.properties, i.e junit\runner\execluded.properties?
Hope this helps.
----
Kazuhito SUGURI
mailto:suguri.kazuhito@lab.ntt.co.jp
RE: commons logging problem with JUnit/Cactus
Posted by Dimitar Georgievski <dg...@horizonk.com>.
Hi Kazuhito,
I'm sorry I forgot to mention it. I was using the junit.swingui.TestRunner
and junit.awtui.Test to run the tests from command line. I switched to
junit.textui.TestRunner and this time everything worked fine.
I also followed your suggestion regarding the excluded.properties file.
First I have stored this file in a location that comes before junit.jar in
the class path. According to JUnit documentation properties set in this file
would override the settings in the excluded.properties in the JAR archive.
It didn't work. Then, I have edited the file in the jar archive and added a
line that excludes org.apache.common.* packages from loading by the
TestRunner class loader. This time it worked.
Thanks for the help. I really appreciate it.
Dimitar
-----Original Message-----
From: Kazuhito SUGURI [mailto:suguri.kazuhito@lab.ntt.co.jp]
Sent: Tuesday, October 19, 2004 9:44 PM
To: cactus-user@jakarta.apache.org; dgeorgievski@horizonk.com
Subject: Re: commons logging problem with JUnit/Cactus
Hi,
In article <GO...@horizonk.com>,
Tue, 19 Oct 2004 15:07:56 -0400,
"Dimitar Georgievski" <dg...@horizonk.com> wrote:
dgeorgievski> I am using Cactus to run J2EE tests. Normally cactus runs from
Ant and it
dgeorgievski> works just fine. The problem is when I try to run the same
tests from a
dgeorgievski> command line using JUnit test runner. I receive an error
related to commons
dgeorgievski> logging. No matter which logging framework I tried to use I
receive the same
dgeorgievski> error: Class org.apache.commons.logging.impl.xxxx does not
implement Log.
I'm assuming that you are not using JUnit TextTestRunner.
You would try put commons-loggin package in the JUnit execlude.properties.
You can find the property file in your JUnit jar.
See also:
http://jakarta.apache.org/cactus/faq.html#faq_classcastexception_logfactoryi
mpl
Hope this helps,
----
Kazuhito SUGURI
mailto:suguri.kazuhito@lab.ntt.co.jp
Re: commons logging problem with JUnit/Cactus
Posted by Kazuhito SUGURI <su...@lab.ntt.co.jp>.
Hi,
In article <GO...@horizonk.com>,
Tue, 19 Oct 2004 15:07:56 -0400,
"Dimitar Georgievski" <dg...@horizonk.com> wrote:
dgeorgievski> I am using Cactus to run J2EE tests. Normally cactus runs from Ant and it
dgeorgievski> works just fine. The problem is when I try to run the same tests from a
dgeorgievski> command line using JUnit test runner. I receive an error related to commons
dgeorgievski> logging. No matter which logging framework I tried to use I receive the same
dgeorgievski> error: Class org.apache.commons.logging.impl.xxxx does not implement Log.
I'm assuming that you are not using JUnit TextTestRunner.
You would try put commons-loggin package in the JUnit execlude.properties.
You can find the property file in your JUnit jar.
See also:
http://jakarta.apache.org/cactus/faq.html#faq_classcastexception_logfactoryimpl
Hope this helps,
----
Kazuhito SUGURI
mailto:suguri.kazuhito@lab.ntt.co.jp