When executing the following code, an exception is thrown trying to create the APIResult object. It seems to be related to XStream marhalling but i can't seem to get around it. Is this something people have come across? I am using the develop branch.
public static void main(String[] args) throws Exception {
SpringApplication.run(SPController.class, args);
String BASE_URL = "http://apiurl/XMLAPI"; // real url not shared
String clientId = "id";m //real id not shared
String clientSecret = "secret"; //real secret not shared ;)
String refreshToken = "token"; //real token not shared
XmlApiClientFactory clientFactory = new XmlApiClientFactory();
OauthSession oathSession = new OauthSession(clientFactory,BASE_URL,
clientId,clientSecret, refreshToken); //values for properly configured oath app
GetListsCommand getListsCommand = new GetListsCommand();
ApiClient myClient = clientFactory.createClient(oathSession);
GetListsResult result = new GetListsResult();
try {
result = (GetListsResult)myClient.executeCommand(getListsCommand);
} catch (ApiResultException ae) {
ae.printStackTrace();
}
}
Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.RuntimeException: com.thoughtworks.xstream.converters.ConversionException: Cannot construct com.silverpop.api.client.ApiResult as it does not have a no-args constructor : Cannot construct com.silverpop.api.client.ApiResult as it does not have a no-args constructor
---- Debugging information ----
message : Cannot construct com.silverpop.api.client.ApiResult as it does not have a no-args constructor
cause-exception : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
cause-message : Cannot construct com.silverpop.api.client.ApiResult as it does not have a no-args constructor
class : com.silverpop.api.client.ApiResult
required-type : com.silverpop.api.client.ApiResult
converter-type : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
path : /Envelope/Body/RESULT
class[1] : com.silverpop.api.client.xmlapi.response.XmlApiResponseBody
class[2] : com.silverpop.api.client.xmlapi.response.XmlApiResponseEnvelope
version : not available
-------------------------------
at com.silverpop.api.client.xmlapi.XmlApiResponse.processRequest(XmlApiResponse.java:77)
at com.silverpop.api.client.xmlapi.XmlApiResponse.buildResult(XmlApiResponse.java:52)
at com.silverpop.api.client.ApiClient.extractResult(ApiClient.java:114)
at com.silverpop.api.client.ApiClient.validateSessionAndExecuteCommand(ApiClient.java:70)
at com.silverpop.api.client.ApiClient.executeCommand(ApiClient.java:43)
at com.silverpop.api.client.ApiClient.executeCommand(ApiClient.java:38)
at com.platformq.silverpop.SPController.main(SPController.java:104)
... 5 more
Caused by: com.thoughtworks.xstream.converters.ConversionException: Cannot construct com.silverpop.api.client.ApiResult as it does not have a no-args constructor : Cannot construct com.silverpop.api.client.ApiResult as it does not have a no-args constructor
---- Debugging information ----
message : Cannot construct com.silverpop.api.client.ApiResult as it does not have a no-args constructor
cause-exception : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
cause-message : Cannot construct com.silverpop.api.client.ApiResult as it does not have a no-args constructor
class : com.silverpop.api.client.ApiResult
required-type : com.silverpop.api.client.ApiResult
converter-type : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
path : /Envelope/Body/RESULT
class[1] : com.silverpop.api.client.xmlapi.response.XmlApiResponseBody
class[2] : com.silverpop.api.client.xmlapi.response.XmlApiResponseEnvelope
version : not available
-------------------------------
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:480)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:412)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:263)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:480)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:412)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:263)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1206)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1190)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1061)
at com.silverpop.api.client.xmlapi.XmlApiResponse.processRequest(XmlApiResponse.java:75)
... 11 more
Caused by: com.thoughtworks.xstream.converters.reflection.ObjectAccessException: Cannot construct com.silverpop.api.client.ApiResult as it does not have a no-args constructor
at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.newInstance(PureJavaReflectionProvider.java:74)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.instantiateNewInstance(AbstractReflectionConverter.java:559)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:262)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
... 32 more