Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-beta3
    • Fix Version/s: 2.0-beta3
    • Component/s: None
    • Labels:
      None

      Description

      tested with trunk r1405641.

      java.lang.NullPointerException
      	at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:102)
      	at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:73)
      	at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:30)
      	at org.apache.logging.log4j.LogManager.getContext(LogManager.java:247)
      	at org.slf4j.helpers.Log4JLoggerFactory$PrivateManager.getContext(Log4JLoggerFactory.java:103)
      	at org.slf4j.helpers.Log4JLoggerFactory.getContext(Log4JLoggerFactory.java:89)
      	at org.slf4j.helpers.Log4JLoggerFactory.getLogger(Log4JLoggerFactory.java:45)
      

        Activity

        Hide
        Ralph Goers added a comment -

        Based on your comment I am marking this resolved. Please close it if you agree.

        Show
        Ralph Goers added a comment - Based on your comment I am marking this resolved. Please close it if you agree.
        Hide
        Olivier Lamy (*$^¨%`£) added a comment -

        Tested and works fine. I will test LOG4J2-105 next week (vacations now )

        Show
        Olivier Lamy (*$^¨%`£) added a comment - Tested and works fine. I will test LOG4J2-105 next week (vacations now )
        Hide
        Ralph Goers added a comment -

        Yes, I think so. However, I checked in a fix that should at least avoid the NPE. However, it will probably result in just using the default LoggerContext, which for Maven is probably OK.

        Show
        Ralph Goers added a comment - Yes, I think so. However, I checked in a fix that should at least avoid the NPE. However, it will probably result in just using the default LoggerContext, which for Maven is probably OK.
        Hide
        Olivier Lamy (*$^¨%`£) added a comment -

        hehe (that's just the output of mvn -v)

        Do you have enough informations to reproduce ?

        Show
        Olivier Lamy (*$^¨%`£) added a comment - hehe (that's just the output of mvn -v) Do you have enough informations to reproduce ?
        Hide
        Ralph Goers added a comment -

        Thanks, Olivier. I'm still running Lion. It probably won't make a difference but at least you've given me one more excuse to do the upgrade! Hopefully the locale won't make a difference for this error.

        Show
        Ralph Goers added a comment - Thanks, Olivier. I'm still running Lion. It probably won't make a difference but at least you've given me one more excuse to do the upgrade! Hopefully the locale won't make a difference for this error.
        Hide
        Olivier Lamy (*$^¨%`£) added a comment -

        Informations:

        Java version: 1.6.0_37, vendor: Apple Inc.
        Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
        Default locale: fr_FR, platform encoding: MacRoman
        OS name: "mac os x", version: "10.8.2", arch: "x86_64", family: "mac"

        Show
        Olivier Lamy (*$^¨%`£) added a comment - Informations: Java version: 1.6.0_37, vendor: Apple Inc. Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home Default locale: fr_FR, platform encoding: MacRoman OS name: "mac os x", version: "10.8.2", arch: "x86_64", family: "mac"
        Hide
        Ralph Goers added a comment -

        Thanks. I will give that a try. What OS, JDK vendor and version were you using?

        Ralph

        Show
        Ralph Goers added a comment - Thanks. I will give that a try. What OS, JDK vendor and version were you using? Ralph
        Hide
        Olivier Lamy (*$^¨%`£) added a comment -

        I tried to use log4j2 with maven trunk.
        Path to apply:

        
        diff --git a/apache-maven/pom.xml b/apache-maven/pom.xml
        index ce547e7..263223f 100644
        --- a/apache-maven/pom.xml
        +++ b/apache-maven/pom.xml
        @@ -83,9 +83,19 @@
               <groupId>org.sonatype.aether</groupId>
               <artifactId>aether-connector-wagon</artifactId>
             </dependency>
        -    <dependency>
        +    <!--dependency>
               <groupId>org.slf4j</groupId>
               <artifactId>slf4j-simple</artifactId>
        +    </dependency-->
        +    <dependency>
        +      <groupId>org.slf4j</groupId>
        +      <artifactId>slf4j-ext</artifactId>
        +      <version>1.7.2</version>
        +    </dependency>
        +    <dependency>
        +      <groupId>org.apache.logging.log4j.adapters</groupId>
        +      <artifactId>log4j-slf4j-impl</artifactId>
        +      <version>2.0-beta3-SNAPSHOT</version>
             </dependency>
           </dependencies>
         
        diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
        index 3990785..ba69f85 100644
        --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
        +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
        @@ -324,7 +324,7 @@ public class MavenCli
         
                 plexusLoggerManager = new Slf4jLoggerManager();       
                 slf4jLoggerFactory = LoggerFactory.getILoggerFactory();
        -        slf4jLogger = slf4jLoggerFactory.getLogger(this.getClass().getName());
        +        slf4jLogger = LoggerFactory.getLogger(this.getClass().getName());
             }
         
             private void version( CliRequest cliRequest )
        

        Then put a log4j2.xml in apache-maven/src/conf/logging/log4j2.xml
        svn path: http://svn.apache.org/repos/asf/maven/maven-3/trunk/

        Show
        Olivier Lamy (*$^¨%`£) added a comment - I tried to use log4j2 with maven trunk. Path to apply: diff --git a/apache-maven/pom.xml b/apache-maven/pom.xml index ce547e7..263223f 100644 --- a/apache-maven/pom.xml +++ b/apache-maven/pom.xml @@ -83,9 +83,19 @@ <groupId>org.sonatype.aether</groupId> <artifactId>aether-connector-wagon</artifactId> </dependency> - <dependency> + <!--dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> + </dependency--> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-ext</artifactId> + <version>1.7.2</version> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j.adapters</groupId> + <artifactId>log4j-slf4j-impl</artifactId> + <version>2.0-beta3-SNAPSHOT</version> </dependency> </dependencies> diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index 3990785..ba69f85 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -324,7 +324,7 @@ public class MavenCli plexusLoggerManager = new Slf4jLoggerManager(); slf4jLoggerFactory = LoggerFactory.getILoggerFactory(); - slf4jLogger = slf4jLoggerFactory.getLogger( this .getClass().getName()); + slf4jLogger = LoggerFactory.getLogger( this .getClass().getName()); } private void version( CliRequest cliRequest ) Then put a log4j2.xml in apache-maven/src/conf/logging/log4j2.xml svn path: http://svn.apache.org/repos/asf/maven/maven-3/trunk/
        Hide
        Ralph Goers added a comment -

        I can see what is probably causing the NPE but can you provide any more information on the environment. I would really like to create a unit test for this. From what I can tell I am guessing you aren't using the Sun JVM and you do have a security manager enabled.

        Show
        Ralph Goers added a comment - I can see what is probably causing the NPE but can you provide any more information on the environment. I would really like to create a unit test for this. From what I can tell I am guessing you aren't using the Sun JVM and you do have a security manager enabled.

          People

          • Assignee:
            Ralph Goers
            Reporter:
            Olivier Lamy (*$^¨%`£)
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development