Fuel SDK ETClient在线程" main"中导致异常。显示java.lang.NullPointerException

时间:2016-06-15 19:11:08

标签: java gradle salesforce exacttarget

我知道这是由空值引起的,但是我对java很新,并且不确定为什么它为空。我没有instantiated ETClient正确吗?还是忽略了别的什么?我在类这样的类中使用Salesforce Marketingcloud Java SDK:

package exacttarget.api;

import com.exacttarget.fuelsdk.*;

public class MyClass {

    public static void main(String[] args) {
        try {
          // specifiy client ID and secret
          ETConfiguration configuration = new ETConfiguration();
          configuration.set("clientId", "abc123");
          configuration.set("clientSecret", "xyz");

          // instantiate ETClient object
          ETClient client = new ETClient(configuration); 

          ETFilter myFilter = new ETFilter();

          ETResponse response = client.retrieve(ETSubscriber.class, myFilter);
          System.out.println(response);
        }
        catch (ETSdkException e) {
            e.printStackTrace();
        }
    }

}

它编译(使用Gradle),但是当我运行jar时,我收到以下错误:

log4j:WARN No appenders could be found for logger (com.exacttarget.fuelsdk.ETClient).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" java.lang.NullPointerException
    at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:85)
    at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:218)
    at org.apache.cxf.jaxws.ServiceImpl.initialize(ServiceImpl.java:161)
    at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:129)
    at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:82)
    at javax.xml.ws.Service.<init>(Service.java:77)
    at com.exacttarget.fuelsdk.internal.PartnerAPI.<init>(PartnerAPI.java:49)
    at com.exacttarget.fuelsdk.ETSoapConnection.<init>(ETSoapConnection.java:88)
    at com.exacttarget.fuelsdk.ETSoapConnection.<init>(ETSoapConnection.java:178)
    at com.exacttarget.fuelsdk.ETClient.<init>(ETClient.java:158)
    at exacttarget.api.MyClass.main(MyClass.java:15)

提前感谢您的任何帮助或建议。

0 个答案:

没有答案