DeemOpen/zkui

Can not work in JDK1.8 environment, startup happen error : Exception in thread "main" java.lang.IllegalArgumentException: Malformed \uxxxx encoding.

tiandong19860806 opened this issue · 2 comments

Hi ,
When I run the zkui in JDK 1.8, the zkui happen error as below:

[root@CNT7XZKPD02 zkui-2.0]# java -jar ./zkui-2.0-SNAPSHOT-jar-with-dependencies.jar
Exception in thread "main" java.lang.IllegalArgumentException: Malformed \uxxxx encoding.
at java.util.Properties.loadConvert(Properties.java:574)
at java.util.Properties.load0(Properties.java:391)
at java.util.Properties.load(Properties.java:341)
at com.deem.zkui.Main.main(Main.java:54)

Note:

  1. OS system : CentOS 7.4 x64
  2. JKD : java version "1.8.0_231"
  3. ZooKeeper: 3.6.1

Picture as below:

  1. zkui startup error
    image

  2. zkui config.cfg
    image

  3. zkui build result success
    image

Hi @gitorko

 Maybe the class Main.java has a path issue , which is happen only in Linux and windows 10.

such as below,

  1. fix before is Error
    File f = new File("config.cfg");
    if (f.exists()) {
    globalProps.load(new FileInputStream("config.cfg"));
    }

  2. fix after is OK
    String appConfPath = System.getenv("ZKUI_HOME");
    if(appConfPath == null || appConfPath.length() == 0) {
    System.out.println("env parameter ZKUI_HOME isn't set, such as ZKUI_HOME=/opt/zkui/zkui-2.0/ or actual path of zkui install");
    System.exit(1);
    }
    appConfPath = appConfPath + "config.cfg";
    File f = new File(appConfPath);
    if (f.exists()) {
    globalProps.load(new FileInputStream(appConfPath));
    } else {
    System.out.println("Please create config.cfg properties file and then execute the program!");
    System.exit(1);
    }

  3. fix after is OK
    image

  4. and deploy in CentOS is OK

01

image

note, a service to setting zkui

5. 设置开机自动启动,如下

cat > /etc/systemd/system/zkui.service <<EOF
[Unit]
Description=zkui-2.0 service
After=network.target
After=network-online.target
Wants=network-online.target

[Service]
User=zookeeper
Type=forking
TimeoutSec=0
Environment="ZKUI_HOME=/app/zkui/zkui-2.0/"
ExecStart=${JAVA_HOME}/bin/java -Xms128m -Xmx512m -XX:MaxMetaspaceSize=256m -jar /app/zkui/zkui-2.0/zkui-2.0-SNAPSHOT-jar-with-dependencies.jar
RestartSec=5
LimitNOFILE=1000000

[Install]
WantedBy=multi-user.target
EOF

image