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 "Olivier Lamy (*$^¨%`£ JIRA)" <ji...@apache.org> on 2012/11/04 22:32:11 UTC

[jira] [Created] (LOG4J2-108) NPE ClassLoaderContextSelector

Olivier Lamy (*$^¨%`£) created LOG4J2-108:
---------------------------------------------

             Summary: NPE ClassLoaderContextSelector
                 Key: LOG4J2-108
                 URL: https://issues.apache.org/jira/browse/LOG4J2-108
             Project: Log4j 2
          Issue Type: Bug
    Affects Versions: 2.0-beta3
            Reporter: Olivier Lamy (*$^¨%`£)


tested with trunk r1405641.
{code}
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)
{code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Commented] (LOG4J2-108) NPE ClassLoaderContextSelector

Posted by "Olivier Lamy (*$^¨%`£ JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490742#comment-13490742 ] 

Olivier Lamy (*$^¨%`£) commented on LOG4J2-108:
-----------------------------------------------

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"

                
> NPE ClassLoaderContextSelector
> ------------------------------
>
>                 Key: LOG4J2-108
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-108
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.0-beta3
>            Reporter: Olivier Lamy (*$^¨%`£)
>
> tested with trunk r1405641.
> {code}
> 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)
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Commented] (LOG4J2-108) NPE ClassLoaderContextSelector

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490752#comment-13490752 ] 

Ralph Goers commented on LOG4J2-108:
------------------------------------

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.
                
> NPE ClassLoaderContextSelector
> ------------------------------
>
>                 Key: LOG4J2-108
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-108
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.0-beta3
>            Reporter: Olivier Lamy (*$^¨%`£)
>
> tested with trunk r1405641.
> {code}
> 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)
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Commented] (LOG4J2-108) NPE ClassLoaderContextSelector

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490655#comment-13490655 ] 

Ralph Goers commented on LOG4J2-108:
------------------------------------

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

Ralph
                
> NPE ClassLoaderContextSelector
> ------------------------------
>
>                 Key: LOG4J2-108
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-108
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.0-beta3
>            Reporter: Olivier Lamy (*$^¨%`£)
>
> tested with trunk r1405641.
> {code}
> 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)
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Commented] (LOG4J2-108) NPE ClassLoaderContextSelector

Posted by "Olivier Lamy (*$^¨%`£ JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490746#comment-13490746 ] 

Olivier Lamy (*$^¨%`£) commented on LOG4J2-108:
-----------------------------------------------

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

Do you have enough informations to reproduce ?
                
> NPE ClassLoaderContextSelector
> ------------------------------
>
>                 Key: LOG4J2-108
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-108
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.0-beta3
>            Reporter: Olivier Lamy (*$^¨%`£)
>
> tested with trunk r1405641.
> {code}
> 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)
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Commented] (LOG4J2-108) NPE ClassLoaderContextSelector

Posted by "Olivier Lamy (*$^¨%`£ JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490572#comment-13490572 ] 

Olivier Lamy (*$^¨%`£) commented on LOG4J2-108:
-----------------------------------------------

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

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 )
{code}
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/

                
> NPE ClassLoaderContextSelector
> ------------------------------
>
>                 Key: LOG4J2-108
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-108
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.0-beta3
>            Reporter: Olivier Lamy (*$^¨%`£)
>
> tested with trunk r1405641.
> {code}
> 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)
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Commented] (LOG4J2-108) NPE ClassLoaderContextSelector

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490743#comment-13490743 ] 

Ralph Goers commented on LOG4J2-108:
------------------------------------

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.
                
> NPE ClassLoaderContextSelector
> ------------------------------
>
>                 Key: LOG4J2-108
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-108
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.0-beta3
>            Reporter: Olivier Lamy (*$^¨%`£)
>
> tested with trunk r1405641.
> {code}
> 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)
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Commented] (LOG4J2-108) NPE ClassLoaderContextSelector

Posted by "Olivier Lamy (*$^¨%`£ JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13491377#comment-13491377 ] 

Olivier Lamy (*$^¨%`£) commented on LOG4J2-108:
-----------------------------------------------

Tested and works fine. I will test LOG4J2-105 next week (vacations now :-) )
                
> NPE ClassLoaderContextSelector
> ------------------------------
>
>                 Key: LOG4J2-108
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-108
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.0-beta3
>            Reporter: Olivier Lamy (*$^¨%`£)
>
> tested with trunk r1405641.
> {code}
> 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)
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Resolved] (LOG4J2-108) NPE ClassLoaderContextSelector

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4J2-108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ralph Goers resolved LOG4J2-108.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0-beta3
         Assignee: Ralph Goers

Based on your comment I am marking this resolved. Please close it if you agree.
                
> NPE ClassLoaderContextSelector
> ------------------------------
>
>                 Key: LOG4J2-108
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-108
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.0-beta3
>            Reporter: Olivier Lamy (*$^¨%`£)
>            Assignee: Ralph Goers
>             Fix For: 2.0-beta3
>
>
> tested with trunk r1405641.
> {code}
> 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)
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Commented] (LOG4J2-108) NPE ClassLoaderContextSelector

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490318#comment-13490318 ] 

Ralph Goers commented on LOG4J2-108:
------------------------------------

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.
                
> NPE ClassLoaderContextSelector
> ------------------------------
>
>                 Key: LOG4J2-108
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-108
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.0-beta3
>            Reporter: Olivier Lamy (*$^¨%`£)
>
> tested with trunk r1405641.
> {code}
> 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)
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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