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

Xilai Dai commented on KARAF-5333:
----------------------------------

Thanks a lot! Freeman

I've already tried "chcp 437" and "chcp 936" before start Karaf 4.1.2 (see my 
first comment on this jira some test results we did for different Win OS/Env), 
the only working case is "Windows 10 English version, CodePage 936, Karaf 
console display OK", in other case, even the UnsupportedCharsetException not 
happening, but console display still a problem, many unprintable characters.

Interesting thing is the Karaf 4.1.1 console display works well even on the 
same test machine (Windows 7 English version, CodePage 65001).

Changing the Locale setting I think it's something most of the user couldn't 
accept.

And the "-Dfile.encoding=utf-8" has no help for the UnsupportedCharsetException 
and console display. but "-Dsun.stdout.encoding=utf-8 
-Dsun.stderr.encoding=utf-8" can be used to get rid of the 
UnsupportedCharsetException but the console display problem still can't be 
solved.
{code}
        __ __                  ____
       / //_/____ __________ _/ __/
      / ,<  / __ `/ ___/ __ `/ /_
     / /| |/ /_/ / /  / /_/ / __/
    /_/ |_|\__,_/_/   \__,_/_/

  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
�─────────────────────────────────────────────────────────────────
28 │ Active │  80 │ 4.1.2   │ Apache Karaf :: OSGi Services :: Event
�───────────────────
28 │ Active │  80 │ 4.1.2   │ Apache Karaf :: OSGi Services :: Event
  │ Apache Karaf :: OSGi Services :: Event

karaf@root()>
{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)

Reply via email to