[ 
https://issues.apache.org/jira/browse/LOG4J2-832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14137331#comment-14137331
 ] 

Seth Leger commented on LOG4J2-832:
-----------------------------------

What JDK are you using when the test passes? I think that this behavior was 
introduced in later patches for Java 6 and Java 7. According to this code in 
Java 7u40, they added a static initializer to Trampoline that is throwing the 
error that I see on my Java 7 system:

http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7u40-b43/sun/reflect/misc/MethodUtil.java#MethodUtil

{code:java}
class Trampoline {
     static {
         if (Trampoline.class.getClassLoader() == null) {
             throw new Error(
                 "Trampoline must not be defined by the bootstrap classloader");
         }
     }
...
}
{code}

Another person in my office is running the test on Java 6u65 and also gets an 
exception, although the exception is different (NoClassDefFoundError).

> ThrowableProxy fails if sun.reflect.misc.Trampoline is in logged stack trace
> ----------------------------------------------------------------------------
>
>                 Key: LOG4J2-832
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-832
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0, 2.0.2
>         Environment: Java 1.7u60, Java 1.7u25
>            Reporter: Seth Leger
>            Priority: Blocker
>         Attachments: LOG4J2-832.patch, Log4j2MethodUtilTrampolineTest.java, 
> Log4j2MethodUtilTrampolineTest.java, ggregory-log4j2.patch, pom.xml
>
>
> When the Logger attempts to log a message with an exception stack trace, it 
> uses the ThrowableProxy class to introspect classes in the stack trace frames.
> If the class sun.reflect.misc.Trampoline is in the stack trace, the 
> introspection performed by ThrowableProxy will fail causing a java.lang.Error 
> to be thrown by the Logger call.
> The sun.reflect.misc.Trampoline class is used by the 
> sun.reflect.misc.MethodUtil class to perform reflection-based method 
> invocations. MethodUtil is widely used by libraries to perform method 
> invocations. I've encountered this problem when invoking methods over JMX and 
> inside Jetty.
> I am classifying this as a blocker because it means that any logging 
> statement that is logging a Throwable message containing a MethodUtil-based 
> reflection stack trace can cause a java.lang.Error to be thrown by Log4j2. 
> I will attach a unit test for this failure.



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

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

Reply via email to