FuelSDK-Java
FuelSDK-Java copied to clipboard
NullPointerException in login
I am using fuel-java-1.0.1. Using the following code for login:
ETConfiguration configuration = new ETConfiguration();
configuration.set("clientId", "my-client-id");
configuration.set("clientSecret", "my-client-secret");
ETClient client = new ETClient(configuration);
Intermittently, it fails with the following exception:
Caused by: java.lang.NullPointerException
at com.exacttarget.fuelsdk.ETClient.<init>(ETClient.java:131) ~[fuel-java-1.0.1.jar:?]
How to resolve the issue?
Will the latest version help?
cross-posted: http://salesforce.stackexchange.com/questions/143160/fuel-sdk-java-nullpointerexception-in-login
Adding soapEndpoint (https://webservice.exacttarget.com/Service.asmx) helped to go further a bit but next execution resulted this exception:
java.lang.NullPointerException
at org.apache.cxf.wsdl11.WSDLServiceFactory.
This is because in ServiceImpl in line 153: Definition e = ((WSDLManager)this.bus.getExtension(WSDLManager.class)).getDefinition(this.wsdlURL);
the ExtensionManagerBus contains the WSDLManager in missingExtensions. Latest SDK (1.2.0) has also this issue.
soapEndpoint is not mandatory, but authEndpoint is. so you need to set that as well if you use ETConfiguration:
configuration.set("authEndpoint", "https://auth.exacttargetapis.com");
Please check out our fuelsdk.properties.template file, we encourage to rename it to fuelsdk.properties and set clientId and clientSecret for ease of use.
Thanks for your reply. :) Unfortunately defining authEndpoint does not make any difference because I get the same error.
This works for me
@robertfarkas-epam i am also hitting the same problem. It is working in my local but when i move the jar to my server and run, am seeing this issue. Were you able to solve the problem. i know its kinda old thread but any help is appreciated
I am also having this issue. Was anyone able to resolve it.
I was just able to resolve this issue. For anyone having a similar issue. The problem is related to the WSDL extensions. When the java application is run from an IDE and not packaged JAR it loads 14 Extensions and when it is run from the JAR it loads only 8 extension and throws an exception when it tries to load the WSDLFactoryManager. I was using shade for building the JAR the following configuration worked for me added to the transformer section of the shade configuration.
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"><resource>META-INF/spring.handlers</resource></transformer> <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"><resource>META-INF/services/com.sun.tools.xjc.Plugin</resource></transformer> <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"><resource>META-INF/spring.schemas</resource></transformer> <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"><resource>META-INF/cxf/cxf.extension</resource></transformer> <transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer"><resource>META-INF/extensions.xml</resource></transformer> <transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer"><resource>META-INF/cxf/extensions.xml</resource></transformer> <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"><resource>META-INF/cxf/bus-extensions.txt</resource></transformer> <transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer"><resource>META-INF/cxf/bus-extensions.xml</resource></transformer> <transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer"><resource>META-INF/wsdl.plugin.xml</resource></transformer> <transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer"><resource>META-INF/tools.service.validator.xml</resource></transformer>
I am also having this issue. Was anyone able to resolve it? Have tried above mentioned changes but still facing same issue.