Cyberduck Mountain Duck CLI

#3641 closed defect (worksforme)

java.lang.ExceptionInInitializerError (org.apache.commons.logging.LogConfigurationException: No suitable Log constructor)

Reported by: samj Owned by: dkocher
Priority: normal Milestone:
Component: core Version: 3.2.1
Severity: major Keywords:
Cc: Architecture:
Platform:

Description (last modified by dkocher)

After a long time with CyberDuck crashing on launch version 3.2.1 (4923) finally starts but fails to connect apparently due to a Log4J error. The log below appears when I try to connect to e.g. S3 after starting Cyberduck from the command line:

$ cd /Applications/Cyberduck.app/Contents/MacOSnephologist:MacOS samj$ ./Cyberduck 
2009-08-27 15:49:13.266 Cyberduck[4616:10b] java/lang/ExceptionInInitializerError
Stack Trace:
java.lang.ExceptionInInitializerError
	at ch.cyberduck.core.s3.S3Session.<init>(S3Session.java:104)
	at ch.cyberduck.core.s3.S3Session$Factory.create(S3Session.java:65)
	at ch.cyberduck.core.SessionFactory.createSession(SessionFactory.java:50)
	at ch.cyberduck.ui.cocoa.CDBrowserController.init(CDBrowserController.java:3636)
	at ch.cyberduck.ui.cocoa.CDBrowserController.access$2300(CDBrowserController.java:56)
	at ch.cyberduck.ui.cocoa.CDBrowserController$34.run(CDBrowserController.java:3739)
	at ch.cyberduck.ui.cocoa.CDBrowserController.unmount(CDBrowserController.java:3811)
	at ch.cyberduck.ui.cocoa.CDBrowserController.unmount(CDBrowserController.java:3779)
	at ch.cyberduck.ui.cocoa.CDBrowserController.mount(CDBrowserController.java:3735)
	at ch.cyberduck.ui.cocoa.CDBrowserController.connectBookmarkButtonClicked(CDBrowserController.java:2018)
	at ch.cyberduck.ui.cocoa.CDBrowserController$9.tableRowDoubleClicked(CDBrowserController.java:1669)
	at com.apple.cocoa.application.NSApplication.sendEvent(Native Method)
	at ch.cyberduck.ui.cocoa.CDMainApplication.sendEvent(CDMainApplication.java:62)
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@ada795 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category) (Caused by org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@ada795 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category))
	at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
	at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
	at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
	at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
	at org.jets3t.service.Jets3tProperties.<clinit>(Jets3tProperties.java:49)
	... 13 more
Caused by: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@ada795 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category)
	at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:413)
	at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
	... 17 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category
	at java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
	at java.lang.Class.getConstructor0(Class.java:2671)
	at java.lang.Class.getConstructor(Class.java:1629)
	at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410)
	... 18 more


Change History (9)

comment:1 Changed on Aug 27, 2009 at 2:22:18 PM by dkocher

  • Description modified (diff)

This looks like you have a commons-logging.jar somewere in your system classpath.

comment:2 follow-up: Changed on Aug 28, 2009 at 7:32:51 AM by samj

Thanks for the prompt response. I tried unsetting CLASSPATH but to no avail:

$ unset CLASSPATH nephologist:MacOS samj$ ./Cyberduck Exception in thread "Background" java.lang.ExceptionInInitializerError

at com.mosso.client.cloudfiles.FilesClient.<init>(FilesClient.java:103) at com.mosso.client.cloudfiles.FilesClient.<init>(FilesClient.java:167) at ch.cyberduck.core.cf.CFSession.connect(CFSession.java:91) at ch.cyberduck.core.Session.check(Session.java:93) at ch.cyberduck.core.Session.mount(Session.java:225) at ch.cyberduck.core.Session.mount(Session.java:208) at ch.cyberduck.ui.cocoa.CDBrowserController$34$1.run(CDBrowserController.java:3744) at ch.cyberduck.ui.cocoa.CDWindowController$1.run(CDWindowController.java:77)

Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@d7bd04 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category) (Caused by org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@d7bd04 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category))

at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543) at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235) at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209) at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351) at org.apache.commons.httpclient.HttpClient.<clinit>(HttpClient.java:66) ... 8 more

Caused by: org.apache.commons.logging.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@d7bd04 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDefFoundError: org/apache/log4j/Category)

at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:413) at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529) ... 12 more

Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category

at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357) at java.lang.Class.getConstructor0(Class.java:2671) at java.lang.Class.getConstructor(Class.java:1629) at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410) ... 13 more

I've also tried to find commons-logging.jar but to no avail:

$ locate commons-logging.jar /Applications/Adobe Flash CS4/Common/Configuration/ActionScript 3.0/commons-logging.jar /Applications/Protege_4.0_beta/configuration/org.eclipse.osgi/bundles/3/1/.cp/lib/commons-logging.jar /Applications/eclipse/plugins/com.amazonaws.eclipse.datatools.enablement.simpledb.driver_1.0.0.v200907221402/lib/commons-logging-1.0.4/commons-logging.jar /Applications/eclipse/plugins/com.amazonaws.eclipse.ec2_1.0.0.v200907221402/lib/commons-logging-1.0.4/commons-logging.jar /Applications/eclipse/plugins/org.apache.ant_1.7.1.v20090120-1145/lib/ant-commons-logging.jar /Applications/oxygen/tools/ant/lib/ant-commons-logging.jar /Library/Application Support/Adobe/Adobe Version Cue CS4/Server/plugins/org.apache.commons_4.0.0/lib/commons-logging.jar /Library/Application Support/Adobe/Adobe Version Cue CS4/Server/vcsync_client/lib/commons-logging.jar $ ls -la /System/Library/Java/Extensions/ total 37632 drwxr-xr-x 21 root wheel 714 Jun 19 02:20 . drwxr-xr-x 5 root wheel 170 Sep 20 2008 .. -rw-r--r-- 1 root wheel 6283 May 6 19:18 AppleScriptEngine.jar -rw-r--r-- 1 root wheel 127216 May 31 2008 CoreAudio.jar -rw-r--r-- 1 root wheel 12835 May 25 23:16 MRJToolkit.jar -rw-r--r-- 1 root wheel 935180 May 28 03:40 QTJava.zip -rw-r--r-- 1 root wheel 17045 Oct 1 2008 dns_sd.jar -rw-r--r-- 1 root wheel 1245588 May 31 2008 j3daudio.jar -rw-r--r-- 1 root wheel 1340102 May 31 2008 j3dcore.jar -rw-r--r-- 1 root wheel 789164 May 31 2008 j3dutils.jar -rw-r--r-- 1 root wheel 328952 May 31 2008 jai_codec.jar -rw-r--r-- 1 root wheel 1893836 May 31 2008 jai_core.jar -rwxr-xr-x 1 root wheel 175152 May 6 19:18 libAppleScriptEngine.jnilib -rwxr-xr-x 1 root wheel 409568 May 31 2008 libJ3D.jnilib -rwxr-xr-x 1 root wheel 724880 May 31 2008 libJ3DAudio.jnilib -rwxr-xr-x 1 root wheel 54768 May 31 2008 libJ3DUtils.jnilib -rwxr-xr-x 1 root wheel 948016 May 28 03:44 libQTJNative.jnilib -rwxr-xr-x 1 root wheel 146144 Apr 14 06:27 libShark.jnilib -rwxr-xr-x 1 root wheel 9875120 May 31 2008 libmlib_jai.jnilib -rw-r--r-- 1 root wheel 41239 May 31 2008 mlibwrapper_jai.jar -rw-r--r-- 1 root wheel 153874 May 31 2008 vecmath.jar $ ls -la ~/Library/Java/Extensions/ total 0 drwxr-xr-x 2 samj staff 68 Apr 10 12:00 . drwxr-xr-x 3 samj staff 102 Apr 10 12:00 ..

Would this not imply that I *don't* have a commons-logging.jar? I'm no Java guru but it says: NoClassDefFoundError.

comment:3 in reply to: ↑ 2 Changed on Aug 28, 2009 at 8:30:09 AM by dkocher

Replying to samj:

Would this not imply that I *don't* have a commons-logging.jar? I'm no Java guru but it says: NoClassDefFoundError.

From what I know there must be a commons-logging.jar in the system classpath loaded by the parent classloader. But log4j and commons-logging must be loaded by the same application class loader.

comment:4 follow-up: Changed on Aug 28, 2009 at 8:37:57 AM by samj

Ok I'll see what I can find. BTW I'd make a donation but my PayPal account was just suspended because I accessed it from my iPhone!?!?!

Will be in Zürich on and off from next month so maybe I can buy you a beer or something...

Sam

comment:5 in reply to: ↑ 4 Changed on Oct 2, 2009 at 10:47:34 PM by dkocher

Replying to samj:

Ok I'll see what I can find. BTW I'd make a donation but my PayPal account was just suspended because I accessed it from my iPhone!?!?!

Will be in Zürich on and off from next month so maybe I can buy you a beer or something...

Sam

You could probably find out by looking at Open Files in Activity Monitor.app → View → Inspect Process. Do you plan to visit Bern?

comment:6 Changed on Oct 3, 2009 at 12:00:14 AM by samj

Will have a rail pass so yeah, why not?

Reinstalled Snow Leopard from scratch so things are (or at least were) working again.

Sam

comment:7 Changed on Oct 3, 2009 at 1:08:31 PM by dkocher

  • Resolution set to worksforme
  • Status changed from new to closed

comment:8 follow-up: Changed on Oct 13, 2009 at 11:38:45 AM by samj

OK so the problem was that I had commons-logging-1.0.4.jar in /Library/Java/Extensions. Removing it allows Cyberduck to start but breaks other Java applications on my system. I did find however that downloading log4j from http://logging.apache.org/log4j/1.2/index.html and installing both commons-logging-1.0.4.jar and log4j-1.2.15.jar into /Library/Java/Extensions. That is to say it appears to be ok if you have commons-logging in your Java path provided you also have log4j?

Note that it's a difficult problem to diagnose - initially Cyberduck would just crash on launch but then more recent versions I could see e.g. Amazon S3 connections but attempts to open them were silently ignored (unless I opened a terminal, ran /Applications/Cyberduck.app/Contents/MacOS/Cyberduck directly and watched for the errors on the command line. As I said, not a Java guru but I do wonder whether this condition couldn't be better handled (e.g. with a sensible error?).

comment:9 in reply to: ↑ 8 Changed on Oct 13, 2009 at 12:27:03 PM by dkocher

Replying to samj:

OK so the problem was that I had commons-logging-1.0.4.jar in /Library/Java/Extensions. Removing it allows Cyberduck to start but breaks other Java applications on my system. I did find however that downloading log4j from http://logging.apache.org/log4j/1.2/index.html and installing both commons-logging-1.0.4.jar and log4j-1.2.15.jar into /Library/Java/Extensions. That is to say it appears to be ok if you have commons-logging in your Java path provided you also have log4j?

Thanks for your anlysis on this. Commons-Logging is known for its problems with different classloaders and its dynamic lookup of log implementations. It might act differently if you place a newer version of commons-logging jar into the Extensions directory.

Note that it's a difficult problem to diagnose - initially Cyberduck would just crash on launch but then more recent versions I could see e.g. Amazon S3 connections but attempts to open them were silently ignored (unless I opened a terminal, ran /Applications/Cyberduck.app/Contents/MacOS/Cyberduck directly and watched for the errors on the command line. As I said, not a Java guru but I do wonder whether this condition couldn't be better handled (e.g. with a sensible error?).

Yes, we would need to catch these runtime exceptions which we currently do not as they are usually recoverable from.

Note: See TracTickets for help on using tickets.
swiss made software