Configure commons-logging to log using java.util.logging

It was observed that maven classpath display failed. The stack trace:

     [exec] SEVERE [org.openide.util.RequestProcessor]: Error in RequestProcessor org.netbeans.modules.maven.repository.ui.ArtifactMultiViewFactory$1
     [exec] java.lang.ClassNotFoundException: org.slf4j.MarkerFactory cannot be found by org.apache.commons.logging_1.3.1
     [exec]     at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
     [exec]     at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
     [exec]     at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
     [exec]     at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
     [exec]     at org.netbeans.modules.netbinox.NetbinoxLoader.loadClass(NetbinoxLoader.java:55)
     [exec]     at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
     [exec] Caused: java.lang.NoClassDefFoundError: org/slf4j/MarkerFactory
     [exec]     at org.apache.commons.logging.impl.Slf4jLogFactory.<clinit>(Slf4jLogFactory.java:255)
     [exec]     at java.base/java.lang.Class.forName0(Native Method)
     [exec]     at java.base/java.lang.Class.forName(Class.java:421)
     [exec]     at java.base/java.lang.Class.forName(Class.java:412)
     [exec]     at org.apache.commons.logging.LogFactory.createFactory(LogFactory.java:419)
     [exec]     at org.apache.commons.logging.LogFactory.lambda$newFactory$3(LogFactory.java:1432)
     [exec]     at java.base/java.security.AccessController.doPrivileged(AccessController.java:319)
     [exec]     at org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:1431)
     [exec]     at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:934)
     [exec]     at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:987)
     [exec]     at org.apache.http.conn.ssl.AbstractVerifier.<init>(AbstractVerifier.java:61)
     [exec]     at org.apache.http.conn.ssl.AllowAllHostnameVerifier.<init>(AllowAllHostnameVerifier.java:44)
     [exec]     at org.apache.http.conn.ssl.AllowAllHostnameVerifier.<clinit>(AllowAllHostnameVerifier.java:46)
     [exec]     at org.apache.http.conn.ssl.SSLConnectionSocketFactory.<clinit>(SSLConnectionSocketFactory.java:151)
     [exec]     at org.eclipse.aether.transport.http.GlobalState.newConnectionManager(GlobalState.java:169)
     [exec]     at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
     [exec]     at org.eclipse.aether.transport.http.GlobalState.getConnectionManager(GlobalState.java:145)
     [exec]     at org.eclipse.aether.transport.http.LocalState.<init>(LocalState.java:62)
     [exec]     at org.eclipse.aether.transport.http.HttpTransporter.<init>(HttpTransporter.java:197)
     [exec]     at org.eclipse.aether.transport.http.HttpTransporterFactory.newInstance(HttpTransporterFactory.java:95)
     [exec]     at org.eclipse.aether.internal.impl.DefaultTransporterProvider.newTransporter(DefaultTransporterProvider.java:

indicates, that commons-logging tries to load slf4j to handle logging,
but fails. Running with
"-J-Dorg.apache.commons.logging.diagnostics.dest=STDERR"
supports that conclusion:

[LogFactory from org.netbeans.modules.netbinox.NetbinoxLoader@244303269] [ENV] Extension directories (java.ext.dir): null
[LogFactory from org.netbeans.modules.netbinox.NetbinoxLoader@244303269] [ENV] Application classpath (java.class.path): /home/matthias/src/netbeans/nbbuild/netbeans/platform/lib/boot.jar:/home/matthias/src/netbeans/nbbuild/netbeans/platform/lib/org-openide-modules.jar:/home/matthias/src/netbeans/nbbuild/netbeans/platform/lib/org-openide-util.jar:/home/matthias/src/netbeans/nbbuild/netbeans/platform/lib/org-openide-util-lookup.jar:/home/matthias/src/netbeans/nbbuild/netbeans/platform/lib/org-openide-util-ui.jar
[LogFactory from org.netbeans.modules.netbinox.NetbinoxLoader@244303269] [ENV] Class org.apache.commons.logging.LogFactory was loaded via class loader org.netbeans.modules.netbinox.NetbinoxLoader@244303269
[LogFactory from org.netbeans.modules.netbinox.NetbinoxLoader@244303269] [ENV] Ancestry of class loader which loaded org.apache.commons.logging.LogFactory is org.netbeans.modules.netbinox.NetbinoxLoader@244303269 == 'NetbinoxLoader delegating to org.apache.commons.logging_1.3.1'
[LogFactory from org.netbeans.modules.netbinox.NetbinoxLoader@244303269] [ENV] Ancestry of class loader which loaded org.apache.commons.logging.LogFactory is ClassLoader tree:org.netbeans.modules.netbinox.NetbinoxLoader@244303269 --> jdk.internal.loader.ClassLoaders$PlatformClassLoader@1922830567 --> BOOT
[LogFactory from org.netbeans.modules.netbinox.NetbinoxLoader@244303269] BOOTSTRAP COMPLETED
[LogFactory from org.netbeans.modules.netbinox.NetbinoxLoader@244303269] [LOOKUP] LogFactory implementation requested for the first time for context class loader org.codehaus.plexus.classworlds.realm.ClassRealm@1303991949
[LogFactory from org.netbeans.modules.netbinox.NetbinoxLoader@244303269] [LOOKUP] org.codehaus.plexus.classworlds.realm.ClassRealm@1303991949 == 'ClassRealm[project>org.knowm.xchart:xchart:3.8.7, parent: ClassRealm[maven.api, parent: null]]'
[LogFactory from org.netbeans.modules.netbinox.NetbinoxLoader@244303269] [LOOKUP] ClassLoader tree:org.codehaus.plexus.classworlds.realm.ClassRealm@1303991949 --> BOOT
[LogFactory from org.netbeans.modules.netbinox.NetbinoxLoader@244303269] [LOOKUP] No properties file of name 'commons-logging.properties' found.
[LogFactory from org.netbeans.modules.netbinox.NetbinoxLoader@244303269] [LOOKUP] Looking for system property [org.apache.commons.logging.LogFactory] to define the LogFactory subclass to use...
[LogFactory from org.netbeans.modules.netbinox.NetbinoxLoader@244303269] [LOOKUP] No system property [org.apache.commons.logging.LogFactory] defined.
[LogFactory from org.netbeans.modules.netbinox.NetbinoxLoader@244303269] [LOOKUP] Using ServiceLoader  to define the LogFactory subclass to use...
[LogFactory from org.netbeans.modules.netbinox.NetbinoxLoader@244303269] [LOOKUP] No properties file available to determine LogFactory subclass from..
[LogFactory from org.netbeans.modules.netbinox.NetbinoxLoader@244303269] Checking if class 'org.apache.logging.log4j.Logger' is available in class loader org.netbeans.modules.netbinox.NetbinoxLoader@244303269
[LogFactory from org.netbeans.modules.netbinox.NetbinoxLoader@244303269] Failed to load class 'org.apache.logging.log4j.Logger' from class loader org.netbeans.modules.netbinox.NetbinoxLoader@244303269: org.apache.logging.log4j.Logger
[LogFactory from org.netbeans.modules.netbinox.NetbinoxLoader@244303269] Checking if class 'org.slf4j.Logger' is available in class loader org.netbeans.modules.netbinox.NetbinoxLoader@244303269
[LogFactory from org.netbeans.modules.netbinox.NetbinoxLoader@244303269] [LOOKUP] SLF4J detected. Loading the SLF4J LogFactory implementation 'org.apache.commons.logging.impl.Slf4jLogFactory'.
[LogFactory from org.netbeans.modules.netbinox.NetbinoxLoader@244303269] Unable to load factory class via class loader org.codehaus.plexus.classworlds.realm.ClassRealm@1303991949 - trying the class loader associated with this LogFactory.
SEVERE [org.openide.util.RequestProcessor]: Error in RequestProcessor org.netbeans.modules.maven.repository.ui.ArtifactMultiViewFactory$1

3 files changed
tree: eb70bcd2ce221820e5324c024d9682d0c91a1bd8
  1. .github/
  2. apisupport/
  3. contrib/
  4. cpplite/
  5. enterprise/
  6. ergonomics/
  7. extide/
  8. extra/
  9. groovy/
  10. harness/
  11. ide/
  12. java/
  13. javafx/
  14. nb/
  15. nbbuild/
  16. nbi/
  17. php/
  18. platform/
  19. profiler/
  20. rust/
  21. webcommon/
  22. websvccommon/
  23. .asf.yaml
  24. .gitattributes
  25. .gitignore
  26. build.xml
  27. LICENSE
  28. NOTICE
  29. README.md
README.md

Apache NetBeans

Apache NetBeans is an open source development environment, tooling platform, and application framework.

Build status

  • GitHub actions
    • Build Status
    • Profiler Lib Native Binaries
    • NetBeans Native Execution Libraries
  • Apache Jenkins:
    • Linux: Build Status
    • Windows: Build Status
  • License Status ( Apache Rat and ant verify-libs-and-licenses )
    • Build Status

Requirements

  • Git
  • Ant
  • JDK 17 or above (to build and run NetBeans)

Notes:

  • NetBeans license violation checks are managed via the rat-exclusions.txt file.
  • Set JAVA_HOME and ANT_HOME appropriately or leave them undefined.

Building NetBeans

Build the default release config (See the cluster.config property.)

$ ant build

Build the basic project (mainly Java features):

$ ant -Dcluster.config=basic build

Build the full project (may include clusters which are not be in the release):

$ ant -Dcluster.config=full build

Build the NetBeans Platform:

$ ant -Dcluster.config=platform build

Cleanup:

$ ant -q clean

Notes:

  • You can also use php, enterprise, etc. See the cluster.properties file.
  • Once built, you can simply open individual modules of interest with NetBeans and run/rebuild/debug them like any other project

Generating Javadoc

Build javadoc:

$ ant build javadoc

Note Run javadoc-nb task in Netbeans to run the javadoc build and display it in a web browser.

Running NetBeans

Run the build:

$ ant tryme

Note: Look in nbbuild/netbeans for the NetBeans installation created by the build process.

Get In Touch

Download

Reporting Bugs

Log, Config and Cache Locations

  • start config (JVM settings, default JDK, userdir, cachedir location and more):
    netbeans/etc/netbeans.conf
  • user settings storage (preferences, installed plugins, logs):
    system dependent, see Help -> About for concrete location
  • cache files (maven index, search index etc):
    system dependent, see Help -> About for concrete location
  • default log location (tip: can be inspected via View -> IDE Log):
    $DEFAULT_USERDIR_ROOT/var/log/messages.log

Note: removing/changing the user settings directory will reset NetBeans to first launch defaults

Other Repositories

Full History

The origins of the code in this repository are older than its Apache existence. As such significant part of the history (before the code was donated to Apache) is kept in an independent repository. To fully understand the code you may want to merge the modern and ancient versions together:

$ git clone https://github.com/apache/netbeans.git
$ cd netbeans
$ git log platform/uihandler/arch.xml

This gives you just few log entries including the initial checkin and change of the file headers to Apache. But then the magic comes:

$ git remote add emilian https://github.com/emilianbold/netbeans-releases.git
$ git fetch emilian # this takes a while, the history is huge!
$ git replace 6daa72c98 32042637 # the 1st donation
$ git replace 6035076ee 32042637 # the 2nd donation

When you search the log, or use the blame tool, the full history is available:

$ git log platform/uihandler/arch.xml
$ git blame platform/uihandler/arch.xml

Many thanks to Emilian Bold who converted the ancient history to his Git repository and made the magic possible!