This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 131117 - Upgrade commons_logging.jar to 1.1
Summary: Upgrade commons_logging.jar to 1.1
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Spring (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P2 blocker (vote)
Assignee: Andrei Badea
URL:
Keywords: API, API_REVIEW_FAST
Depends on:
Blocks:
 
Reported: 2008-03-26 01:17 UTC by Ed Wong
Modified: 2008-04-25 13:13 UTC (History)
6 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Proposed change (43.62 KB, text/plain)
2008-04-01 18:03 UTC, Andrei Badea
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Wong 2008-03-26 01:17:31 UTC
On or about NB6.1 Dev build 200803220007, Spring Framework module (java2\modules\org-netbeans-libs-
springframework.jar) started including version 1.1 of Apache Commons Logging JAR (java2\modules\ext\spring\commons-
logging-1.1.jar) in its manifest's Class-Path extension.  Even though a dash was specified for OpenIDE-Module-Public-
Packages (indicating no packages are to be exported), the System Classloader (Thread Context ClassLoader) can still 
access the 1.1 Commons Logging classes (http://bits.netbeans.org/dev/javadoc/org-openide-
modules/org/openide/modules/doc-files/classpath.html#syscl).

Modules which depend on standard NB 6.1 Apache Commons Logging 1.0.4 module (org-netbeans-libs-commons_logging.jar) 
are now broken when Apache's LogFactory.getLog() is called because LogFactoryImpl uses the Thread Context ClassLoader 
to load the implementation class and finds it from the Spring Framework Module ClassLoader.  However, the 
org.apache.commons.logging.Log interface loaded by netbeans-libs-commons_logging Module ClassLoader fails the 
isAssignableFrom() test with the implementation class, causing severe problems downstream.

Was the standard NB 1.0.4 based Apache Commons Logging not adequate for the Spring Framework?

SEVERE [org.openide.util.RequestProcessor]
org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version 
of 'org.apache.commons.logging.Log' visible, which is not allowed.
	at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:385)
Caused: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: 
Invalid class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is 
not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You 
have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.)
	at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:397)
	at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
Caused: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: 
org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version 
of 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by 
org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have more than one version 
of 'org.apache.commons.logging.Log' visible, which is not allowed.) (Caused by 
org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid 
class loader hierarchy.  You have more than one version of 'org.apache.commons.logging.Log' visible, which is not 
allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy.  You have 
more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.))
	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.LogFactory.getLog(LogFactory.java:370)
Comment 1 John Baker 2008-03-26 01:38:56 UTC
Spring has been using 1.1 for awhile now

Which modules use 1.1?
Can you please provide a use case 
Comment 2 Ed Wong 2008-03-26 01:58:17 UTC
Besides Spring, I'm not sure which other module uses the 1.1 Apache Commons Logging.

We (at SOA/BI Java CAPS) are not trying to use any specific version but just depending on the standard NetBeans Apache 
Commons Logging module (org-netbeans-libs-commons_logging.jar) which happens to be 1.0.4 based.  However because of 
the System ClassLoader, the 1.1 version of Log Implementation is retrieved from the Spring Framework Module and tested 
against the 1.0.4 version of Log Interface in the LogFactoryImpl.getLogContructor(), resulting in error for our 
modules.  When we disabled the Spring Framework module JARs, everything worked as expected.  We (Java CAPS and Spring) 
were all happily coexisting prior to the 200803220007 Dev build.
Comment 3 John Baker 2008-03-26 02:11:51 UTC
Possibly this change <http://hg.netbeans.org/main?cmd=changeset;node=9505aae8cc79> caused the conflict, so if the
library is not moved to a separate integration module this could solve this ?  
Comment 4 John Baker 2008-03-26 02:18:13 UTC
Spring in 6.1 requires version 1.1 of apache commons-logging 
Comment 5 John Baker 2008-03-26 02:35:33 UTC
I think, ideally commons logging should really fix the incompatibility of package names in different versions of the library
Comment 6 John Baker 2008-03-26 02:38:39 UTC
If this conflict really didn't occur until after 3/22 then changeset 9505aae8cc79 may have to be reverted
Comment 7 Andrei Badea 2008-03-26 13:09:56 UTC
Fixed in 42b687c8e6e7 by not putting spring.jar and commons_logging.jar on the module classpath. This is not the right
fix, since the reason to have a separate wrapper module was to expose the Spring API. Better would be to upgrade
libs.commons_logging to 1.1 and remove commons_logging.jar from libs.springframework. I opened a discussion about that,
so downgrading to P3 and leaving open for now.
Comment 8 Jun Qian 2008-03-26 21:34:13 UTC
You might want to vote for issue #118020.
Comment 9 Andrei Badea 2008-03-27 11:26:02 UTC
No plans to upgrade commons_logging.jar to 1.1 in NetBeans 6.1, so making as enhancement.
Comment 10 Andrei Badea 2008-04-01 18:03:40 UTC
Created attachment 59502 [details]
Proposed change
Comment 11 Andrei Badea 2008-04-01 18:08:57 UTC
I propose to upgrade the version of commons-logging.jar in libs.commons_logging from 1.0.4 to 1.1. According to the
announcement of 1.1, this should be a backward compatible change:

http://www.mail-archive.com/announce@apache.org/msg00251.html

Please review. No, this is not an April Fools' joke.
Comment 12 Andrei Badea 2008-04-01 20:56:07 UTC
As users of commons-logging.jar, visual web and mobility might be interested.
Comment 13 John Baker 2008-04-03 22:04:37 UTC
update: discussions have been going on with the Visual Web team
Comment 14 Andrei Badea 2008-04-08 17:25:08 UTC
Unless there are any more comments, I will commit tomorrow.
Comment 15 Andrei Badea 2008-04-10 08:52:51 UTC
311fb5d453e3