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 bu...@apache.org on 2011/09/20 11:03:23 UTC

DO NOT REPLY [Bug 51849] New: LogManager and ipv6 address

https://issues.apache.org/bugzilla/show_bug.cgi?id=51849

             Bug #: 51849
           Summary: LogManager and ipv6 address
           Product: Log4j
           Version: 1.2
          Platform: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: Configurator
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: cbvarun@yahoo.com
    Classification: Unclassified


I am hitting an exception while trying to load the log4j configuration from a
URL whose base is an ipv6 address. 

I debugged this issue for a while but could not find a workaround.
I am confused now (where to file a bug - java or apache) because even though
the code flow is started from LogManager the real issue could be in
com.sun.org.apache.xerces.internal.impl.XMLEntityManager::private static String
expandSystemIdStrictOff(String systemId, String baseSystemId).


import org.apache.log4j.LogManager;
import org.apache.log4j.spi.DefaultRepositorySelector;

public class TestLog4j
{
    public static void main(String[] aInCommandLineParameters)
    {
        LogManager.setRepositorySelector(new
DefaultRepositorySelector(LogManager.getLoggerRepository()), "test");
        LogManager.resetConfiguration();
    }
}

/**
    javac -classpath
C:\Projects\trunk\perfocarta\centrale\libs\log4j\log4j-1.2.15.jar
C:\Users\varbalak\Desktop\TestLog4j.java
    java  -classpath
C:\Projects\trunk\perfocarta\centrale\libs\log4j\log4j-1.2.15.jar;C:\Users\varbalak\Desktop
-Dlog4j.configuration="https://[fe80::92]:443/ucsm/log4j.xml"
C:\Users\varbalak\Desktop\TestLog4j


    log4j:ERROR Could not parse url [https://[fe80::92]:443/ucsm/log4j.xml].
    java.net.MalformedURLException: For input string: ":92%5D:443"
            at java.net.URL.<init>(URL.java:601)
            at java.net.URL.<init>(URL.java:464)
            at java.net.URL.<init>(URL.java:413)
            at
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:650)
            at
com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:186)
            at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:772)
            at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
            at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
            at
com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:235)
            at
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
            at
javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:180)
            at
org.apache.log4j.xml.DOMConfigurator$2.parse(DOMConfigurator.java:690)
            at
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:789)
            at
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:696)
            at
org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:471)
            at org.apache.log4j.LogManager.<clinit>(LogManager.java:125)
            at TestLog4j.main(TestLog4j.java:8)
    Press any key to continue . . .

*/

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 51849] LogManager and ipv6 address

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51849

--- Comment #2 from Varun Balakrishnan <cb...@yahoo.com> 2011-09-20 13:22:25 UTC ---
(In reply to comment #1)
> What version of Java are you using? "java -version"

java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) Server VM (build 16.0-b13, mixed mode)

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 51849] LogManager and ipv6 address

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51849

--- Comment #5 from Gary Gregory <gg...@seagullsw.com> 2011-09-20 18:45:19 UTC ---
Ah, right, sorry!

How about testing with the latest version of Xerces instead of the old one
bundled in the JRE?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 51849] LogManager and ipv6 address

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51849

--- Comment #6 from Gary Gregory <gg...@seagullsw.com> 2011-09-20 19:01:28 UTC ---
FYI, here is the implementation of the method in Xerces 2.11.0:

    private static String expandSystemIdStrictOff(String systemId, String
baseSystemId)
        throws URI.MalformedURIException {

        URI systemURI = new URI(systemId, true);
        // If it's already an absolute one, return it
        if (systemURI.isAbsoluteURI()) {
            if (systemURI.getScheme().length() > 1) {
                return systemId;
            }
            /** 
             * If the scheme's length is only one character,
             * it's likely that this was intended as a file
             * path. Fixing this up in expandSystemId to
             * maintain backwards compatibility.
             */
            throw new URI.MalformedURIException();
        }

        // If there isn't a base URI, use the working directory
        URI baseURI = null;
        if (baseSystemId == null || baseSystemId.length() == 0) {
            baseURI = getUserDir();
        }
        else {
            baseURI = new URI(baseSystemId, true);
            if (!baseURI.isAbsoluteURI()) {
                // assume "base" is also a relative uri
                baseURI.absolutize(getUserDir());
            }
        }

        // absolutize the system identifier using the base URI
        systemURI.absolutize(baseURI);

        // return the string rep of the new uri (an absolute one)
        return systemURI.toString();

        // if any exception is thrown, it'll get thrown to the caller.

    } // expandSystemIdStrictOff(String,String):String

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 51849] LogManager and ipv6 address

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51849

--- Comment #7 from Varun Balakrishnan <cb...@yahoo.com> 2011-09-21 06:16:10 UTC ---
(In reply to comment #6)
> FYI, here is the implementation of the method in Xerces 2.11.0:
> 
>     private static String expandSystemIdStrictOff(String systemId, String
> baseSystemId)
>         throws URI.MalformedURIException {
> 
>         URI systemURI = new URI(systemId, true);
>         // If it's already an absolute one, return it
>         if (systemURI.isAbsoluteURI()) {
>             if (systemURI.getScheme().length() > 1) {
>                 return systemId;
>             }
>             /** 
>              * If the scheme's length is only one character,
>              * it's likely that this was intended as a file
>              * path. Fixing this up in expandSystemId to
>              * maintain backwards compatibility.
>              */
>             throw new URI.MalformedURIException();
>         }
> 
>         // If there isn't a base URI, use the working directory
>         URI baseURI = null;
>         if (baseSystemId == null || baseSystemId.length() == 0) {
>             baseURI = getUserDir();
>         }
>         else {
>             baseURI = new URI(baseSystemId, true);
>             if (!baseURI.isAbsoluteURI()) {
>                 // assume "base" is also a relative uri
>                 baseURI.absolutize(getUserDir());
>             }
>         }
> 
>         // absolutize the system identifier using the base URI
>         systemURI.absolutize(baseURI);
> 
>         // return the string rep of the new uri (an absolute one)
>         return systemURI.toString();
> 
>         // if any exception is thrown, it'll get thrown to the caller.
> 
>     } // expandSystemIdStrictOff(String,String):String



1) I downloaded Xerces 2.11.0 and added to my application classpath
2) What I observed was, neither the log4j initialization nor my application
started with log4j.configuration="https://[fe80::92]:443/ucsm/log4j.xml"
3) Everything was fine when log4j.configuration="https://<ipv4
address>:80/ucsm/log4j.xml"

I will debug more and let you know once I have something concrete. Thanks for
your support.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 51849] LogManager and ipv6 address

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51849

--- Comment #8 from Varun Balakrishnan <cb...@yahoo.com> 2011-09-21 06:44:47 UTC ---
(In reply to comment #7)
> (In reply to comment #6)
> > FYI, here is the implementation of the method in Xerces 2.11.0:
> > 
> >     private static String expandSystemIdStrictOff(String systemId, String
> > baseSystemId)
> >         throws URI.MalformedURIException {
> > 
> >         URI systemURI = new URI(systemId, true);
> >         // If it's already an absolute one, return it
> >         if (systemURI.isAbsoluteURI()) {
> >             if (systemURI.getScheme().length() > 1) {
> >                 return systemId;
> >             }
> >             /** 
> >              * If the scheme's length is only one character,
> >              * it's likely that this was intended as a file
> >              * path. Fixing this up in expandSystemId to
> >              * maintain backwards compatibility.
> >              */
> >             throw new URI.MalformedURIException();
> >         }
> > 
> >         // If there isn't a base URI, use the working directory
> >         URI baseURI = null;
> >         if (baseSystemId == null || baseSystemId.length() == 0) {
> >             baseURI = getUserDir();
> >         }
> >         else {
> >             baseURI = new URI(baseSystemId, true);
> >             if (!baseURI.isAbsoluteURI()) {
> >                 // assume "base" is also a relative uri
> >                 baseURI.absolutize(getUserDir());
> >             }
> >         }
> > 
> >         // absolutize the system identifier using the base URI
> >         systemURI.absolutize(baseURI);
> > 
> >         // return the string rep of the new uri (an absolute one)
> >         return systemURI.toString();
> > 
> >         // if any exception is thrown, it'll get thrown to the caller.
> > 
> >     } // expandSystemIdStrictOff(String,String):String
> 
> 
> 
> 1) I downloaded Xerces 2.11.0 and added to my application classpath
> 2) What I observed was, neither the log4j initialization nor my application
> started with log4j.configuration="https://[fe80::92]:443/ucsm/log4j.xml"
> 3) Everything was fine when log4j.configuration="https://<ipv4
> address>:80/ucsm/log4j.xml"
> 
> I will debug more and let you know once I have something concrete. Thanks for
> your support.


The URL (ipv6 address part) I was trying to connect was no longer existing when
I tried with Xerces 2.11.0. I think something is working now. I do not get the
parser error for the URL but there is something wrong with the client side
logging. I will explore more.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 51849] LogManager and ipv6 address

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51849

--- Comment #3 from Gary Gregory <gg...@seagullsw.com> 2011-09-20 16:06:08 UTC ---
This works for me:

    @Test
    public void test() throws MalformedURLException {
        new URL("https://[fe80::92]:443/ucsm/log4j.xml");
    }

with:

Java version: 1.6.0_24, vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jdk1.6.0_24\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

Make sure you are calling the JRE you really think you are. You could also test
with the latest JRE.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


Re: DO NOT REPLY [Bug 51849] LogManager and ipv6 address

Posted by Gary Gregory <GG...@seagullsoftware.com>.
What happens if you use the current version of xerces?

Gary

On Sep 20, 2011, at 12:52, "bugzilla@apache.org" <bu...@apache.org> wrote:

> https://issues.apache.org/bugzilla/show_bug.cgi?id=51849
> 
> --- Comment #4 from Varun Balakrishnan <cb...@yahoo.com> 2011-09-20 16:52:13 UTC ---
> (In reply to comment #3)
>> This works for me:
>> 
>>    @Test
>>    public void test() throws MalformedURLException {
>>        new URL("https://[fe80::92]:443/ucsm/log4j.xml");
>>    }
>> 
>> with:
>> 
>> Java version: 1.6.0_24, vendor: Sun Microsystems Inc.
>> Java home: C:\Program Files\Java\jdk1.6.0_24\jre
>> Default locale: en_US, platform encoding: Cp1252
>> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
>> 
>> Make sure you are calling the JRE you really think you are. You could also test
>> with the latest JRE.
> 
> As I have mentioned in my bug report,
> 
> com.sun.org.apache.xerces.internal.impl.XMLEntityManager::private static String
> expandSystemIdStrictOff(String systemId, String baseSystemId) removes both left
> and right square brackets and replaces those with %5B and %5D respectively at
> some point of time. This happens during the initialization. So the string
> passed to URL would be "https://%5Bfe80::92%5D:443/ucsm/log4j.xml" and this
> fails.
> 
> -- 
> Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are the assignee for the bug.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 

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


DO NOT REPLY [Bug 51849] LogManager and ipv6 address

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51849

--- Comment #4 from Varun Balakrishnan <cb...@yahoo.com> 2011-09-20 16:52:13 UTC ---
(In reply to comment #3)
> This works for me:
> 
>     @Test
>     public void test() throws MalformedURLException {
>         new URL("https://[fe80::92]:443/ucsm/log4j.xml");
>     }
> 
> with:
> 
> Java version: 1.6.0_24, vendor: Sun Microsystems Inc.
> Java home: C:\Program Files\Java\jdk1.6.0_24\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
> 
> Make sure you are calling the JRE you really think you are. You could also test
> with the latest JRE.

As I have mentioned in my bug report,

com.sun.org.apache.xerces.internal.impl.XMLEntityManager::private static String
expandSystemIdStrictOff(String systemId, String baseSystemId) removes both left
and right square brackets and replaces those with %5B and %5D respectively at
some point of time. This happens during the initialization. So the string
passed to URL would be "https://%5Bfe80::92%5D:443/ucsm/log4j.xml" and this
fails.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 51849] LogManager and ipv6 address

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51849

Gary Gregory <gg...@seagullsw.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|                            |All

--- Comment #1 from Gary Gregory <gg...@seagullsw.com> 2011-09-20 12:13:19 UTC ---
What version of Java are you using? "java -version"

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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