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 160378 - org.apache.commons.logging classes duplicated between maven.embedder and libs.commons_logging
Summary: org.apache.commons.logging classes duplicated between maven.embedder and libs...
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Milos Kleint
URL:
Keywords: ARCH
: 167993 168538 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-03-16 16:32 UTC by Jesse Glick
Modified: 2009-09-21 18:03 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2009-03-16 16:32:37 UTC
WARNING [org.netbeans.ProxyClassLoader]: Will not load class org.apache.commons.logging.impl.LogFactoryImpl arbitrarily
from one of ModuleCL@1e7c5cb[org.netbeans.modules.maven.embedder] and ModuleCL@3a5794[org.netbeans.libs.commons_logging]
starting from SystemClassLoader[358 modules]; see http://wiki.netbeans.org/DevFaqModuleCCE

Appears whenever you try to use bugtracking functionality. Please consider m.e -> l.c_l dep rather than bundling your
own copy.
Comment 1 Jesse Glick 2009-03-16 16:33:25 UTC
Also this should probably be factored out:

WARNING [org.netbeans.ProxyClassLoader]: Will not load class org.apache.commons.httpclient.params.DefaultHttpParams
arbitrarily from one of ModuleCL@1e7c5cb[org.netbeans.modules.maven.embedder] and
ModuleCL@4be2cc[org.netbeans.libs.bugtracking] starting from SystemClassLoader[358 modules]; see
http://wiki.netbeans.org/DevFaqModuleCCE
Comment 2 Milos Kleint 2009-03-17 07:40:59 UTC
unfortunately for me it means extracting the apache-commons and apache-httpclient content from the maven embedder jar.
If the match of versions for both dependencies are not exact I ran into higher risk of bugs. The same applies when
people upgrade the version of the dependencies modules. Who is loading the http-client classes from the system
classloader anyway?
Comment 3 Jesse Glick 2009-03-17 16:43:29 UTC
"Who is loading the http-client classes from the system classloader anyway?" - don't know offhand. PCL could be changed
to log a stack trace but I fear this would be too noisy. Could be changed to log a stack trace at FINE, say, as well as
the one-line WARNING; then you could run with PCL.level=FINE and see it.
Comment 4 Tomas Stupka 2009-03-17 16:48:12 UTC
"Who is loading the http-client classes from the system classloader anyway?" 
mylyn (used by bugtracking) depends on the http-client library - i will inspect ...
Comment 5 Jesse Glick 2009-03-17 17:05:12 UTC
For example:

java.lang.ClassNotFoundException: Will not load class org.apache.commons.logging.impl.SimpleLog arbitrarily from one of
ModuleCL@13785d3[org.netbeans.modules.maven.embedder] and ModuleCL@1dc0e7a[org.netbeans.libs.commons_logging] starting
from SystemClassLoader[428 modules]; see http://wiki.netbeans.org/DevFaqModuleCCE
[catch] at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:241)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:242)
        at org.apache.commons.logging.impl.LogFactoryImpl.createLogFromClass(LogFactoryImpl.java:1005)
        at org.apache.commons.logging.impl.LogFactoryImpl.discoverLogImplementation(LogFactoryImpl.java:782)
        at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:601)
        at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:333)
        at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:307)
        at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:645)
        at org.apache.commons.httpclient.params.DefaultHttpParams.<clinit>(DefaultHttpParams.java:54)
        at org.eclipse.mylyn.commons.net.WebUtil.<clinit>(WebUtil.java:123)
        at org.netbeans.libs.bugtracking.BugtrackingRuntime.init(BugtrackingRuntime.java:76)
        at org.netbeans.modules.bugtracking.BugtrackingManager.init(BugtrackingManager.java:125)
        at org.netbeans.modules.bugtracking.BugtrackingManager.getInstance(BugtrackingManager.java:85)
        at org.netbeans.modules.bugtracking.util.BugtrackingUtil.getKnownRepositories(BugtrackingUtil.java:148)
        at org.netbeans.modules.bugtracking.vcshooks.HgHookImpl.createComponent(HgHookImpl.java:215)
        at org.netbeans.modules.mercurial.ui.commit.CommitPanel.initHooks(CommitPanel.java:147)
        at org.netbeans.modules.mercurial.ui.commit.CommitAction.commit(CommitAction.java:143)
        at org.netbeans.modules.mercurial.ui.commit.CommitAction.performAction(CommitAction.java:132)
        at org.netbeans.modules.mercurial.ui.actions.ContextAction.actionPerformed(ContextAction.java:69)

I'm guessing LogFactoryImpl.discoverLogImplementation is using Thread.CCL to find itself. (A common stupid design shared
with Xerces - if it is looking up its _own_ impl it should not use the CCL!) Perhaps BugtrackingRuntime.init should
temporarily (finally-block) set Thread.CCL to the WebUtil.class.getClassLoader().

I am concerned however about:

java.lang.ClassNotFoundException: Will not load class org.apache.commons.logging.impl.LogFactoryImpl arbitrarily from
one of ModuleCL@13785d3[org.netbeans.modules.maven.embedder] and ModuleCL@1dc0e7a[org.netbeans.libs.commons_logging]
starting from SystemClassLoader[428 modules]; see http://wiki.netbeans.org/DevFaqModuleCCE
[catch] at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:241)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at org.netbeans.lib.uihandler.LogFormatter.printFrame(LogFormatter.java:140)
        at org.netbeans.lib.uihandler.LogFormatter.printThrown(LogFormatter.java:215)
        at org.netbeans.lib.uihandler.LogFormatter.format(LogFormatter.java:329)
        at org.netbeans.lib.uihandler.LogRecords.write(LogRecords.java:84)
        at org.netbeans.modules.uihandler.Installer.writeOut(Installer.java:418)
        at org.netbeans.modules.uihandler.UIHandler$1WriteOut.run(UIHandler.java:105)

which makes it look like commons_logging is actually interfering somehow with java.util.logging.
Comment 6 Quality Engineering 2009-03-19 20:39:25 UTC
Integrated into 'main-golden', will be available in build *200903191401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/c88f42ee0005
User: Jesse Glick <jglick@netbeans.org>
Log: Diagnostics for #160378.
Comment 7 Jaroslav Pospisil 2009-05-14 13:43:52 UTC
Seems to be already fixed,according to automated message.
Comment 8 Milos Kleint 2009-05-14 14:19:13 UTC
the commons.logging classes are still in the embedder, so the issue is still there.
Comment 9 Milos Kleint 2009-06-03 14:57:41 UTC
http://hg.netbeans.org/main/rev/170df48c8ef3
Comment 10 Quality Engineering 2009-06-04 09:00:02 UTC
Integrated into 'main-golden', will be available in build *200906040201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/170df48c8ef3
User: Milos Kleint <mkleint@netbeans.org>
Log: #160378 cut the commons-logging bits out of the maven-embedder binary
Comment 11 Milos Kleint 2009-07-02 12:52:01 UTC
*** Issue 167993 has been marked as a duplicate of this issue. ***
Comment 12 Jan Stola 2009-07-14 16:21:45 UTC
*** Issue 168538 has been marked as a duplicate of this issue. ***
Comment 13 Tomas Pavek 2009-09-21 18:03:29 UTC
*** Issue 169413 has been marked as a duplicate of this issue. ***