karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Freeman Fang (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KARAF-5333) UnsupportedCharsetException: cp65001 and unprintable characters from karaf 4.1.2 console
Date Tue, 05 Sep 2017 06:33:02 GMT

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

Freeman Fang commented on KARAF-5333:
-------------------------------------

How is the output of
{code}
public static void main(String[] args) {  
        //当前系统可用字符集SortedMap<String,Charset>   
        Map charSets = Charset.availableCharsets();  
        Iterator it = charSets.keySet().iterator();  
        while (it.hasNext()) {  
            //字符集名  
            String csName = (String) it.next();  
            System.out.print(csName);  
            //charset.aliases()返回字符集别名集合 Set<String>  
            Iterator aliases = ((Charset) charSets.get(csName)).aliases()  
                    .iterator();  
            //显示别名  
            if (aliases.hasNext()) {  
                System.out.print(": ");  
            }  
            while (aliases.hasNext()) {  
                System.out.print(aliases.next());  
                if (aliases.hasNext()) {  
                    System.out.print(", ");  
                }  
            }  
            System.out.println();  
        }  
    }  
{code} ?

>  UnsupportedCharsetException: cp65001 and unprintable characters from karaf 4.1.2 console
> -----------------------------------------------------------------------------------------
>
>                 Key: KARAF-5333
>                 URL: https://issues.apache.org/jira/browse/KARAF-5333
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-shell
>    Affects Versions: 4.1.2
>         Environment: Windows OS, Java 8
>            Reporter: Xilai Dai
>         Attachments: pax-logging-api-1.10.1.jar, pax-logging-log4j2-1.10.1.jar
>
>
> In case of Windows OS and the cp65001 CodePage setting, there is UnsupportedCharsetException:
cp65001 happening and the console display really not good many of the unprintable characters
showing ...
> {code}
> 2017-08-29 11:34:41,204 CM Configuration Updater (Update: pid=org.ops4j.pax.logging)
ERROR Unable to inject fields into
> builder class for plugin type class org.apache.logging.log4j.core.appender.ConsoleAppender,
element Console. java.nio.ch
> arset.UnsupportedCharsetException: cp65001
>         at java.nio.charset.Charset.forName(Charset.java:531)
>         at org.apache.logging.log4j.util.PropertiesUtil.getCharsetProperty(PropertiesUtil.java:146)
>         at org.apache.logging.log4j.util.PropertiesUtil.getCharsetProperty(PropertiesUtil.java:134)
>         at org.apache.logging.log4j.core.appender.ConsoleAppender$Target.getCharset(ConsoleAppender.java:85)
>         at org.apache.logging.log4j.core.appender.ConsoleAppender$Target$1.getDefaultCharset(ConsoleAppender.java:71)
>         at org.apache.logging.log4j.core.appender.ConsoleAppender$Builder.build(ConsoleAppender.java:218)
>         at org.apache.logging.log4j.core.appender.ConsoleAppender$Builder.build(ConsoleAppender.java:185)
>         at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:122)
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:952)
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:892
> )
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:884
> )
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:508)
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:232)
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244)
>         at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545)
>         at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:261)
>         at org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl.doUpdate(PaxLoggingServiceImpl.java:213)
>         at org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl.updated(PaxLoggingServiceImpl.java:158)
>         at org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl$1ManagedPaxLoggingService.updated(PaxLoggingServi
> ceImpl.java:426)
>         at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189)
>         at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152)
>         at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85)
>         at org.apache.felix.cm.impl.ConfigurationManager$UpdateConfiguration.run(ConfigurationManager.java:1776)
>         at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141)
>         at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109)
>         at java.lang.Thread.run(Thread.java:745)
> 2017-08-29 11:34:41,214 CM Configuration Updater (Update: pid=org.ops4j.pax.logging)
ERROR Unable to invoke factory meth
> od in class class org.apache.logging.log4j.core.appender.ConsoleAppender for element
Console. java.lang.IllegalStateExce
> ption: No factory method found for class org.apache.logging.log4j.core.appender.ConsoleAppender
>         at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.findFactoryMethod(PluginBuilder.java:224)
>         at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:130)
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:952)
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:892
> )
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:884
> )
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:508)
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:232)
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244)
>         at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545)
>         at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:261)
>         at org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl.doUpdate(PaxLoggingServiceImpl.java:213)
>         at org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl.updated(PaxLoggingServiceImpl.java:158)
>         at org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl$1ManagedPaxLoggingService.updated(PaxLoggingServi
> ceImpl.java:426)
>         at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189)
>         at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152)
>         at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85)
>         at org.apache.felix.cm.impl.ConfigurationManager$UpdateConfiguration.run(ConfigurationManager.java:1776)
>         at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141)
>         at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109)
>         at java.lang.Thread.run(Thread.java:745)
> 2017-08-29 11:34:41,224 CM Configuration Updater (Update: pid=org.ops4j.pax.logging)
ERROR Null object returned for Cons
> ole in Appenders.
> 2017-08-29 11:34:41,224 CM Configuration Updater (Update: pid=org.ops4j.pax.logging)
ERROR Unable to locate appender "Co
> nsole" for logger config "root"
> 2017-08-29 11:34:42,084 CM Configuration Updater (ManagedService Update: pid=[org.ops4j.pax.logging])
ERROR Unable to in
> ject fields into builder class for plugin type class org.apache.logging.log4j.core.appender.ConsoleAppender,
element Con
> sole. java.nio.charset.UnsupportedCharsetException: cp65001
>         at java.nio.charset.Charset.forName(Charset.java:531)
>         at org.apache.logging.log4j.util.PropertiesUtil.getCharsetProperty(PropertiesUtil.java:146)
>         at org.apache.logging.log4j.util.PropertiesUtil.getCharsetProperty(PropertiesUtil.java:134)
>         at org.apache.logging.log4j.core.appender.ConsoleAppender$Target.getCharset(ConsoleAppender.java:85)
>         at org.apache.logging.log4j.core.appender.ConsoleAppender$Target$1.getDefaultCharset(ConsoleAppender.java:71)
>         at org.apache.logging.log4j.core.appender.ConsoleAppender$Builder.build(ConsoleAppender.java:218)
>         at org.apache.logging.log4j.core.appender.ConsoleAppender$Builder.build(ConsoleAppender.java:185)
>         at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:122)
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:952)
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:892
> )
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:884
> )
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:508)
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:232)
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244)
>         at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545)
>         at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:261)
>         at org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl.doUpdate(PaxLoggingServiceImpl.java:213)
>         at org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl.updated(PaxLoggingServiceImpl.java:158)
>         at org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl$1ManagedPaxLoggingService.updated(PaxLoggingServi
> ceImpl.java:426)
>         at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189)
>         at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152)
>         at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85)
>         at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1463)
>         at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1419)
>         at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141)
>         at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109)
>         at java.lang.Thread.run(Thread.java:745)
> 2017-08-29 11:34:42,094 CM Configuration Updater (ManagedService Update: pid=[org.ops4j.pax.logging])
ERROR Unable to in
> voke factory method in class class org.apache.logging.log4j.core.appender.ConsoleAppender
for element Console. java.lang
> .IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.ConsoleAppender
>         at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.findFactoryMethod(PluginBuilder.java:224)
>         at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:130)
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:952)
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:892
> )
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:884
> )
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:508)
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:232)
>         at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244)
>         at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545)
>         at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:261)
>         at org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl.doUpdate(PaxLoggingServiceImpl.java:213)
>         at org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl.updated(PaxLoggingServiceImpl.java:158)
>         at org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl$1ManagedPaxLoggingService.updated(PaxLoggingServi
> ceImpl.java:426)
>         at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189)
>         at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152)
>         at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85)
>         at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1463)
>         at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1419)
>         at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141)
>         at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109)
>         at java.lang.Thread.run(Thread.java:745)
> 2017-08-29 11:34:42,094 CM Configuration Updater (ManagedService Update: pid=[org.ops4j.pax.logging])
ERROR Null object
> returned for Console in Appenders.
> 2017-08-29 11:34:42,094 CM Configuration Updater (ManagedService Update: pid=[org.ops4j.pax.logging])
ERROR Unable to lo
> cate appender "Console" for logger config "root"
>         __ __                  ____
>        / //_/____ __________ _/ __/
>       / ,<  / __ `/ ___/ __ `/ /_
>      / /| |/ /_/ / /  / /_/ / __/
>     /_/ |_|\__,_/_/   \__,_/_/
>   Apache Karaf (4.1.2)
> Hit '<tab>' for a list of available commands
> and '[cmd] --help' for help on a specific command.
> Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown Karaf.
> karaf@root()> list
> START LEVEL 100 , List Threshold: 50
> ID �� State  �� Lvl �� Version �� Name
> �������੤���������������੤���������੤�����������������੤��������������������������������������������������������������������
> ��������������������������������������������������������������������������������������������������������������
> 28 �� Active ��  80 �� 4.1.2   �� Apache Karaf :: OSGi Services :: Event
>  Event
> {code}
> After "chcp 437", the UnsupportedCharsetException gone but the console display still
looks not good.
> Seems it's only happening on Windows OS (Non English version) with 65001 CodePage. but
karaf 4.1.1 works well on the same machine/ENV. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message