foxinmy / weixin4j

(微信开发工具包)weixin sdk for Java
Other
817 stars 448 forks source link

Init WeixinPayProxy failed #154

Closed sutra closed 6 years ago

sutra commented 6 years ago

Version 1.8.0

package com.oxerr.sandbox.weixin4j;

import com.foxinmy.weixin4j.payment.WeixinPayProxy;

public class WeixinPayProxyDemo {

    public static void main(String[] args) {
        // WeixinPayProxy wpp = new WeixinPayProxy();
        System.out.println(WeixinPayProxy.VERSION);
    }

}

Exception:

Exception in thread "main" java.lang.ExceptionInInitializerError
    at com.foxinmy.weixin4j.payment.WeixinPayProxy.<clinit>(WeixinPayProxy.java:846)
    at com.oxerr.sandbox.weixin4j.WeixinPayProxyDemo.main(WeixinPayProxyDemo.java:9)
Caused by: java.lang.NullPointerException
    at java.util.Properties$LineReader.readLine(Properties.java:434)
    at java.util.Properties.load0(Properties.java:353)
    at java.util.Properties.load(Properties.java:341)
    at com.foxinmy.weixin4j.util.Consts.loadProperties(Consts.java:23)
    at com.foxinmy.weixin4j.util.Consts.<clinit>(Consts.java:32)
    ... 2 more
sutra commented 6 years ago

这个问题只在 weixin4j 以 jar 的形式引入时才会发生,如果是解压缩状态的 classes 则不会发生。

sutra commented 6 years ago

By the way, this issue is introduced in #150