You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Mitch Gitman <mg...@usa.net> on 2002/12/11 00:01:11 UTC

resolved -- Re: commons-logging issue (maybe JUnit-related)

Probably a bit more of a JUnit issue than Axis, but here goes.

While the -noloading argument to junit.swingui.TestRunner works, it's not 
preferable. When you have to run multiple tests, your web service's 
internal logic is going to have to be re-initialized manually before every 
test.

Using excluded.properties re-initializes the web service automatically. My 
glaringly stupid mistake was to literally add the full path of 
excluded.properties to the head of the classpath rather than adding the 
path for the parent of junit\runner\excluded.properties, which obviously is 
what the classloader is looking for.

At 11:00 10.12.02 -0800, you wrote:
>Found in the Axis Developer's Guide the use of a -noloading argument for 
>junit.swingui.TestRunner. Worked. Huh.
>
>At 10:47 10.12.02 -0800, I wrote:
>>Anybody testing Axis using the JUnit graphical test runner?
>>
>>I've added anything Apache-related to the list of classes JUnit knows to 
>>just load only once using the primordial classloader. Specifically, I've 
>>added the following line to the file excluded.properties: 
>>excluded.9=org.apache.*
>>Plus, I've specified this file at the beginning of the classpath that I 
>>use to launch the test runner:
>>java -cp C:\project\output\deploy\junit\runner\excluded.properties;... 
>>junit.swingui.TestRunner
>>
>>But I still get the same exception in my Axis test client (not on my Axis 
>>server):
>>java.lang.ExceptionInInitializerError
>>___at org.apache.axis.client.Service.getAxisClient(Service.java:140)
>>...
>>Caused by: org.apache.commons.logging.LogConfigurationException: 
>>org.apache.commons.logging.LogConfigurationException: 
>>org.apache.commons.logging.LogConfigurationException: Class 
>>org.apache.commons.logging.impl.Jdk14Logger does not implement Log
>>
>>This seems to be a fundamental issue with JUnit testing of Axis.
>>
>>At 09:33 02.12.02 +0800, Steve Kinsman wrote:
>>
>>>The solution to this is hinted at in the JUnit documentation, and is
>>>easy to implement.  The problem arises because JUnit uses multiple class
>>>loaders across test cases.  However it has a list of packages it knows
>>>NOT to reload all the time - and you can add to this list.
>>>Copy junit\runner\excluded.properties from junit.jar (e.g.
>>>foo\junit\runner\excluded.properties), and place your copy earlier in
>>>the classpath than junit.jar.  (e.g. classpath should have "foo" before
>>>junit.jar).  Now add the following to your exclude.properties:
>>>
>>>#
>>># This one is needed to stop exceptions in apache logging (& other areas
>>>in Axis too!)
>>># due to reloading by classloader for each test case
>>>#
>>>excluded.6=org.apache.*
>>>
>>>I hope this helps!
>>>
>>>Steve Kinsman
>>>
>>>
>>>
>>>
>>>                     Mitch Gitman
>>>                     <mgitman@usa.        To:     axis-user@xml.apache.org
>>>                     net>                 cc:
>>>                                          Subject:     Re: 
>>> commons-logging issue (maybe JUnit-related)
>>>                     30/11/2002
>>>                     04:08
>>>                     Please
>>>                     respond to
>>>                     axis-user
>>>
>>>
>>>
>>>
>>>
>>>Sure enough, this problem does not arise when running my Axis client
>>>directly. So where's the conflict with JUnit? The JUnit archive doesn't
>>>define these classes.
>>>
>>>At 11:45 29.11.02 -0800, you wrote:
>>> >I'm trying to run some JUnit tests on an Axis client. My client class'
>>> >constructor calls the default constructor for
>>> >org.apache.axis.client.Service. This causes an exception to crop up:
>>> >java.lang.ExceptionInInitializerError
>>> >at org.apache.axis.client.Service.<init>(Service.java:108)
>>> >...
>>> >Caused by: org.apache.commons.logging.LogConfigurationException: ...
>>> >org.apache.commons.logging.impl.Jdk14Logger does not implement Log
>>> >         at
>>> >
>>>org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:555)
>>>
>>> >...
>>> >
>>> >Now, Jdk14Logger does implement Log; both are in commons-logging.jar.
>>>At
>>> >first, I thought this was a simple classloading issue, that somehow an
>>> >inconsistent version of the class or interface was being picked up. But
>>>
>>> >after moving common-logging.jar to the head of my classpath list for
>>> >invoking JUnit, I still got the error. And anyway, I don't see
>>>Jdk14Logger
>>> >or Log elsewhere in the classpath.
>>> >
>>> >I suspect this issue has something to do with JUnit, although I haven't
>>>a
>>> >technical reason. Just, "Jdk14Logger does not implement Log" has made
>>>its
>>> >way to the Cactus (JUnit for webapps) mailing list. Next, I'm going to
>>>try
>>> >running my Axis client directly rather than through JUnit.
>>> >