You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2014/11/29 18:51:12 UTC

[jira] [Resolved] (LOG4J2-834) NoClassDefFoundError in ThrowableProxy

     [ https://issues.apache.org/jira/browse/LOG4J2-834?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Gregory resolved LOG4J2-834.
---------------------------------
       Resolution: Fixed
    Fix Version/s: 2.2

I added a test for this ticket just like the one attached in the patch. This is already fixed but we show with this test that the use case from the JIRA is handled. Please build from git master and try again.

I also just pushed a 2.2-SNAPSHOT build to the SNAPSHOT repo (https://repository.apache.org/content/repositories/snapshots/), you can try that too and report back here please.

Thank you,
Gary

> NoClassDefFoundError in ThrowableProxy
> --------------------------------------
>
>                 Key: LOG4J2-834
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-834
>             Project: Log4j 2
>          Issue Type: Bug
>            Reporter: Nikita Koval
>             Fix For: 2.2
>
>         Attachments: 0001-LOG4J2-834-Ignores-NoClassDefFoundError-and-other-Th.patch, ForceNoDefClassFoundError.java, InexistentInterface.java
>
>
> In method *loadClass* we expect {{ClassNotFoundException}}. But if class comes from another java machine we can get {{NoClassDefFoundError}}.
> Possible fix:
> {code:java}
> private Class<?> loadClass(final ClassLoader lastLoader, final String className) {
>        // XXX: this is overly complicated
>        Class<?> clazz;
>        if (lastLoader != null) {
>            try {
>                clazz = Loader.initializeClass(className, lastLoader);
>                if (clazz != null) {
>                    return clazz;
>                }
>            } catch (final Throwable ignore) {
>                // Ignore exception.
>            }
>        }
>        try {
>            clazz = Loader.loadClass(className);
>        } catch (final ClassNotFoundException | LinkageError ignored) {
>            try {
>                clazz = Loader.initializeClass(className, this.getClass().getClassLoader());
>            } catch (final ClassNotFoundException | LinkageError ignore) {
>                return null;
>            }
>        }
>        return clazz;
>    }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org