java - ArrayStoreException making a post using apache httpasyncclient -
actually client resides in tomcat 8080 & rest api resides in 9090. url's different when moves higher environments. don't see call happening rest api httpasyncclient. copied code apache website https://hc.apache.org/httpcomponents-asyncclient-dev/examples.html
not sure, how make call successful though receive exception in response
closeablehttpasyncclient client = httpasyncclients.createdefault(); try { client.start(); jsonobject obj = new jsonobject(); obj.addproperty("username", "username"); obj.addproperty("password", "password"); string serverurl = "http://localhost:9090/project/api"; httppost postrequest = new httppost(serverurl); stringentity params = new stringentity(obj.tostring(), "utf-8"); params.setcontenttype(new basicheader(http.content_type, "x-www-form-urlencoded")); postrequest.setentity(params); future<httpresponse> future = client.execute(postrequest, null); httpresponse response = future.get(); } catch (illegalargumentexception e) { e.printstacktrace(); } catch (interruptedexception e) { e.printstacktrace(); } catch (executionexception e) { e.printstacktrace(); } { try { client.close(); } catch (ioexception e) { e.printstacktrace(); } }
i didn't find useful information on fixing this. make day
caused by: java.lang.arraystoreexception: org.apache.http.impl.cookie.rfc2965versionattributehandler @ org.apache.http.impl.cookie.defaultcookiespecprovider.create(defaultcookiespecprovider.java:93) @ org.apache.http.client.protocol.requestaddcookies.process(requestaddcookies.java:152) @ org.apache.http.protocol.immutablehttpprocessor.process(immutablehttpprocessor.java:133) @ org.apache.http.impl.nio.client.mainclientexec.preparerequest(mainclientexec.java:520) @ org.apache.http.impl.nio.client.mainclientexec.prepare(mainclientexec.java:146) @ org.apache.http.impl.nio.client.defaultclientexchangehandlerimpl.start(defaultclientexchangehandlerimpl.java:124) @ org.apache.http.impl.nio.client.internalhttpasyncclient.execute(internalhttpasyncclient.java:141) @ org.apache.http.impl.nio.client.closeablehttpasyncclient.execute(closeablehttpasyncclient.java:74) @ org.apache.http.impl.nio.client.closeablehttpasyncclient.execute(closeablehttpasyncclient.java:107) @ org.apache.http.impl.nio.client.closeablehttpasyncclient.execute(closeablehttpasyncclient.java:91)
javadocs say
open declaration java.util.concurrent.executionexception exception thrown when attempting retrieve result of task aborted throwing exception. exception can inspected using getcause() method.
Comments
Post a Comment