0

I know this is caused by a null value, however I'm not sure why it's null. Have I not instantiated ETClient correctly? Or overlooked something else?

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();
        }
    }
}

It compiles, using Gradle for the build. But when I run the 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(FetchBounces.java:15)

Thanks in advance for any help or suggestions.

  • What exactly are you wanting to retrieve? You're not setting any attributes on the myFilter object before you immediately attempt a retrieve. – Adam Spriggs Jun 16 '16 at 11:28
  • I'll eventually want to retrieve a few different things, but I'll be starting with retrieving an individual by their email. This error makes me thing I'm not instantiating the ETClient correctly, but from what I am seeing in the docs it looks correct. Is there something missing? – SFETUser Jun 16 '16 at 15:49
0

I faced same error, and I solve it. It seems some resource is conflicting between depending on libs.

I imagine you create one jar-file gathering all libs. If you change the build to refer jars using class-path, it will works.

jar {
    exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
    manifest {
        attributes 'Implementation-Title': 'title',
                   'Implementation-Version': 1.0,
                   'Main-Class' : 'your main class',
                   'Class-Path' : 'every reference jars'
                   }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.