NoClassDefFoundError: IllegalName: [B in JBoss EAP 5.2

Solution Unverified - Updated -

Issue

  • Getting NoClassDefFoundError when using array of bytes:
Caused by: java.lang.NoClassDefFoundError: IllegalName: [B
    at java.lang.ClassLoader.preDefineClass(ClassLoader.java:491)
        ...
    at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClass(JNLPClassLoader.java:1574)
    at org.jboss.invocation.MarshalledValueInputStream.resolveClass(MarshalledValueInputStream.java:101)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1609)
        ...

MarshalledValueInputStream.resolveClass does:

try {
    try to load class (this is where the exception is thrown)
} catch ( ClassNotFoundException e )
    /* Use the super.resolveClass() call which will resolve array classes and primitives... */
}

As this is an array class ([B == array of bytes), it should be falling into that catch.
But it isn't because it's getting a NoClassDefFoundError instead of the ClassNotFoundException it's expecting.

So it looks like MarshalledValueInputStream has a bug in that it depends on a specific implementation detail (throwing CNFE in that use case)
which is not true with the Web Start class loader.

Instead, it should probably look at the class name to determine if it's an array class or a primitive.

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 5.2.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content