[groovy-user] Groovyc -ant task fails: Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.Log

163 views
Skip to first unread message

Imner, Andreas

unread,
Dec 11, 2009, 2:20:01 AM12/11/09
to us...@groovy.codehaus.org
 
Hi
 
When using the <groovyc> -task inside and ant -script I get an error, with a stacktrace ending with
 
"Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.Log"
 
This can be "fixed" by copying the commons-logging-1.1.jar -file from the GROOVY_HOME\lib -folder to ANT_HOME\lib but is this really the way that it should be done?
 
I thought that setting the GROOVY_HOME -environment variable should be enough?
 
Any others tips or ideas?
 
/Andreas
 
 
 
 

Roshan Dawrani

unread,
Dec 11, 2009, 7:09:56 AM12/11/09
to us...@groovy.codehaus.org
I think it also depends on what you are doing in that script and how the classpath, etc is set in your ant script.

Say, from your groovy script, you invoke some other pre-compiled class (your own or some third-party), which was compiled with org.apache.commons.logging.Log reference, then loading of that class will fail if at runtime commons-logging jar is not on classpath.

I do not think that you will be able to reproduce this issue in a simple, small groovy script that does not call anything outside groovy, let's say. Can you try?

rgds,
Roshan

Roshan Dawrani

unread,
Dec 11, 2009, 7:15:14 AM12/11/09
to us...@groovy.codehaus.org
A small correction: Since you are getting ClassNotFoundException and not NoClassDefFoundError, some pre-compiled class that you are invoking is looking for "org.apache.commons.logging.Log" by its name and wasn't really compiled with it.

Same point remains, though - that some class/library you are invoking from your groovy script is looking for commons-logging classes and it's not on the classpath of <groovyc>


John Hartnup

unread,
Dec 11, 2009, 7:25:39 AM12/11/09
to user
I get the same situation when using Spring from Groovy - spring.jar
depends upon commons-logging-1.1.jar

I suspect you're using something external to Groovy, that requires
commons-logging

--
"There is no way to peace; peace is the way"

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Imner, Andreas

unread,
Dec 11, 2009, 8:01:32 AM12/11/09
to us...@groovy.codehaus.org

Yes, you and Roshan were right, the Java classes used by the Groovy unit test was using commons logging. I was focusing so much on groovyc that I failed to look elsewhere...

Thanks again!

-----Ursprungligt meddelande-----
Från: John Hartnup [mailto:john.h...@gmail.com]
Skickat: den 11 december 2009 13:26
Till: user
Ämne: Re: [groovy-user] Groovyc -ant task fails: Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.Log

Reply all
Reply to author
Forward
0 new messages