Skip to content

Write Exception like "Unsupported class file major version 69" to System.out.err #1171

@chrisrueger

Description

@chrisrueger

Yesterday I was trying to run our app with JDK25 (instead of JDK21) but I noticed that no logging was was working.
We are using Slf4j (2.x), Logback, Aries Spifly (org.apache.aries.spifly:org.apache.aries.spifly.dynamic.bundle:1.3.7 for the slf4j 2.x ServiceLocator stuff) and we upgraded to org.eclipse.platform:org.eclipse.osgi:3.23.200 to fix the Unsafe warnings.

I only saw this on the console:

Okt. 22, 2025 7:14:18 AM org.apache.aries.spifly.BaseActivator log
INFORMATION: Registered provider ch.qos.logback.classic.servlet.LogbackServletContainerInitializer of service jakarta.servlet.ServletContainerInitializer in bundle ch.qos.logback.classic
Okt. 22, 2025 7:14:18 AM org.apache.aries.spifly.BaseActivator log
INFORMATION: Registered provider ch.qos.logback.classic.spi.LogbackServiceProvider of service org.slf4j.spi.SLF4JServiceProvider in bundle ch.qos.logback.classic
Okt. 22, 2025 7:14:18 AM org.apache.aries.spifly.BaseActivator log
INFORMATION: Registered provider org.eclipse.jetty.http.Http1FieldPreEncoder of service org.eclipse.jetty.http.HttpFieldPreEncoder in bundle org.apache.felix.http.jetty
Okt. 22, 2025 7:14:18 AM org.apache.aries.spifly.BaseActivator log
INFORMATION: Registered provider org.eclipse.jetty.http2.hpack.HpackFieldPreEncoder of service org.eclipse.jetty.http.HttpFieldPreEncoder in bundle org.apache.felix.http.jetty
SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
Okt. 22, 2025 7:14:19 AM org.apache.aries.spifly.BaseActivator log

So spifly seems to register the SLF4JServiceProvider but it could not be found.

After endless debugging attempts I finally arrived in this catch-block:

} catch (Throwable t) {
ServiceRegistration<?> errorHook = wovenClass.getErrorHook();
Bundle errorBundle = errorHook != null ? errorHook.getReference().getBundle()
: manager.getGeneration().getRevision().getBundle();
container.getEventPublisher().publishFrameworkEvent(FrameworkEvent.ERROR, errorBundle, t);
// fail hard with a class loading error
ClassFormatError error = new ClassFormatError("Unexpected error from weaving hook."); //$NON-NLS-1$
error.initCause(t);
throw error;
} finally {

for wovenClass org.apache.logging.log4j.util.Activator
with the Error: java.lang.IllegalArgumentException: Unsupported class file major version 69

Image

After turning on Equinox debug logging
I found out via Equinox Debug logging org.eclipse.osgi/debug/loader=true (see how to enable )

I got this


BundleLoader[org.objectweb.asm.tree_9.7.1] found local class org.objectweb.asm.tree.LdcInsnNode 0ms
BundleLoader[org.objectweb.asm.tree_9.7.1].findClass(org.objectweb.asm.tree.UnsupportedClassVersionException)
BundleLoader[org.objectweb.asm.tree_9.7.1].findLocalClass(org.objectweb.asm.tree.UnsupportedClassVersionException)
ModuleClassLoader[org.objectweb.asm.tree_9.7.1 - /Users/me/.m2/repository/org/ow2/asm/asm-tree/9.7.1/asm-tree-9.7.1.jar].findClassImpl(org.objectweb.asm.tree.UnsupportedClassVersionException)
  read 441 bytes from /Users/me/.m2/repository/org/ow2/asm/asm-tree/9.7.1/asm-tree-9.7.1.jar!/org/objectweb/asm/tree/UnsupportedClassVersionException.class

That told me that I had to update the asm libs from 9.7.1 to 9.9:

org.ow2.asm:asm:9.9
org.ow2.asm:asm-commons:9.9
org.ow2.asm:asm-util:9.9
org.ow2.asm:asm-tree:9.9
org.ow2.asm:asm-analysis:9.9

After that the exception was gone.

My question is:
Could we log this exception maybe to System.out.err so that it gets noticed easier? So that it prints to the console similar to the spifly and slf4j log earlier?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions