How to make HttpClient stops processing - java

I have a strange issue and I can't find the solution.
I have the following code for building my ClosableHttpClient :
private void createClient() {
int timeout = 5;
RequestConfig config = RequestConfig.custom()
.setConnectTimeout(timeout * 1000)
.setConnectionRequestTimeout(timeout * 1000)
.setSocketTimeout(timeout * 1000).build();
final SSLSocketFactory socketFactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
final HostnameVerifier defaultHostnameVerifier = SSLConnectionSocketFactory.getDefaultHostnameVerifier();
final SSLConnectionSocketFactory systemSocketFactory = new SSLConnectionSocketFactory(socketFactory, defaultHostnameVerifier);
httpclient = HttpClients.custom()
.setSSLSocketFactory(systemSocketFactory)
.setDefaultRequestConfig(config)
.build();
}
and than I'm trying this:
private JSONObject sendPostRequest(String url, StringEntity postData) throws HttpException, IOException {
HttpPost request = new HttpPost(url);
for (String key : headers.keySet()) {
request.addHeader(key, headers.get(key));
}
request.setEntity(postData);
HttpResponse response = httpclient.execute(request);
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode == HttpStatus.SC_OK) {
String content = EntityUtils.toString(response.getEntity());
return new JSONObject(content);
} else if (statusCode == HttpStatus.SC_UNAUTHORIZED) {
throw new HttpException("Autorisierung nicht möglich");
}
throw new HttpException(String.valueOf(statusCode));
}
the code stops at httpclient.execute(). And I mean it stops. There is nothing after, no log no stacktrace nothing. When I try my code on localhost ther is the following debug-log
[2022-02-11T09:29:10] [DEBUG] [Default Executor-thread-2] apache.http.client.protocol.RequestAddCookies:123 - CookieSpec selected: default
[2022-02-11T09:29:10] [DEBUG] [Default Executor-thread-2] apache.http.client.protocol.RequestAuthCache:77 - Auth cache not set in the context
[2022-02-11T09:29:10] [DEBUG] [Default Executor-thread-2] apache.http.impl.conn.PoolingHttpClientConnectionManager:267 - Connection request: [route: {s}->https://doesnt.matter:8443][total available: 0; route allocated: 0 of 2; total allocated: 0 of 20]
[2022-02-11T09:29:10] [DEBUG] [Default Executor-thread-2] apache.http.impl.conn.PoolingHttpClientConnectionManager:312 - Connection leased: [id: 0][route: {s}->https://doesnt.matter:8443][total available: 0; route allocated: 1 of 2; total allocated: 1 of 20]
[2022-02-11T09:29:10] [DEBUG] [Default Executor-thread-2] apache.http.impl.execchain.MainClientExec:234 - Opening connection {s}->https://doesnt.matter:8443
[2022-02-11T09:29:10] [DEBUG] [Default Executor-thread-2] apache.http.impl.conn.DefaultHttpClientConnectionOperator:139 - Connecting to doesnt.matter/1.2.1.8:8443
[2022-02-11T09:29:10] [DEBUG] [Default Executor-thread-2] apache.http.conn.ssl.SSLConnectionSocketFactory:366 - Connecting socket to doesnt.matter/1.2.1.8:8443 with timeout 5000
[2022-02-11T09:29:10] [DEBUG] [Default Executor-thread-2] apache.http.conn.ssl.SSLConnectionSocketFactory:430 - Enabled protocols: [TLSv1.2]
[2022-02-11T09:29:10] [DEBUG] [Default Executor-thread-2] apache.http.conn.ssl.SSLConnectionSocketFactory:431 - Enabled cipher suites:[SSL_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, SSL_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, SSL_ECDHE_RSA_WITH_AES_256_GCM_SHA384, SSL_RSA_WITH_AES_256_GCM_SHA384, SSL_ECDH_ECDSA_WITH_AES_256_GCM_SHA384, SSL_ECDH_RSA_WITH_AES_256_GCM_SHA384, SSL_DHE_RSA_WITH_AES_256_GCM_SHA384, SSL_DHE_DSS_WITH_AES_256_GCM_SHA384, SSL_ECDHE_RSA_WITH_AES_128_GCM_SHA256, SSL_RSA_WITH_AES_128_GCM_SHA256, SSL_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, SSL_ECDH_RSA_WITH_AES_128_GCM_SHA256, SSL_DHE_RSA_WITH_AES_128_GCM_SHA256, SSL_DHE_DSS_WITH_AES_128_GCM_SHA256, SSL_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, SSL_ECDHE_RSA_WITH_AES_256_CBC_SHA384, SSL_RSA_WITH_AES_256_CBC_SHA256, SSL_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, SSL_ECDH_RSA_WITH_AES_256_CBC_SHA384, SSL_DHE_RSA_WITH_AES_256_CBC_SHA256, SSL_DHE_DSS_WITH_AES_256_CBC_SHA256, SSL_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, SSL_ECDHE_RSA_WITH_AES_256_CBC_SHA, SSL_RSA_WITH_AES_256_CBC_SHA, SSL_ECDH_ECDSA_WITH_AES_256_CBC_SHA, SSL_ECDH_RSA_WITH_AES_256_CBC_SHA, SSL_DHE_RSA_WITH_AES_256_CBC_SHA, SSL_DHE_DSS_WITH_AES_256_CBC_SHA, SSL_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, SSL_ECDHE_RSA_WITH_AES_128_CBC_SHA256, SSL_RSA_WITH_AES_128_CBC_SHA256, SSL_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, SSL_ECDH_RSA_WITH_AES_128_CBC_SHA256, SSL_DHE_RSA_WITH_AES_128_CBC_SHA256, SSL_DHE_DSS_WITH_AES_128_CBC_SHA256, SSL_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, SSL_ECDHE_RSA_WITH_AES_128_CBC_SHA, SSL_RSA_WITH_AES_128_CBC_SHA, SSL_ECDH_ECDSA_WITH_AES_128_CBC_SHA, SSL_ECDH_RSA_WITH_AES_128_CBC_SHA, SSL_DHE_RSA_WITH_AES_128_CBC_SHA, SSL_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
[2022-02-11T09:29:10] [DEBUG] [Default Executor-thread-2] apache.http.conn.ssl.SSLConnectionSocketFactory:435 - Starting handshake
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] apache.http.conn.ssl.SSLConnectionSocketFactory:465 - Secure session established
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] apache.http.conn.ssl.SSLConnectionSocketFactory:466 - negotiated protocol: TLSv1.2
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] apache.http.conn.ssl.SSLConnectionSocketFactory:467 - negotiated cipher suite: SSL_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] apache.http.conn.ssl.SSLConnectionSocketFactory:475 - peer principal: CN=doesnt.matter, OU=D100, OU=SSL Server, OU=SSL, O=Finanz Informatik, C=DE
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] apache.http.conn.ssl.SSLConnectionSocketFactory:484 - peer alternative names: [doesnt.matter]
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] apache.http.conn.ssl.SSLConnectionSocketFactory:488 - issuer principal: CN=Finanz Informatik Issuing CA 01, OU=PKI, O=Finanz Informatik, C=DE
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] apache.http.impl.conn.DefaultHttpClientConnectionOperator:146 - Connection established 16.160.132.187:58678<->17.239.174.83:8443
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] apache.http.impl.conn.DefaultManagedHttpClientConnection:88 - http-outgoing-0: set socket timeout to 5000
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] apache.http.impl.execchain.MainClientExec:255 - Executing request POST /rest-api/authenticate HTTP/1.1
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] apache.http.impl.execchain.MainClientExec:260 - Target auth state: UNCHALLENGED
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] apache.http.impl.execchain.MainClientExec:266 - Proxy auth state: UNCHALLENGED
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:133 - http-outgoing-0 >> POST /rest-api/authenticate HTTP/1.1
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:136 - http-outgoing-0 >> Content-Length: 88
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:136 - http-outgoing-0 >> Content-Type: application/json; charset=UTF-8
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:136 - http-outgoing-0 >> Host: doesnt.matter:8443
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:136 - http-outgoing-0 >> Connection: Keep-Alive
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:136 - http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_291)
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:136 - http-outgoing-0 >> Accept-Encoding: gzip,deflate
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 >> "POST /rest-api/authenticate HTTP/1.1[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 >> "Content-Length: 88[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 >> "Content-Type: application/json; charset=UTF-8[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 >> "Host: doesnt.matter:8443[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 >> "User-Agent: Apache-HttpClient/4.5.13 (Java/1.8.0_291)[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 >> "[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:87 - http-outgoing-0 >> "{"clientContext":1,"password":"*********","repository":"UCMDB","username":"******"}"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 << "HTTP/1.1 200 OK[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 << "Date: Fri, 11 Feb 2022 08:29:10 GMT[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 << "X-FRAME-OPTIONS: [\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 << "Content-Security-Policy: frame-ancestors 'self'[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 << "X-Content-Type-Options: nosniff[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 << "X-Xss-Protection: 1; mode=block[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 << "Strict-Transport-Security: max-age=31536000;includeSubDomains[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 << "Cache-Control: no-store[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 << "IE-Language: en[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 << "Access-Control-Allow-Origin: *[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 << "Access-Control-Allow-Credentials: true[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 << "Access-Control-Allow-Methods: POST, PUT, GET, HEAD, OPTIONS, PATCH, DELETE[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 << "Access-Control-Allow-Headers: Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers , Authorization, Cache-Control, Pragma, Expires[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 << "Access-Control-Max-Age: 17200[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 << "Set-Cookie: JSESSIONID=node01dumaqs3jy4ycc2vtykxc0btx188; HttpOnly; secure; path=/rest-api[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 << "Expires: Thu, 01 Jan 1970 00:00:00 GMT[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 << "Content-Type: application/json[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 << "Content-Length: 243[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 << "[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 << "{[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:73 - http-outgoing-0 << " "token" : "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1bmlxdWVfc2FsdCI6IlY5OTBTVFdNVlFPUkEwMSIsImV4cCI6MTY0NDU3MTc1MCwicmVwb3NpdG9yeSI6IlVDTURCIiwiY3VzdG9tZXIiOjEsInVzZXJuYW1lIjoic3lzYWRtaW4ifQ.-BzMAsqUT0FdEpMsf0M__FodAP3yv7JOelXMvzwQBK4"[\r][\n]"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.wire:87 - http-outgoing-0 << "}"
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:122 - http-outgoing-0 << HTTP/1.1 200 OK
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:125 - http-outgoing-0 << Date: Fri, 11 Feb 2022 08:29:10 GMT
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:125 - http-outgoing-0 << X-FRAME-OPTIONS:
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:125 - http-outgoing-0 << Content-Security-Policy: frame-ancestors 'self'
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:125 - http-outgoing-0 << X-Content-Type-Options: nosniff
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:125 - http-outgoing-0 << X-Xss-Protection: 1; mode=block
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:125 - http-outgoing-0 << Strict-Transport-Security: max-age=31536000;includeSubDomains
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:125 - http-outgoing-0 << Cache-Control: no-store
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:125 - http-outgoing-0 << IE-Language: en
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:125 - http-outgoing-0 << Access-Control-Allow-Origin: *
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:125 - http-outgoing-0 << Access-Control-Allow-Credentials: true
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:125 - http-outgoing-0 << Access-Control-Allow-Methods: POST, PUT, GET, HEAD, OPTIONS, PATCH, DELETE
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:125 - http-outgoing-0 << Access-Control-Allow-Headers: Origin, Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers , Authorization, Cache-Control, Pragma, Expires
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:125 - http-outgoing-0 << Access-Control-Max-Age: 17200
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:125 - http-outgoing-0 << Set-Cookie: JSESSIONID=node01dumaqs3jy4ycc2vtykxc0btx188; HttpOnly; secure; path=/rest-api
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:125 - http-outgoing-0 << Expires: Thu, 01 Jan 1970 00:00:00 GMT
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:125 - http-outgoing-0 << Content-Type: application/json
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] org.apache.http.headers:125 - http-outgoing-0 << Content-Length: 243
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] apache.http.impl.execchain.MainClientExec:285 - Connection can be kept alive indefinitely
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] apache.http.client.protocol.ResponseProcessCookies:119 - Cookie accepted [JSESSIONID="node01dumaqs3jy4ycc2vtykxc0btx188", version:0, domain:doesnt.matter, path:/rest-api, expiry:null]
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] apache.http.impl.conn.PoolingHttpClientConnectionManager:344 - Connection [id: 0][route: {s}->https://doesnt.matter:8443] can be kept alive indefinitely
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] apache.http.impl.conn.DefaultManagedHttpClientConnection:88 - http-outgoing-0: set socket timeout to 0
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] apache.http.impl.conn.PoolingHttpClientConnectionManager:351 - Connection released: [id: 0][route: {s}->https://doesnt.matter:8443][total available: 1; route allocated: 1 of 2; total allocated: 1 of 20]
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] apache.http.impl.conn.PoolingHttpClientConnectionManager:411 - Connection manager is shutting down
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] apache.http.impl.conn.DefaultManagedHttpClientConnection:79 - http-outgoing-0: Close connection
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] apache.http.impl.conn.PoolingHttpClientConnectionManager:434 - Connection manager shut down
When I deploy it to the WLP Server I only get the following output
[2022-02-11T09:25:50] [DEBUG] [Default Executor-thread-576] apache.http.client.protocol.RequestAddCookies:123 - CookieSpec selected: default
[2022-02-11T09:25:50] [DEBUG] [Default Executor-thread-576] apache.http.client.protocol.RequestAuthCache:77 - Auth cache not set in the context
[2022-02-11T09:25:50] [DEBUG] [Default Executor-thread-576] apache.http.impl.conn.PoolingHttpClientConnectionManager:267 - Connection request: [route: {s}->https://doesnt.matter:8443][total available: 0; route allocated: 0 of 2; total allocated: 0 of 20]
[2022-02-11T09:25:50] [DEBUG] [Default Executor-thread-576] apache.http.impl.conn.PoolingHttpClientConnectionManager:312 - Connection leased: [id: 120][route: {s}->https://doesnt.matter:8443][total available: 0; route allocated: 1 of 2; total allocated: 1 of 20]
[2022-02-11T09:25:50] [DEBUG] [Default Executor-thread-576] apache.http.impl.execchain.MainClientExec:234 - Opening connection {s}->https://doesnt.matter:8443
[2022-02-11T09:25:50] [DEBUG] [Default Executor-thread-576] apache.http.impl.conn.DefaultHttpClientConnectionOperator:139 - Connecting to doesnt.matter/1.2.1.8:8443
[2022-02-11T09:25:50] [DEBUG] [Default Executor-thread-576] apache.http.conn.ssl.SSLConnectionSocketFactory:366 - Connecting socket to doesnt.matter/1.2.1.8:8443 with timeout 5000
[2022-02-11T09:25:50] [DEBUG] [Default Executor-thread-576] apache.http.conn.ssl.SSLConnectionSocketFactory:430 - Enabled protocols: [TLSv1.2]
[2022-02-11T09:25:50] [DEBUG] [Default Executor-thread-576] apache.http.conn.ssl.SSLConnectionSocketFactory:431 - Enabled cipher suites:[SSL_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, SSL_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, SSL_ECDHE_RSA_WITH_AES_256_GCM_SHA384, SSL_DHE_RSA_WITH_AES_256_GCM_SHA384, SSL_DHE_DSS_WITH_AES_256_GCM_SHA384, SSL_ECDHE_RSA_WITH_AES_128_GCM_SHA256, SSL_DHE_RSA_WITH_AES_128_GCM_SHA256, SSL_DHE_DSS_WITH_AES_128_GCM_SHA256]
[2022-02-11T09:25:50] [DEBUG] [Default Executor-thread-576] apache.http.conn.ssl.SSLConnectionSocketFactory:435 - Starting handshake
[2022-02-11T09:25:50] [DEBUG] [Finalizer thread] apache.http.impl.conn.PoolingHttpClientConnectionManager:411 - Connection manager is shutting down
[2022-02-11T09:25:50] [DEBUG] [Finalizer thread] apache.http.impl.conn.PoolingHttpClientConnectionManager:434 - Connection manager shut down
[2022-02-11T09:26:23] [DEBUG] [Default Executor-thread-576] apache.http.impl.conn.PoolingHttpClientConnectionManager:411 - Connection manager is shutting down
[2022-02-11T09:26:23] [DEBUG] [Default Executor-thread-576] apache.http.impl.conn.DefaultManagedHttpClientConnection:96 - http-outgoing-120: Shutdown connection
[2022-02-11T09:26:23] [DEBUG] [Default Executor-thread-576] apache.http.impl.conn.PoolingHttpClientConnectionManager:434 - Connection manager shut down
And as I said than there is nothing. My code stops proceeding. This test is made every 15 Minutes and it is in a for-next-loop with some other tests. If it wold send an exception the for-next could work on, but it only stops working. Can someone tell my why it only stops and doesn't send something back to the application and help me making it stop so the other tasks are run.

The only difference I see between your LocalHost vs your Client connection is the following:
[2022-02-11T09:29:10] [DEBUG] [Default Executor-thread-2] apache.http.conn.ssl.SSLConnectionSocketFactory:435 - Starting handshake
[2022-02-11T09:29:11] [DEBUG] [Default Executor-thread-2] apache.http.conn.ssl.SSLConnectionSocketFactory:465 - Secure session established
While for your client:
[2022-02-11T09:25:50] [DEBUG] [Default Executor-thread-576] apache.http.conn.ssl.SSLConnectionSocketFactory:435 - Starting handshake
[2022-02-11T09:25:50] [DEBUG] [Finalizer thread] apache.http.impl.conn.PoolingHttpClientConnectionManager:411 - Connection manager is shutting down
You could be facing 2 issues:
You are on a server which has network firewall of some kind, which does not allow you to access the specific IP you are attempting to reach, therefore the connection is getting killed instantly.
Another issue might be that your SSL connection for that IP is invalid, however I think this is less likely, because if there is a problem in SSL, you could get some debug info regarding that.

Related

Read time out in Apache HTTP Client but request runs fine with curl

I have a PUT requests that is done by a dependency scanner we are using
I'm behind a corporate proxy
Request is done with Apache HTTP Client 4
I get a "read time out" after the configured timeout
I recreated the request with curl and this works fine (with the same proxy) and finishes within seconds
It works fine with Apache HTTP Client without the proxy.
So I'm trying to find out what config is missing in the HTTP client config or what else could be the error. Unfortunately neither our networking team nor the product vendor could help me out :-(
This is the curl request:
curl --connect-timeout 60 -m 60 -v -X PUT --data-binary #test.json
https://someblackduckserver/api/developer-scans/12345
-H "Content-type: application/vnd.blackducksoftware.developer-scan-1-ld-2+json"
-H "X-BD-DOCUMENT-COUNT: 1"
-H "Accept: application/vnd.blackducksoftware.scan-4+json"
-H "X-BD-MODE: append"
-H "X-BD-RAPID-SCAN-MODE: ALL" -H "X-BD-VERSION-NAME: scan-test"
-H "User-Agent: synopsys_detect/8.1.0-SNAPSHOT BlackDuckCommon/65.0.0 ..."
-H "X-BD-PROJECT-NAME: scan-test"
-H "Authorization: Bearer ..... left out ....."
Where test.json is a json file with about 1.3MB.
Minified code when using Apache HTTP Client:
RequestBuilder requestBuilder = RequestBuilder.create("PUT");
URIBuilder uriBuilder = new URIBuilder(new URI("https://someblackduckserver/api/developer-scans/12345"));
requestBuilder.setUri(uriBuilder.build());
Charset bodyEncoding = StandardCharsets.UTF_8;
requestBuilder.setCharset(bodyEncoding);
requestBuilder.addHeader("Content-type", "application/vnd.blackducksoftware.developer-scan-1-ld-2+json");
requestBuilder.addHeader("X-BD-DOCUMENT-COUNT", "1");
requestBuilder.addHeader("Accept", "application/vnd.blackducksoftware.scan-4+json");
requestBuilder.addHeader("X-BD-MODE", "append");
requestBuilder.addHeader("X-BD-RAPID-SCAN-MODE", "ALL");
requestBuilder.addHeader("X-BD-VERSION-NAME", "scan-test");
requestBuilder.addHeader("User-Agent", "synopsys_detect/8.1.0-SNAPSHOT BlackDuckCommon/65.0.0 ...");
requestBuilder.addHeader("X-BD-PROJECT-NAME", "scan-test");
requestBuilder.addHeader("Authorization", "Bearer ..... left out .....");
HttpEntity httpEntity = new FileEntity(new File("test.json"));
requestBuilder.setEntity(httpEntity);
HttpUriRequest request = requestBuilder.build();
HttpContext httpContext = new BasicHttpContext();
HttpClientBuilder clientBuilder = HttpClientBuilder.create();
RequestConfig.Builder defaultRequestConfigBuilder = RequestConfig.custom().setCookieSpec(CookieSpecs.STANDARD);
// set our proxy
defaultRequestConfigBuilder.setProxy(new HttpHost("..... (left out)", 8080));
// set timeout
int timeoutInSeconds = 60;
defaultRequestConfigBuilder.setConnectTimeout(timeoutInSeconds * 1000);
defaultRequestConfigBuilder.setSocketTimeout(timeoutInSeconds * 1000);
defaultRequestConfigBuilder.setConnectionRequestTimeout(timeoutInSeconds * 1000);
clientBuilder.setDefaultRequestConfig(defaultRequestConfigBuilder.build());
// for testing: ignore ssl
HostnameVerifier hostnameVerifier;
SSLContext sslContext = SSLContextBuilder.create().loadTrustMaterial(new TrustAllStrategy()).build();
hostnameVerifier = new NoopHostnameVerifier();
SSLConnectionSocketFactory connectionFactory = new SSLConnectionSocketFactory(sslContext, hostnameVerifier);
clientBuilder.setSSLSocketFactory(connectionFactory);
try (CloseableHttpClient client = clientBuilder.build()) {
CloseableHttpResponse closeableHttpResponse = client.execute(request, httpContext);
System.out.println(closeableHttpResponse);
}
I removed some sensitive details from the request.
Any idea what I'm missing here or what could go wrong?
Logs from a sample the call:
2022-07-25 10:38:38.201 [main] DEBUG o.a.h.c.protocol.RequestAddCookies - CookieSpec selected: default
2022-07-25 10:38:38.206 [main] DEBUG o.a.h.c.protocol.RequestAuthCache - Auth cache not set in the context
2022-07-25 10:38:38.207 [main] DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager - Connection request: [route: {tls}->http://our.proxy.ip.address:8080->https://someblackduckserver.com:443][total available: 0; route allocated: 0 of 2; total allocated: 0 of 20]
2022-07-25 10:38:38.259 [main] DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager - Connection leased: [id: 0][route: {tls}->http://our.proxy.ip.address:8080->https://someblackduckserver.com:443][total available: 0; route allocated: 1 of 2; total allocated: 1 of 20]
2022-07-25 10:38:38.260 [main] DEBUG o.a.h.impl.execchain.MainClientExec - Opening connection {tls}->http://our.proxy.ip.address:8080->https://someblackduckserver.com:443
2022-07-25 10:38:38.261 [main] DEBUG o.a.h.i.c.DefaultHttpClientConnectionOperator - Connecting to /our.proxy.ip.address:8080
2022-07-25 10:38:38.301 [main] DEBUG o.a.h.i.c.DefaultHttpClientConnectionOperator - Connection established 10.17.10.44:34272<->our.proxy.ip.address:8080
2022-07-25 10:38:38.317 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> CONNECT someblackduckserver.com:443 HTTP/1.1
2022-07-25 10:38:38.317 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Host: someblackduckserver.com
2022-07-25 10:38:38.317 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.13 (Java/11.0.13)
2022-07-25 10:38:38.317 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "CONNECT someblackduckserver.com:443 HTTP/1.1[\r][\n]"
2022-07-25 10:38:38.317 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Host: someblackduckserver.com[\r][\n]"
2022-07-25 10:38:38.317 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "User-Agent: Apache-HttpClient/4.5.13 (Java/11.0.13)[\r][\n]"
2022-07-25 10:38:38.317 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "[\r][\n]"
2022-07-25 10:38:38.346 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "HTTP/1.1 200 Connection established[\r][\n]"
2022-07-25 10:38:38.346 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Proxy-Agent: Proxy-Vendor-Proxy/1.0[\r][\n]"
2022-07-25 10:38:38.346 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "[\r][\n]"
2022-07-25 10:38:38.347 [main] DEBUG org.apache.http.headers - http-outgoing-0 << HTTP/1.1 200 Connection established
2022-07-25 10:38:38.347 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Proxy-Agent: Proxy-Vendor-Proxy/1.0
2022-07-25 10:38:38.347 [main] DEBUG o.a.h.impl.execchain.MainClientExec - Tunnel to target created.
2022-07-25 10:38:38.432 [main] DEBUG o.a.h.c.s.SSLConnectionSocketFactory - Enabled protocols: [TLSv1.3, TLSv1.2]
2022-07-25 10:38:38.440 [main] DEBUG o.a.h.c.s.SSLConnectionSocketFactory - Enabled cipher suites:[TLS_AES_256_GCM_SHA384, TLS_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
2022-07-25 10:38:38.440 [main] DEBUG o.a.h.c.s.SSLConnectionSocketFactory - Starting handshake
2022-07-25 10:38:39.252 [main] DEBUG jdk.event.security - X509Certificate: ... our ssl inspect certificate ...
2022-07-25 10:38:39.252 [main] DEBUG jdk.event.security - X509Certificate: ... our internal certificate ...
2022-07-25 10:38:39.275 [main] DEBUG jdk.event.security - TLSHandshake: someblackduckserver.com:8080, TLSv1.2, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, 1942523025
2022-07-25 10:38:39.276 [main] DEBUG o.a.h.c.s.SSLConnectionSocketFactory - Secure session established
2022-07-25 10:38:39.276 [main] DEBUG o.a.h.c.s.SSLConnectionSocketFactory - negotiated protocol: TLSv1.2
2022-07-25 10:38:39.276 [main] DEBUG o.a.h.c.s.SSLConnectionSocketFactory - negotiated cipher suite: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
2022-07-25 10:38:39.276 [main] DEBUG o.a.h.c.s.SSLConnectionSocketFactory - peer principal: CN=*.someblackduckserver.com, O="Synopsys, Inc.", L=Mountain View, ST=California, C=US
2022-07-25 10:38:39.276 [main] DEBUG o.a.h.c.s.SSLConnectionSocketFactory - peer alternative names: [*.someblackduckserver.com]
2022-07-25 10:38:39.276 [main] DEBUG o.a.h.c.s.SSLConnectionSocketFactory - issuer principal: ... our ssl inspect certificate ...
2022-07-25 10:38:39.276 [main] DEBUG o.a.h.i.c.DefaultManagedHttpClientConnection - http-outgoing-0: set socket timeout to 60000
2022-07-25 10:38:39.277 [main] DEBUG o.a.h.impl.execchain.MainClientExec - Executing request PUT /api/developer-scans/12345 HTTP/1.1
2022-07-25 10:38:39.277 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> PUT /api/developer-scans/12345 HTTP/1.1
2022-07-25 10:38:39.277 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Content-type: application/vnd.blackducksoftware.developer-scan-1-ld-2+json
2022-07-25 10:38:39.277 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> X-BD-DOCUMENT-COUNT: 1
2022-07-25 10:38:39.277 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Accept: application/vnd.blackducksoftware.scan-4+json
2022-07-25 10:38:39.277 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> X-BD-MODE: append
2022-07-25 10:38:39.277 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> X-BD-RAPID-SCAN-MODE: ALL
2022-07-25 10:38:39.277 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> X-BD-VERSION-NAME: rapid-scan-test-igl-2
2022-07-25 10:38:39.277 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> User-Agent: synopsys_detect/8.1.0-SNAPSHOT BlackDuckCommon/65.0.0 (Eclipse Foundation 11.0.12 amd64 Windows 10 10.0)
2022-07-25 10:38:39.277 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> X-BD-PROJECT-NAME: project_name
2022-07-25 10:38:39.278 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Authorization: Bearer ...
2022-07-25 10:38:39.278 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Content-Length: 287381
2022-07-25 10:38:39.278 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Host: someblackduckserver.com
2022-07-25 10:38:39.278 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Connection: Keep-Alive
2022-07-25 10:38:39.278 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Accept-Encoding: gzip,deflate
2022-07-25 10:38:39.278 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "PUT /api/developer-scans/12345 HTTP/1.1[\r][\n]"
2022-07-25 10:38:39.278 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Content-type: application/vnd.blackducksoftware.developer-scan-1-ld-2+json[\r][\n]"
2022-07-25 10:38:39.278 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "X-BD-DOCUMENT-COUNT: 1[\r][\n]"
2022-07-25 10:38:39.279 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Accept: application/vnd.blackducksoftware.scan-4+json[\r][\n]"
2022-07-25 10:38:39.279 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "X-BD-MODE: append[\r][\n]"
2022-07-25 10:38:39.279 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "X-BD-RAPID-SCAN-MODE: ALL[\r][\n]"
2022-07-25 10:38:39.279 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "X-BD-VERSION-NAME: rapid-scan-test-igl-2[\r][\n]"
2022-07-25 10:38:39.279 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "User-Agent: synopsys_detect/8.1.0-SNAPSHOT BlackDuckCommon/65.0.0 (Eclipse Foundation 11.0.12 amd64 Windows 10 10.0)[\r][\n]"
2022-07-25 10:38:39.279 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "X-BD-PROJECT-NAME: project_name[\r][\n]"
2022-07-25 10:38:39.279 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Authorization: Bearer ...[\r][\n]"
2022-07-25 10:38:39.279 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Content-Length: 287381[\r][\n]"
2022-07-25 10:38:39.279 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Host: someblackduckserver.com[\r][\n]"
2022-07-25 10:38:39.279 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
2022-07-25 10:38:39.279 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
2022-07-25 10:38:39.423 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> .... all the logs for file content ....
2022-07-25 10:39:39.483 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "[read] I/O error: Read timed out"
2022-07-25 10:39:39.483 [main] DEBUG o.a.h.i.c.DefaultManagedHttpClientConnection - http-outgoing-0: Close connection
2022-07-25 10:39:39.483 [main] DEBUG o.a.h.i.c.DefaultManagedHttpClientConnection - http-outgoing-0: Shutdown connection
2022-07-25 10:39:39.483 [main] DEBUG o.a.h.impl.execchain.MainClientExec - Connection discarded
2022-07-25 10:39:39.483 [main] DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager - Connection released: [id: 0][route: {tls}->http://our.proxy.ip.address:8080->https://someblackduckserver.com:443][total available: 0; route allocated: 0 of 2; total allocated: 0 of 20]
2022-07-25 10:39:39.484 [main] DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager - Connection manager is shutting down
2022-07-25 10:39:39.484 [main] DEBUG o.a.h.i.c.PoolingHttpClientConnectionManager - Connection manager shut down
Exception in thread "main" java.net.SocketTimeoutException: Read timed out
at java.base/java.net.SocketInputStream.socketRead0(Native Method)
at java.base/java.net.SocketInputStream.socketRead(SocketInputStream.java:115)
at java.base/java.net.SocketInputStream.read(SocketInputStream.java:168)
at java.base/java.net.SocketInputStream.read(SocketInputStream.java:140)
at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:478)
at java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:472)
at java.base/sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(SSLSocketInputRecord.java:70)
at java.base/sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1318)
at java.base/sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:959)
at org.apache.http.impl.conn.LoggingInputStream.read(LoggingInputStream.java:84)
at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137)
at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:153)
at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:280)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:157)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.example.BdTest.main(BdTest.java:93)
May be not a solution but a workaround if it works. I wrote my own Http client that is much simpler than Apache Http client. The reason I wrote it is that in many cases you just need a simplistic functionality so using a thin library lessens complexity and allows you to debug it if need be and it would allow you easier way to get to the bottom of the problem. So, may be you can give it a shot. At may even work or if not than it would be much easier to debug than Apache Http client. My Http client is part of MgntUtils Open-Source library written and maintained by me. Here is HttpClient Javadoc. The library can be obtained as Maven artifact from Maven Central and from Github (including source code and Javadoc)

Parsing Error while fetching list of objects from amazon s3 using Java

I am trying to fetch the list of objects from a bucket of amazon s3. Below is the code that i am using.
AWSCredentials credentials = new BasicAWSCredentials(serverSettings.getAccessKey(), serverSettings.getSecretesKey());
ClientConfiguration clientConfiguration = new ClientConfiguration();
clientConfiguration.setSignerOverride("AWSS3V4SignerType");
AmazonS3 s3Client = AmazonS3ClientBuilder
.standard()
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(serverSettings.getStorageUri(), Regions.AP_SOUTH_1.name()))
.withPathStyleAccessEnabled(true)
.withClientConfiguration(clientConfiguration)
.withCredentials(new AWSStaticCredentialsProvider(credentials))
.build();
return s3Client;
public List<String> getBucketFiles(String bucket) {
ListObjectsRequest listObjectsRequest = new ListObjectsRequest()
.withBucketName(bucket)
.withDelimiter("/");
ObjectListing listing = s3Client.listObjects(listObjectsRequest);
log.debug("Bucket : {} contain files : {}", bucket, filesInBucket);
return filesInBucket;
}
While fetching s3Client.listObjects(listObjectsRequest) i get the below error.
2020-02-25 15:45:03.955 DEBUG com.amazonaws.AmazonWebServiceClient - Internal logging successfully configured to commons logger: true
2020-02-25 15:45:03.955 DEBUG com.amazonaws.metrics.AwsSdkMetrics - Admin mbean registered under com.amazonaws.management:type=AwsSdkMetrics
2020-02-25 15:45:04.002 WARN com.amazonaws.http.AmazonHttpClient - SSL Certificate checking for endpoints has been explicitly disabled.
2020-02-25 15:45:04.086 DEBUG com.amazonaws.request - Sending Request: GET https://s3.console.aws.amazon.com/s3/home?region=ap-southeast-1# /r9a2/ Parameters: ({"delimiter":["/"],"encoding-type":["url"]}Headers: (User-Agent: aws-sdk-java/1.11.232 Windows_10/10.0 Java_HotSpot(TM)_64-Bit_Server_VM/25.241-b07 java/1.8.0_241, amz-sdk-invocation-id: 24587b25-9691-3123-343a-329a6e57d106, Content-Type: application/octet-stream, )
2020-02-25 15:45:04.171 DEBUG com.amazonaws.auth.AWS4Signer - AWS4 Canonical Request: '"GET
/s3/home/r9a2/
delimiter=%2F&encoding-type=url
amz-sdk-invocation-id:24587b25-9691-3123-343a-329a6e57d106
amz-sdk-retry:0/0/500
content-type:application/octet-stream
host:s3.console.aws.amazon.com
user-agent:aws-sdk-java/1.11.232 Windows_10/10.0 Java_HotSpot(TM)_64-Bit_Server_VM/25.241-b07 java/1.8.0_241
x-amz-content-sha256:UNSIGNED-PAYLOAD
x-amz-date:20200225T101504Z
amz-sdk-invocation-id;amz-sdk-retry;content-type;host;user-agent;x-amz-content-sha256;x-amz-date
UNSIGNED-PAYLOAD"
2020-02-25 15:45:04.171 DEBUG com.amazonaws.auth.AWS4Signer - AWS4 String to Sign: '"AWS4-HMAC-SHA256
20200225T101504Z
20200225/AP_SOUTH_1/s3/aws4_request
2104ae348572863769961aabcbe488d3aae778eb807905f0d8e67edf95b6f659"
2020-02-25 15:45:04.171 DEBUG com.amazonaws.auth.AWS4Signer - Generating a new signing key as the signing key not available in the cache for the date 1582588800000
2020-02-25 15:45:04.187 DEBUG org.apache.http.client.protocol.RequestAddCookies - CookieSpec selected: default
2020-02-25 15:45:04.187 DEBUG org.apache.http.client.protocol.RequestAuthCache - Auth cache not set in the context
2020-02-25 15:45:04.187 DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection request: [route: {s}->https://s3.console.aws.amazon.com:443][total kept alive: 0; route allocated: 0 of 50; total allocated: 0 of 50]
2020-02-25 15:45:04.202 DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection leased: [id: 0][route: {s}->https://s3.console.aws.amazon.com:443][total kept alive: 0; route allocated: 1 of 50; total allocated: 1 of 50]
2020-02-25 15:45:04.202 DEBUG org.apache.http.impl.execchain.MainClientExec - Opening connection {s}->https://s3.console.aws.amazon.com:443
2020-02-25 15:45:05.961 DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connecting to s3.console.aws.amazon.com/54.240.226.19:443
2020-02-25 15:45:05.975 DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connection established 172.27.147.254:63178<->54.240.226.19:443
2020-02-25 15:45:05.975 DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-0: set socket timeout to 50000
2020-02-25 15:45:05.975 DEBUG org.apache.http.impl.execchain.MainClientExec - Executing request GET /s3/home?region=ap-southeast-1 HTTP/1.1
2020-02-25 15:45:05.975 DEBUG org.apache.http.impl.execchain.MainClientExec - Proxy auth state: UNCHALLENGED
2020-02-25 15:45:05.975 DEBUG org.apache.http.headers - http-outgoing-0 >> GET /s3/home?region=ap-southeast-1 HTTP/1.1
2020-02-25 15:45:05.975 DEBUG org.apache.http.headers - http-outgoing-0 >> Host: s3.console.aws.amazon.com
2020-02-25 15:45:05.975 DEBUG org.apache.http.headers - http-outgoing-0 >> x-amz-content-sha256: UNSIGNED-PAYLOAD
2020-02-25 15:45:05.975 DEBUG org.apache.http.headers - http-outgoing-0 >> Authorization: AWS4-HMAC-SHA256 Credential=AKIA3N5SPIMUI7VMSV6J/20200225/AP_SOUTH_1/s3/aws4_request, SignedHeaders=amz-sdk-invocation-id;amz-sdk-retry;content-type;host;user-agent;x-amz-content-sha256;x-amz-date, Signature=2f08656e1ec077e9b5c69ffd4d5ffff623a8576e66298fb77634ce04a0f7b27b
2020-02-25 15:45:05.975 DEBUG org.apache.http.headers - http-outgoing-0 >> X-Amz-Date: 20200225T101504Z
2020-02-25 15:45:05.975 DEBUG org.apache.http.headers - http-outgoing-0 >> User-Agent: aws-sdk-java/1.11.232 Windows_10/10.0 Java_HotSpot(TM)_64-Bit_Server_VM/25.241-b07 java/1.8.0_241
2020-02-25 15:45:05.975 DEBUG org.apache.http.headers - http-outgoing-0 >> amz-sdk-invocation-id: 24587b25-9691-3123-343a-329a6e57d106
2020-02-25 15:45:05.975 DEBUG org.apache.http.headers - http-outgoing-0 >> amz-sdk-retry: 0/0/500
2020-02-25 15:45:05.975 DEBUG org.apache.http.headers - http-outgoing-0 >> Content-Type: application/octet-stream
2020-02-25 15:45:05.975 DEBUG org.apache.http.headers - http-outgoing-0 >> Content-Length: 0
2020-02-25 15:45:05.975 DEBUG org.apache.http.headers - http-outgoing-0 >> Connection: Keep-Alive
2020-02-25 15:45:06.346 DEBUG org.apache.http.headers - http-outgoing-0 << HTTP/1.1 200 OK
2020-02-25 15:45:06.346 DEBUG org.apache.http.headers - http-outgoing-0 << Server: Server
2020-02-25 15:45:06.346 DEBUG org.apache.http.headers - http-outgoing-0 << Date: Tue, 25 Feb 2020 10:15:06 GMT
2020-02-25 15:45:06.346 DEBUG org.apache.http.headers - http-outgoing-0 << Content-Type: text/html;charset=ISO-8859-1
2020-02-25 15:45:06.346 DEBUG org.apache.http.headers - http-outgoing-0 << Content-Length: 989
2020-02-25 15:45:06.346 DEBUG org.apache.http.headers - http-outgoing-0 << Strict-Transport-Security: max-age=47304000; includeSubDomains
2020-02-25 15:45:06.346 DEBUG org.apache.http.headers - http-outgoing-0 << Cache-Control: proxy-revalidate
2020-02-25 15:45:06.346 DEBUG org.apache.http.headers - http-outgoing-0 << Connection: Keep-Alive
2020-02-25 15:45:06.346 DEBUG org.apache.http.headers - http-outgoing-0 << Set-Cookie: awsc-authTimer=%7B%22start%22%3A%221582625706301%22%7D; Secure; HttpOnly
2020-02-25 15:45:06.346 DEBUG org.apache.http.headers - http-outgoing-0 << Set-Cookie: aws-creds=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/s3; Secure
2020-02-25 15:45:06.346 DEBUG org.apache.http.headers - http-outgoing-0 << Set-Cookie: aws-creds=""; Domain=s3.console.aws.amazon.com; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/s3; Secure
2020-02-25 15:45:06.346 DEBUG org.apache.http.headers - http-outgoing-0 << Set-Cookie: aws-creds=""; Domain=console.aws.amazon.com; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/s3; Secure
2020-02-25 15:45:06.346 DEBUG org.apache.http.headers - http-outgoing-0 << Set-Cookie: JSESSIONID=C16202E2D237233CBB71A1BC2EC29B0A; Path=/; HttpOnly
2020-02-25 15:45:06.346 DEBUG org.apache.http.impl.execchain.MainClientExec - Connection can be kept alive for 60000 MILLISECONDS
2020-02-25 15:45:06.346 DEBUG org.apache.http.client.protocol.ResponseProcessCookies - Cookie accepted [awsc-authTimer="%7B%22start%22%3A%221582625706301%22%7D", version:0, domain:s3.console.aws.amazon.com, path:/s3, expiry:null]
2020-02-25 15:45:06.346 DEBUG org.apache.http.client.protocol.ResponseProcessCookies - Cookie accepted [aws-creds="""", version:0, domain:s3.console.aws.amazon.com, path:/s3, expiry:Thu Jan 01 05:30:10 IST 1970]
2020-02-25 15:45:06.346 DEBUG org.apache.http.client.protocol.ResponseProcessCookies - Cookie accepted [aws-creds="""", version:0, domain:s3.console.aws.amazon.com, path:/s3, expiry:Thu Jan 01 05:30:10 IST 1970]
2020-02-25 15:45:06.346 DEBUG org.apache.http.client.protocol.ResponseProcessCookies - Cookie accepted [aws-creds="""", version:0, domain:console.aws.amazon.com, path:/s3, expiry:Thu Jan 01 05:30:10 IST 1970]
2020-02-25 15:45:06.346 DEBUG org.apache.http.client.protocol.ResponseProcessCookies - Cookie accepted [JSESSIONID="C16202E2D237233CBB71A1BC2EC29B0A", version:0, domain:s3.console.aws.amazon.com, path:/, expiry:null]
2020-02-25 15:45:06.362 DEBUG com.amazonaws.services.s3.model.transform.XmlResponsesSaxParser - Sanitizing XML document destined for handler class com.amazonaws.services.s3.model.transform.XmlResponsesSaxParser$ListBucketHandler
2020-02-25 15:45:06.362 DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection [id: 0][route: {s}->https://s3.console.aws.amazon.com:443] can be kept alive for 60.0 seconds
2020-02-25 15:45:06.362 DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection released: [id: 0][route: {s}->https://s3.console.aws.amazon.com:443][total kept alive: 1; route allocated: 1 of 50; total allocated: 1 of 50]
2020-02-25 15:45:06.362 DEBUG com.amazonaws.services.s3.model.transform.XmlResponsesSaxParser - Parsing XML response document with handler: class com.amazonaws.services.s3.model.transform.XmlResponsesSaxParser$ListBucketHandler
com.amazonaws.SdkClientException: Failed to parse XML document with handler class com.amazonaws.services.s3.model.transform.XmlResponsesSaxParser$ListBucketHandler
at com.amazonaws.services.s3.model.transform.XmlResponsesSaxParser.parseXmlInputStream(XmlResponsesSaxParser.java:161) ~[aws-java-sdk-s3-1.11.232.jar:?]
at com.amazonaws.services.s3.model.transform.XmlResponsesSaxParser.parseListBucketObjectsResponse(XmlResponsesSaxParser.java:317) ~[aws-java-sdk-s3-1.11.232.jar:?]
at com.amazonaws.services.s3.model.transform.Unmarshallers$ListObjectsUnmarshaller.unmarshall(Unmarshallers.java:70) ~[aws-java-sdk-s3-1.11.232.jar:?]
at com.amazonaws.services.s3.model.transform.Unmarshallers$ListObjectsUnmarshaller.unmarshall(Unmarshallers.java:59) ~[aws-java-sdk-s3-1.11.232.jar:?]
at com.amazonaws.services.s3.internal.S3XmlResponseHandler.handle(S3XmlResponseHandler.java:62) ~[aws-java-sdk-s3-1.11.232.jar:?]
at com.amazonaws.services.s3.internal.S3XmlResponseHandler.handle(S3XmlResponseHandler.java:31) ~[aws-java-sdk-s3-1.11.232.jar:?]
at com.amazonaws.http.response.AwsResponseHandlerAdapter.handle(AwsResponseHandlerAdapter.java:70) ~[aws-java-sdk-core-1.11.232.jar:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleResponse(AmazonHttpClient.java:1554) ~[aws-java-sdk-core-1.11.232.jar:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1272) ~[aws-java-sdk-core-1.11.232.jar:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1056) ~[aws-java-sdk-core-1.11.232.jar:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:743) ~[aws-java-sdk-core-1.11.232.jar:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:717) ~[aws-java-sdk-core-1.11.232.jar:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:699) ~[aws-java-sdk-core-1.11.232.jar:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:667) ~[aws-java-sdk-core-1.11.232.jar:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:649) ~[aws-java-sdk-core-1.11.232.jar:?]
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:513) ~[aws-java-sdk-core-1.11.232.jar:?]
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4319) ~[aws-java-sdk-s3-1.11.232.jar:?]
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4266) ~[aws-java-sdk-s3-1.11.232.jar:?]
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4260) ~[aws-java-sdk-s3-1.11.232.jar:?]
at com.amazonaws.services.s3.AmazonS3Client.listObjects(AmazonS3Client.java:831) ~[aws-java-sdk-s3-1.11.232.jar:?]
at org.apache.sshd.common.file.root.RootedFileSystemProvider$1.iterator(RootedFileSystemProvider.java:204) [sshd-core-2.1.0.jar:2.1.0]
at org.apache.sshd.server.subsystem.sftp.DirectoryHandle.<init>(DirectoryHandle.java:52) [sshd-sftp-2.1.0.jar:2.1.0]
at org.apache.sshd.server.subsystem.sftp.SftpSubsystem.doOpenDir(SftpSubsystem.java:746) [sshd-sftp-2.1.0.jar:2.1.0]
at org.apache.sshd.server.subsystem.sftp.AbstractSftpSubsystemHelper.doOpenDir(AbstractSftpSubsystemHelper.java:696) [sshd-sftp-2.1.0.jar:2.1.0]
at org.apache.sshd.server.subsystem.sftp.AbstractSftpSubsystemHelper.doProcess(AbstractSftpSubsystemHelper.java:369) [sshd-sftp-2.1.0.jar:2.1.0]
at org.apache.sshd.server.subsystem.sftp.SftpSubsystem.doProcess(SftpSubsystem.java:335) [sshd-sftp-2.1.0.jar:2.1.0]
at org.apache.sshd.server.subsystem.sftp.AbstractSftpSubsystemHelper.process(AbstractSftpSubsystemHelper.java:336) [sshd-sftp-2.1.0.jar:2.1.0]
at org.apache.sshd.server.subsystem.sftp.SftpSubsystem.run(SftpSubsystem.java:308) [sshd-sftp-2.1.0.jar:2.1.0]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_241]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_241]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_241]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_241]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_241]
Caused by: org.xml.sax.SAXParseException: The reference to entity "state" must end with the ';' delimiter.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203) ~[?:1.8.0_241]
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177) ~[?:1.8.0_241]
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400) ~[?:1.8.0_241]
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327) ~[?:1.8.0_241]
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1472) ~[?:1.8.0_241]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEntityReference(XMLDocumentFragmentScannerImpl.java:1850) ~[?:1.8.0_241]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3061) ~[?:1.8.0_241]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602) ~[?:1.8.0_241]
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112) ~[?:1.8.0_241]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505) ~[?:1.8.0_241]
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842) ~[?:1.8.0_241]
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771) ~[?:1.8.0_241]
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) ~[?:1.8.0_241]
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213) ~[?:1.8.0_241]
at com.amazonaws.services.s3.model.transform.XmlResponsesSaxParser.parseXmlInputStream(XmlResponsesSaxParser.java:147) ~[aws-java-sdk-s3-1.11.232.jar:?]
... 36 more
The things which i have tried to solve this are:
- Added encoding url as .withEncodingType("url"); but doesnt work.
- Updated the access of the bucket as public access.
Version of amazon sdk used is 1.11.232
Any idea how to resolve this issue?

Kerberos POST request returns 401 error with Java

I'm using KerberosTemplate to make a POST request to a kerberos authenticated rest API.
I can successfully run an insecure request on the command line but when I try to do a secure call with HTTP client It returns a 401 unauthorized error.
I tried to turn of certificate checking as we dont use it and I also tries the username without the domain but that has no affect either.
I also tried to kerb4j rest template too but I get the same issue. From the code you can also see that Im checking the keytab file exists as well.
Appreciate some help, thanks.
import ErrorHandlers.KerberosRestTemplateResponseErrorHandler;
import POJOs.PostBody;
import POJOs.PostResponse;
import com.fasterxml.jackson.databind.SerializationFeature;
//import com.kerb4j.client.spring.KerberosRestTemplate;
import org.springframework.security.kerberos.client.KerberosRestTemplate;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.TrustStrategy;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import javax.net.ssl.SSLContext;
import java.io.File;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;
public class KerbTemplate {
public static void main(String[] args) throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException {
PostBody postRequestBody = new PostBody();
postRequestBody.setAggregation("data");
postRequestBody.setEndDate("2119-03-30");
postRequestBody.setStartDate("1900-03-30");
postRequestBody.setMetadata(new String[] {"PARTIAL"});
postRequestBody.setSymbols(new String[] {"requestdata"});
postRequestBody.setModifiedDate("2019-07-20");
postRequestBody.setFirstWeekday("0");
TrustStrategy acceptingTrustStrategy = ((X509Certificate[] chain, String authType) -> true);
SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build();
SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext);
CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(csf).build();
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
requestFactory.setHttpClient(httpClient);
String base = System.getProperty("user.dir");
String keytab = base+ File.separator+"src"+File.separator+"main"+File.separator+"resources"+File.separator+"username.keytab";
System.out.println(keytab);
File f = new File(keytab);
if(f.exists() && !f.isDirectory()) {
System.out.println("File exists");
}
KerberosRestTemplate kerberosRestTemplate = new KerberosRestTemplate( keytab,"'username#domain",requestFactory.getHttpClient());
kerberosRestTemplate.setErrorHandler(new KerberosRestTemplateResponseErrorHandler());
MappingJackson2HttpMessageConverter jsonHttpMessageConverter = new MappingJackson2HttpMessageConverter();
jsonHttpMessageConverter.getObjectMapper().configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
kerberosRestTemplate.getMessageConverters().add(jsonHttpMessageConverter);
// Add CSRF header if required:
HttpHeaders headers = new HttpHeaders();
headers.set("X-Requested-By", "'username#domain");
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("Client-Type","Web");
headers.set("Client-UI-Component","Jim");
HttpEntity<PostBody> postRequest = new HttpEntity<PostBody>(postRequestBody, headers);
PostResponse pr = kerberosRestTemplate.postForObject("https://url.com/1/data/loadList", postRequest, PostResponse.class);
}
}
package ErrorHandlers;
import org.springframework.http.HttpStatus;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.web.client.ResponseErrorHandler;
import java.io.IOException;
public class KerberosRestTemplateResponseErrorHandler implements ResponseErrorHandler {
#Override
public boolean hasError(ClientHttpResponse httpResponse) throws IOException {
return (
httpResponse.getStatusCode().series() == HttpStatus.Series.CLIENT_ERROR
|| httpResponse.getStatusCode().series() == HttpStatus.Series.SERVER_ERROR);
}
#Override
public void handleError(ClientHttpResponse httpResponse) throws IOException {
System.out.println("Error Response code " + httpResponse.getRawStatusCode());
System.out.println(httpResponse.getStatusText());
System.out.println(httpResponse.getBody().toString());
}
}
Updated with Partial logs
1:56:58.233 [Finalizer] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection manager is shutting down
21:56:58.245 [Finalizer] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection manager shut down
21:58:30.261 [main] DEBUG org.springframework.security.kerberos.client.KerberosRestTemplate - HTTP POST myendpoint.com
21:58:30.460 [main] DEBUG org.springframework.security.kerberos.client.KerberosRestTemplate - Accept=[application/json, application/*+json]
21:58:30.500 [main] DEBUG org.springframework.security.kerberos.client.KerberosRestTemplate - Writing [ClassPojo [firstWeekday = 0, metadata = [Ljava.lang.String;#2f465398, endDate = 2119-03-30, modifiedDate = 2019-07-20, aggregation = DAILY, symbols = [Ljava.lang.String;#548e6d58, startDate = 1900-03-30]] as "application/json"
21:58:30.540 [main] DEBUG org.apache.http.client.protocol.RequestAddCookies - CookieSpec selected: default
21:58:30.561 [main] DEBUG org.apache.http.client.protocol.RequestAuthCache - Auth cache not set in the context
21:58:30.565 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection request: [route: {s}->myendpoint.com:443][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]
21:58:30.587 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection leased: [id: 0][route: {s}->myendpoint.com:443][total kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20]
21:58:30.591 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Opening connection {s}->myendpoint.com:443
21:58:30.617 [main] DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connecting to myendpoint.com:443
21:58:30.617 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Connecting socket to myendpoint.com:443 with timeout 0
21:58:30.747 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2]
21:58:30.747 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Enabled cipher suites:[TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
21:58:30.747 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Starting handshake
21:58:30.923 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Secure session established
21:58:30.923 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - negotiated protocol: TLSv1.2
21:58:30.924 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - negotiated cipher suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
21:58:30.933 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - peer principal: CN=myendpoint.com, O=EXAMPLE p.l.c.
21:58:30.934 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - peer alternative names: [myendpoint.com]
21:58:30.962 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Executing request POST /1/data/loadList HTTP/1.1
21:58:30.963 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Target auth state: UNCHALLENGED
21:58:30.968 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Proxy auth state: UNCHALLENGED
21:58:30.976 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> POST /1/data/loadList HTTP/1.1
21:58:30.979 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Accept: application/json, application/+json
21:58:30.979 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Client-Type: Fred
21:58:30.980 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Content-Type: application/json
21:58:30.981 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Client-UI-Component: Jim
21:58:30.981 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Content-Length: 220
21:58:30.982 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Host: myendpoint.com
21:58:30.983 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Connection: Keep-Alive
21:58:30.983 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.9 (Java/1.8.0_212-3-redhat)
21:58:30.983 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Accept-Encoding: gzip,deflate
21:58:30.984 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "POST /1/data/loadList HTTP/1.1[\r][\n]"
21:58:30.984 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Accept: application/json, application/+json[\r][\n]"
21:58:30.984 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Client-Type: Fred[\r][\n]"
21:58:30.985 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Content-Type: application/json[\r][\n]"
21:58:30.986 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Client-UI-Component: Jim[\r][\n]"
21:58:30.986 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Content-Length: 220[\r][\n]"
21:58:30.986 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Host: myendpoint.com[\r][\n]"
21:58:30.988 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
21:58:30.990 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "User-Agent: Apache-HttpClient/4.5.9 (Java/1.8.0_212-3-redhat)[\r][\n]"
21:58:30.990 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
21:58:30.991 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "[\r][\n]"
21:58:30.992 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "{"firstWeekday":"0","metadata":["All"],"endDate":"2119-03-30","modifiedDate":"2019-07-20","aggregation":"DAILY","symbols":["symbol1","symbol2"],"startDate":"1900-03-30"}"
21:58:31.043 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "HTTP/1.1 401 [\r][\n]"
21:58:31.043 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Access-Control-Allow-Credentials: true[\r][\n]"
21:58:31.043 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE[\r][\n]"
21:58:31.043 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Access-Control-Max-Age: 3600[\r][\n]"
21:58:31.043 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Access-Control-Allow-Headers: Client-Type, Content-Type, Accept, X-Requested-With, Authorization, rejectunauthorized[\r][\n]"
21:58:31.044 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "WWW-Authenticate: Negotiate[\r][\n]"
21:58:31.044 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "X-Content-Type-Options: nosniff[\r][\n]"
21:58:31.044 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "X-XSS-Protection: 1; mode=block[\r][\n]"
21:58:31.044 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Cache-Control: no-cache, no-store, max-age=0, must-revalidate[\r][\n]"
21:58:31.044 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Pragma: no-cache[\r][\n]"
21:58:31.044 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Expires: 0[\r][\n]"
21:58:31.044 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Strict-Transport-Security: max-age=31536000 ; includeSubDomains[\r][\n]"
21:58:31.044 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "X-Frame-Options: DENY[\r][\n]"
21:58:31.044 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Transfer-Encoding: chunked[\r][\n]"
21:58:31.044 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Date: Wed, 11 Sep 2019 20:58:31 GMT[\r][\n]"
21:58:31.044 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "[\r][\n]"
21:58:31.050 [main] DEBUG org.apache.http.headers - http-outgoing-0 << HTTP/1.1 401
21:58:31.050 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Access-Control-Allow-Credentials: true
21:58:31.050 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE
21:58:31.051 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Access-Control-Max-Age: 3600
21:58:31.051 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Access-Control-Allow-Headers: Client-Type, Content-Type, Accept, X-Requested-With, Authorization, rejectunauthorized
21:58:31.051 [main] DEBUG org.apache.http.headers - http-outgoing-0 << WWW-Authenticate: Negotiate
21:58:31.051 [main] DEBUG org.apache.http.headers - http-outgoing-0 << X-Content-Type-Options: nosniff
21:58:31.051 [main] DEBUG org.apache.http.headers - http-outgoing-0 << X-XSS-Protection: 1; mode=block
21:58:31.051 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Cache-Control: no-cache, no-store, max-age=0, must-revalidate
21:58:31.051 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Pragma: no-cache
21:58:31.051 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Expires: 0
21:58:31.051 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Strict-Transport-Security: max-age=31536000 ; includeSubDomains
21:58:31.051 [main] DEBUG org.apache.http.headers - http-outgoing-0 << X-Frame-Options: DENY
21:58:31.051 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Transfer-Encoding: chunked
21:58:31.051 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Date: Wed, 11 Sep 2019 20:58:31 GMT
21:58:31.063 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Connection can be kept alive indefinitely
21:58:31.063 [main] DEBUG org.apache.http.impl.auth.HttpAuthenticator - Authentication required
21:58:31.063 [main] DEBUG org.apache.http.impl.auth.HttpAuthenticator - myendpoint.com:443 requested authentication
21:58:31.063 [main] DEBUG org.apache.http.impl.client.TargetAuthenticationStrategy - Authentication schemes in the order of preference: [Negotiate, Kerberos, NTLM, CredSSP, Digest, Basic]
21:58:31.081 [main] DEBUG org.apache.http.impl.auth.SPNegoScheme - Received challenge '' from the auth server
21:58:31.082 [main] DEBUG org.apache.http.impl.client.TargetAuthenticationStrategy - Challenge for Kerberos authentication scheme not available
21:58:31.083 [main] DEBUG org.apache.http.impl.client.TargetAuthenticationStrategy - Challenge for NTLM authentication scheme not available
21:58:31.083 [main] DEBUG org.apache.http.impl.client.TargetAuthenticationStrategy - Challenge for CredSSP authentication scheme not available
21:58:31.083 [main] DEBUG org.apache.http.impl.client.TargetAuthenticationStrategy - Challenge for Digest authentication scheme not available
21:58:31.083 [main] DEBUG org.apache.http.impl.client.TargetAuthenticationStrategy - Challenge for Basic authentication scheme not available
21:58:31.093 [main] DEBUG org.springframework.security.kerberos.client.KerberosRestTemplate - Response 401 UNAUTHORIZED
Error Response code 401
21:58:31.096 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "0[\r][\n]"
21:58:31.097 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "[\r][\n]"
21:58:31.097 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection [id: 0][route: {s}->myendpoint.com:443] can be kept alive indefinitely
21:58:31.097 [main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-0: set socket timeout to 0
21:58:31.097 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection released: [id: 0][route: {s}->myendpoint.com:443][total kept alive: 1; route allocated: 1 of 2; total allocated: 1 of 20]
Process finished with exit code 0

Quickbooks integration error number 401

I'm new to quickbooks technology, I want to make an integration between Quick books and (CRUD-SampleApp-Java) application, each time I run "CustomerCreate" class I get this error:
"Error while calling entity add:: message=AuthenticationFailed; errorCode=003200; statusCode=401"
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/kjaber/.m2/repository/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/kjaber/.m2/repository/org/slf4j/slf4j-log4j12/1.7.21/slf4j-log4j12-1.7.21.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
0 [main] DEBUG org.apache.commons.configuration.ConfigurationUtils - ConfigurationUtils.locate(): base is null, name is intuit-config.xml
4 [main] DEBUG org.apache.commons.configuration.ConfigurationUtils - Loading configuration from the context classpath (intuit-config.xml)
34 [main] DEBUG org.apache.commons.configuration.ConfigurationUtils - ConfigurationUtils.locate(): base is null, name is intuit-default-config.xml
35 [main] DEBUG org.apache.commons.configuration.ConfigurationUtils - Loading configuration from the context classpath (intuit-default-config.xml)
63 [main] DEBUG com.intuit.logger - Enter PrepareRequestInterceptor...
149 [main] DEBUG com.intuit.logger - Exit PrepareRequestInterceptor.
149 [main] DEBUG com.intuit.logger - Enter SerializeInterceptor...
149 [main] INFO com.intuit.logger - serialization format : json
517 [main] DEBUG com.intuit.logger - Exit SerializeInterceptor.
517 [main] DEBUG com.intuit.logger - Enter CompressionInterceptor...
517 [main] INFO com.intuit.logger - compression format : gzip
519 [main] DEBUG com.intuit.logger - Exit CompressionInterceptor.
519 [main] DEBUG com.intuit.logger - Enter HTTPClientConnectionInterceptor...
856 [main] DEBUG com.intuit.logger - Request URI : https://sandbox-quickbooks.api.intuit.com/v3/company/193514552765139/customer?requestid=aa62bd10e21848f8a1ade7f666e59546&minorversion=12&
856 [main] DEBUG com.intuit.logger - Http Method : POST
856 [main] DEBUG com.intuit.logger - Request Body : {"DisplayName":"0hmQ77"}
868 [main] DEBUG org.apache.http.client.protocol.RequestAddCookies - CookieSpec selected: default
877 [main] DEBUG org.apache.http.client.protocol.RequestAuthCache - Auth cache not set in the context
878 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection request: [route: {s}->https://sandbox-quickbooks.api.intuit.com:443][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]
891 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection leased: [id: 0][route: {s}->https://sandbox-quickbooks.api.intuit.com:443][total kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20]
892 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Opening connection {s}->https://sandbox-quickbooks.api.intuit.com:443
1133 [main] DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connecting to sandbox-quickbooks.api.intuit.com/12.149.173.155:443
1133 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Connecting socket to sandbox-quickbooks.api.intuit.com/12.149.173.155:443 with timeout 0
1410 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2]
1410 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Enabled cipher suites:[TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
1410 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Starting handshake
2209 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - Secure session established
2209 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - negotiated protocol: TLSv1.2
2209 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - negotiated cipher suite: TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
2210 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - peer principal: CN=*.api.intuit.com, OU=CTO-DEV-ICS Ops, O=INTUIT INC., L=San Diego, ST=California, C=US
2210 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - peer alternative names: [api.intuit.com, *.api.intuit.com, api.intuit.net, *.api.intuit.net]
2211 [main] DEBUG org.apache.http.conn.ssl.SSLConnectionSocketFactory - issuer principal: CN=Symantec Class 3 Secure Server CA - G4, OU=Symantec Trust Network, O=Symantec Corporation, C=US
2217 [main] DEBUG org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connection established 172.16.1.19:60298<->12.149.173.155:443
2217 [main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-0: set socket timeout to 0
2217 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Executing request POST /v3/company/193514552765139/customer?requestid=aa62bd10e21848f8a1ade7f666e59546&minorversion=12& HTTP/1.1
2218 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Proxy auth state: UNCHALLENGED
2221 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> POST /v3/company/193514552765139/customer?requestid=aa62bd10e21848f8a1ade7f666e59546&minorversion=12& HTTP/1.1
2221 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Accept: application/json
2221 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Content-Encoding: gzip
2221 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> content-type: application/json
2221 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Accept-Encoding: gzip
2221 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> User-Agent: V3JavaSDK3.0.0
2221 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Authorization: Bearer L011505900548zBbxMrQrmfBnApHFLwR8KslQ7zzVL2fgB0XaJ
2221 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Content-Length: 44
2221 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Host: sandbox-quickbooks.api.intuit.com
2221 [main] DEBUG org.apache.http.headers - http-outgoing-0 >> Connection: Keep-Alive
2222 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "POST /v3/company/193514552765139/customer?requestid=aa62bd10e21848f8a1ade7f666e59546&minorversion=12& HTTP/1.1[\r][\n]"
2222 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Accept: application/json[\r][\n]"
2222 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Content-Encoding: gzip[\r][\n]"
2222 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "content-type: application/json[\r][\n]"
2222 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Accept-Encoding: gzip[\r][\n]"
2222 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "User-Agent: V3JavaSDK3.0.0[\r][\n]"
2222 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Authorization: Bearer L011505900548zBbxMrQrmfBnApHFLwR8KslQ7zzVL2fgB0XaJ[\r][\n]"
2222 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Content-Length: 44[\r][\n]"
2222 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Host: sandbox-quickbooks.api.intuit.com[\r][\n]"
2223 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
2223 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "[\r][\n]"
2223 [main] DEBUG org.apache.http.wire - http-outgoing-0 >> "[0x1f][0x8b][0x8][0x0][0x0][0x0][0x0][0x0][0x0][0x0][0xab]Vr[0xc9],.[0xc8]I[0xac][0xf4]K[0xcc]MU[0xb2]R2[0xc8][0xc8][\r]47W[0xaa][0x5][0x0]&[0xe6][0xb0][0x18][0x0][0x0][0x0]"
2490 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "HTTP/1.1 401 Unauthorized[\r][\n]"
2490 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Server: nginx[\r][\n]"
2490 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Date: Wed, 20 Sep 2017 09:37:07 GMT[\r][\n]"
2490 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Content-Type: text/xml[\r][\n]"
2490 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Content-Length: 388[\r][\n]"
2490 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Connection: keep-alive[\r][\n]"
2490 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "Keep-Alive: timeout=5[\r][\n]"
2490 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "intuit_tid: 9856d20d-f8ce-d77c-024f-3cdcf258e401[\r][\n]"
2491 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "WWW-Authenticate: Bearer realm="Intuit", error="invalid_token"[\r][\n]"
2491 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "[\r][\n]"
2491 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "<?xml version="1.0" encoding="UTF-8" standalone="yes"?>[\n]"
2491 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "<IntuitResponse time="2017-09-20T02:37:07.562-07:00" xmlns="http://schema.intuit.com/finance/v3">[\n]"
2491 [main] DEBUG org.apache.http.wire - http-outgoing-0 << " <Fault type="AUTHENTICATION">[\n]"
2491 [main] DEBUG org.apache.http.wire - http-outgoing-0 << " <Error code="3200">[\n]"
2491 [main] DEBUG org.apache.http.wire - http-outgoing-0 << " <Message>message=AuthenticationFailed; errorCode=003200; statusCode=401</Message>[\n]"
2491 [main] DEBUG org.apache.http.wire - http-outgoing-0 << " <Detail></Detail>[\n]"
2491 [main] DEBUG org.apache.http.wire - http-outgoing-0 << " </Error>[\n]"
2491 [main] DEBUG org.apache.http.wire - http-outgoing-0 << " </Fault>[\n]"
2491 [main] DEBUG org.apache.http.wire - http-outgoing-0 << "</IntuitResponse>[\n]"
2495 [main] DEBUG org.apache.http.headers - http-outgoing-0 << HTTP/1.1 401 Unauthorized
2495 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Server: nginx
2495 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Date: Wed, 20 Sep 2017 09:37:07 GMT
2495 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Content-Type: text/xml
2496 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Content-Length: 388
2496 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Connection: keep-alive
2496 [main] DEBUG org.apache.http.headers - http-outgoing-0 << Keep-Alive: timeout=5
2496 [main] DEBUG org.apache.http.headers - http-outgoing-0 << intuit_tid: 9856d20d-f8ce-d77c-024f-3cdcf258e401
2496 [main] DEBUG org.apache.http.headers - http-outgoing-0 << WWW-Authenticate: Bearer realm="Intuit", error="invalid_token"
2503 [main] DEBUG org.apache.http.impl.execchain.MainClientExec - Connection can be kept alive for 5000 MILLISECONDS
2503 [main] DEBUG org.apache.http.impl.auth.HttpAuthenticator - Authentication required
2503 [main] DEBUG org.apache.http.impl.auth.HttpAuthenticator - sandbox-quickbooks.api.intuit.com:443 requested authentication
2503 [main] DEBUG org.apache.http.impl.client.TargetAuthenticationStrategy - Authentication schemes in the order of preference: [Negotiate, Kerberos, NTLM, Digest, Basic]
2503 [main] DEBUG org.apache.http.impl.client.TargetAuthenticationStrategy - Challenge for Negotiate authentication scheme not available
2503 [main] DEBUG org.apache.http.impl.client.TargetAuthenticationStrategy - Challenge for Kerberos authentication scheme not available
2504 [main] DEBUG org.apache.http.impl.client.TargetAuthenticationStrategy - Challenge for NTLM authentication scheme not available
2504 [main] DEBUG org.apache.http.impl.client.TargetAuthenticationStrategy - Challenge for Digest authentication scheme not available
2504 [main] DEBUG org.apache.http.impl.client.TargetAuthenticationStrategy - Challenge for Basic authentication scheme not available
2508 [main] DEBUG com.intuit.logger - Connection status : HTTP/1.1 401 Unauthorized
2509 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection [id: 0][route: {s}->https://sandbox-quickbooks.api.intuit.com:443] can be kept alive for 5.0 seconds
2509 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection released: [id: 0][route: {s}->https://sandbox-quickbooks.api.intuit.com:443][total kept alive: 1; route allocated: 1 of 2; total allocated: 1 of 20]
2509 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection manager is shutting down
2509 [main] DEBUG org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-0: Close connection
2510 [main] DEBUG org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection manager shut down
2511 [main] DEBUG com.intuit.logger - Exit HTTPClientConnectionInterceptor.
2511 [main] DEBUG com.intuit.logger - Enter DecompressInterceptor...
2511 [main] DEBUG com.intuit.logger - Decompressed Response Body : <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<IntuitResponse time="2017-09-20T02:37:07.562-07:00" xmlns="http://schema.intuit.com/finance/v3">
<Fault type="AUTHENTICATION">
<Error code="3200">
<Message>message=AuthenticationFailed; errorCode=003200; statusCode=401</Message>
<Detail></Detail>
</Error>
</Fault>
</IntuitResponse>
2511 [main] DEBUG com.intuit.logger - Exit DecompressInterceptor.
2511 [main] DEBUG com.intuit.logger - Enter DeserializeInterceptor...
2511 [main] INFO com.intuit.logger - HttpResponse content-type (deserialization format) : xml
2512 [main] DEBUG com.intuit.logger - HttpResponse content-type (deserialization format) : xml
3585 [main] DEBUG com.intuit.logger - Exit DeserializeInterceptor.
3585 [main] DEBUG com.intuit.logger - Enter HandleResponseInterceptor...
3586 [main] ERROR com.intuit.logger - Error while calling entity add:: message=AuthenticationFailed; errorCode=003200; statusCode=401
notice that I did the following configurations:
In intuit-config.xml>>
<?xml version="1.0" encoding="UTF-8"?>
<intuit-config>
<baseURL>
<qbo>https://sandbox-quickbooks.api.intuit.com/v3/company</qbo>
</baseURL>
</intuit-config>
In config.properties
I used https://developer.intuit.com/v2/ui#/playground to get this information from.
>
#For OAuth2 app set oauth.type=2
oauth.type=2
#OAuth2 access token
oauth2.accessToken =L011505900548zBbxMrQrmfBnApHFLwR8KslQ7zzVL2fgB0XaJ
#company id or realmId
company.id=193514552765139
#OAuth1 keys
app.token=
consumer.key=
consumer.secret=
oauth.accessToken=
oauth.accessTokenSecret=
Java build : 1.8.0_144
And i have added (ipp-v3-java-data,ipp-v3-java-devkit,oauth2-platform-api) to make the project build successfully

How to Create new project in Rally using RallyRestApi

In the following code I am trying to create a new project using RallyRestApi,
RallyMain {
public static void main(String[] a) {
BasicConfigurator.configure();
try {
RallyRestApi restApi = new RallyRestApi(new URI(
"https://rally1.rallydev.com"), "_APIKey");
restApi.setApplicationName("RallyRestExample");
restApi.setWsapiVersion("v2.0");
JsonObject newProject = new JsonObject();
newProject.addProperty("Name", "Sample Project One");
newProject.addProperty("Description", "Sample project for testing API");
//newProject.addProperty("Owner", "nmuthusamy");
newProject.addProperty("Workspace", "/workspace/Workspace 1");
CreateRequest createRequest = new CreateRequest("Project", newProject);
CreateResponse createResponse = restApi.create(createRequest);
System.out.println("Response "+createResponse.wasSuccessful());
} catch (Exception e) {
System.out.println("Exception \n"+e);
}
}
}
When I run the above code new project was not created on the Rally workspace.System.out.println("Response "+createResponse.wasSuccessful()); always prints false. Here ScreenShot of my rally workspace I have also attached the screen of my Workspace
I have even followed the answer given in this link Stackoverflow but it is not woking.
Following is the console log which I get when I run the main method.
0 [main] DEBUG org.apache.http.impl.conn.BasicClientConnectionManager - Get connection for route {s}->https://rally1.rallydev.com:443
15 [main] DEBUG org.apache.http.impl.conn.DefaultClientConnectionOperator - Connecting to rally1.rallydev.com:443
448 [main] DEBUG org.apache.http.client.protocol.RequestAddCookies - CookieSpec selected: default
449 [main] DEBUG org.apache.http.client.protocol.RequestAuthCache - Auth cache not set in the context
449 [main] DEBUG org.apache.http.client.protocol.RequestTargetAuthentication - Target auth state: UNCHALLENGED
450 [main] DEBUG org.apache.http.client.protocol.RequestProxyAuthentication - Proxy auth state: UNCHALLENGED
450 [main] DEBUG com.rallydev.rest.client.ApiKeyClient - Attempt 1 to execute request
450 [main] DEBUG org.apache.http.impl.conn.DefaultClientConnection - Sending request: POST /slm/webservice/v2.0/project/create.js?fetch=true HTTP/1.1
450 [main] DEBUG org.apache.http.wire - >> "POST /slm/webservice/v2.0/project/create.js?fetch=true HTTP/1.1[\r][\n]"
451 [main] DEBUG org.apache.http.wire - >> "zsessionid: _F99sUCMTR7OsOz4IpiCWp5Xl1UYRJ0wFqBpg5Wz5kFg[\r][\n]"
451 [main] DEBUG org.apache.http.wire - >> "X-RallyIntegrationLibrary: Rally Rest API for Java v2.2.1[\r][\n]"
451 [main] DEBUG org.apache.http.wire - >> "X-RallyIntegrationVersion: 2.2.1[\r][\n]"
451 [main] DEBUG org.apache.http.wire - >> "X-RallyIntegrationName: RallyRestExample[\r][\n]"
451 [main] DEBUG org.apache.http.wire - >> "X-RallyIntegrationVendor: Rally Software, Inc.[\r][\n]"
451 [main] DEBUG org.apache.http.wire - >> "Accept-Encoding: gzip,deflate[\r][\n]"
451 [main] DEBUG org.apache.http.wire - >> "Content-Length: 125[\r][\n]"
451 [main] DEBUG org.apache.http.wire - >> "Content-Type: text/plain; charset=UTF-8[\r][\n]"
451 [main] DEBUG org.apache.http.wire - >> "Host: rally1.rallydev.com[\r][\n]"
451 [main] DEBUG org.apache.http.wire - >> "Connection: Keep-Alive[\r][\n]"
451 [main] DEBUG org.apache.http.wire - >> "User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_40)[\r][\n]"
451 [main] DEBUG org.apache.http.wire - >> "[\r][\n]"
452 [main] DEBUG org.apache.http.headers - >> POST /slm/webservice/v2.0/project/create.js?fetch=true HTTP/1.1
452 [main] DEBUG org.apache.http.headers - >> zsessionid: _ApiKey
452 [main] DEBUG org.apache.http.headers - >> X-RallyIntegrationLibrary: Rally Rest API for Java v2.2.1
452 [main] DEBUG org.apache.http.headers - >> X-RallyIntegrationVersion: 2.2.1
452 [main] DEBUG org.apache.http.headers - >> X-RallyIntegrationName: RallyRestExample
452 [main] DEBUG org.apache.http.headers - >> X-RallyIntegrationVendor: Rally Software, Inc.
452 [main] DEBUG org.apache.http.headers - >> Accept-Encoding: gzip,deflate
452 [main] DEBUG org.apache.http.headers - >> Content-Length: 125
452 [main] DEBUG org.apache.http.headers - >> Content-Type: text/plain; charset=UTF-8
452 [main] DEBUG org.apache.http.headers - >> Host: rally1.rallydev.com
452 [main] DEBUG org.apache.http.headers - >> Connection: Keep-Alive
452 [main] DEBUG org.apache.http.headers - >> User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_40)
452 [main] DEBUG org.apache.http.wire - >> "{"Project":{"Name":"Sample Project One","Description":"Sample project for testing API","Workspace":"/workspace/Workspace 1"}}"
1719 [main] DEBUG org.apache.http.wire - << "HTTP/1.1 200 OK[\r][\n]"
1720 [main] DEBUG org.apache.http.wire - << "Date: Sat, 10 Jun 2017 07:59:30 GMT[\r][\n]"
1720 [main] DEBUG org.apache.http.wire - << "Content-Type: application/json; charset=utf-8[\r][\n]"
1720 [main] DEBUG org.apache.http.wire - << "Content-Length: 176[\r][\n]"
1720 [main] DEBUG org.apache.http.wire - << "Connection: keep-alive[\r][\n]"
1720 [main] DEBUG org.apache.http.wire - << "Set-Cookie: __cfduid=dc354f67bed2fd443e4bbd5081140f56d1497081569; expires=Sun, 10-Jun-18 07:59:29 GMT; path=/; domain=.rallydev.com; HttpOnly[\r][\n]"
1720 [main] DEBUG org.apache.http.wire - << "X-XSS-Protection: 1; mode=block[\r][\n]"
1720 [main] DEBUG org.apache.http.wire - << "RallyRequestID: qd-app-071j56j3qgdx7xfhnyq78y1yxw7.qd-app-075984713[\r][\n]"
1720 [main] DEBUG org.apache.http.wire - << "Expires: Thu, 01 Jan 1970 00:00:00 GMT[\r][\n]"
1720 [main] DEBUG org.apache.http.wire - << "Set-Cookie: JSESSIONID=qd-app-071j56j3qgdx7xfhnyq78y1yxw7.qd-app-07;Path=/;Secure;HttpOnly[\r][\n]"
1720 [main] DEBUG org.apache.http.wire - << "Set-Cookie: SUBBUCKETID=108;Path=/;Domain=rally1.rallydev.com;Secure;HttpOnly[\r][\n]"
1720 [main] DEBUG org.apache.http.wire - << "Set-Cookie: SUBSCRIPTIONID=122108;Path=/;Domain=rally1.rallydev.com;Secure;HttpOnly[\r][\n]"
1720 [main] DEBUG org.apache.http.wire - << "Vary: Accept-Encoding[\r][\n]"
1720 [main] DEBUG org.apache.http.wire - << "Content-Encoding: gzip[\r][\n]"
1721 [main] DEBUG org.apache.http.wire - << "P3P: CP="NON DSP COR CURa PSAa PSDa OUR NOR BUS PUR COM NAV STA"[\r][\n]"
1721 [main] DEBUG org.apache.http.wire - << "Cache-Control: private,max-age=0,must-revalidate[\r][\n]"
1721 [main] DEBUG org.apache.http.wire - << "Strict-Transport-Security: max-age=31536000; includeSubDomains; preload;[\r][\n]"
1721 [main] DEBUG org.apache.http.wire - << "Set-Cookie: SERVERID=2dd8f75e6436014e8021e4a12eb0016859253e05; path=/[\r][\n]"
1721 [main] DEBUG org.apache.http.wire - << "Server: cloudflare-nginx[\r][\n]"
1721 [main] DEBUG org.apache.http.wire - << "CF-RAY: 36cacaa1dd7c2ee7-DEL[\r][\n]"
1721 [main] DEBUG org.apache.http.wire - << "[\r][\n]"
1722 [main] DEBUG org.apache.http.impl.conn.DefaultClientConnection - Receiving response: HTTP/1.1 200 OK
1722 [main] DEBUG org.apache.http.headers - << HTTP/1.1 200 OK
1722 [main] DEBUG org.apache.http.headers - << Date: Sat, 10 Jun 2017 07:59:30 GMT
1722 [main] DEBUG org.apache.http.headers - << Content-Type: application/json; charset=utf-8
1722 [main] DEBUG org.apache.http.headers - << Content-Length: 176
1722 [main] DEBUG org.apache.http.headers - << Connection: keep-alive
1722 [main] DEBUG org.apache.http.headers - << Set-Cookie: __cfduid=dc354f67bed2fd443e4bbd5081140f56d1497081569; expires=Sun, 10-Jun-18 07:59:29 GMT; path=/; domain=.rallydev.com; HttpOnly
1722 [main] DEBUG org.apache.http.headers - << X-XSS-Protection: 1; mode=block
1722 [main] DEBUG org.apache.http.headers - << RallyRequestID: qd-app-071j56j3qgdx7xfhnyq78y1yxw7.qd-app-075984713
1722 [main] DEBUG org.apache.http.headers - << Expires: Thu, 01 Jan 1970 00:00:00 GMT
1722 [main] DEBUG org.apache.http.headers - << Set-Cookie: JSESSIONID=_jsessionid;Path=/;Secure;HttpOnly
1722 [main] DEBUG org.apache.http.headers - << Set-Cookie: SUBBUCKETID=108;Path=/;Domain=rally1.rallydev.com;Secure;HttpOnly
1722 [main] DEBUG org.apache.http.headers - << Set-Cookie: SUBSCRIPTIONID=122108;Path=/;Domain=rally1.rallydev.com;Secure;HttpOnly
1722 [main] DEBUG org.apache.http.headers - << Vary: Accept-Encoding
1723 [main] DEBUG org.apache.http.headers - << Content-Encoding: gzip
1723 [main] DEBUG org.apache.http.headers - << P3P: CP="NON DSP COR CURa PSAa PSDa OUR NOR BUS PUR COM NAV STA"
1723 [main] DEBUG org.apache.http.headers - << Cache-Control: private,max-age=0,must-revalidate
1723 [main] DEBUG org.apache.http.headers - << Strict-Transport-Security: max-age=31536000; includeSubDomains; preload;
1723 [main] DEBUG org.apache.http.headers - << Set-Cookie: SERVERID=_serverid; path=/
1723 [main] DEBUG org.apache.http.headers - << Server: cloudflare-nginx
1723 [main] DEBUG org.apache.http.headers - << CF-RAY: 36cacaa1dd7c2ee7-DEL
1736 [main] DEBUG org.apache.http.client.protocol.ResponseProcessCookies - Cookie accepted [__cfduid="_cfduid", version:0, domain:rallydev.com, path:/, expiry:Sun Jun 10 13:29:29 IST 2018]
1736 [main] DEBUG org.apache.http.client.protocol.ResponseProcessCookies - Cookie accepted [JSESSIONID="_jsessionid", version:0, domain:rally1.rallydev.com, path:/, expiry:null]
1736 [main] DEBUG org.apache.http.client.protocol.ResponseProcessCookies - Cookie accepted [SUBBUCKETID="108", version:0, domain:rally1.rallydev.com, path:/, expiry:null]
1737 [main] DEBUG org.apache.http.client.protocol.ResponseProcessCookies - Cookie accepted [SUBSCRIPTIONID="999999", version:0, domain:rally1.rallydev.com, path:/, expiry:null]
1737 [main] DEBUG org.apache.http.client.protocol.ResponseProcessCookies - Cookie accepted [SERVERID="_serverid", version:0, domain:rally1.rallydev.com, path:/, expiry:null]
1738 [main] DEBUG com.rallydev.rest.client.ApiKeyClient - Connection can be kept alive indefinitely
1750 [main] DEBUG org.apache.http.wire - << "[0x1f]"
1750 [main] DEBUG org.apache.http.wire - << "[0x8b]"
1750 [main] DEBUG org.apache.http.wire - << "[0x8]"
1750 [main] DEBUG org.apache.http.wire - << "[0x0]"
1750 [main] DEBUG org.apache.http.wire - << "[0x0][0x0][0x0][0x0][0x0][0x3]"
1750 [main] DEBUG org.apache.http.wire - << "M[0xce][0xb1][\n]"
1751 [main] DEBUG org.apache.http.wire - << "[0xc2]#[0xc][0x6][0xe0]W[0x9][0x99][0xa5][0x88]c7[0xa9][0xe][0x1d]D[0xd1][0xa1][0x83]-r[0xb6][0xb1][0xb4][0x1c]I[0xc9][0xdd][\r]R[0xfa][0xee]FEp[0x9][0xe4]#[0xf9][0x93][0x19][0xb]%[0x17][0xe9]L![0xf9][0x88]9[0xcc]xS[0xe7][0xfd]s{*[0xf]n[0x14]5[0xc2][\r][0xae][0xe0][0x8f][0x7][0xfe][0xf2][0xfa][0xcd]{U[0xd1]`[0xed][0x15][0xb]I[0xbe][0x3][0x96][0x8][0x16][0xd9][0xe5]p[0xbc][0x8f][0xd4][0xc6][0xf]<$qgUX[0xee]r[0xe0][0xe4]=6[0x96]Q9[0xe5][0x81][0xfb]oJ[0x19]a[0x8][0xb6][0x4]^[0xb8]'[0x5][0xa6][0x96]Bp[0xfa][0x84]([0xe0][0xa6][0x89],[0xa8][0xc6]l[0xc]5[0xbe][0xa5][0xba][0xd8]Kv0HR[0x1b][0xcc][0xb0]Y[0x96][0x17][0xef][0xff][0xd1]?[0xd5][0x0][0x0][0x0]"
1751 [main] DEBUG org.apache.http.impl.conn.BasicClientConnectionManager - Releasing connection org.apache.http.impl.conn.ManagedClientConnectionImpl#23986957
1751 [main] DEBUG org.apache.http.impl.conn.BasicClientConnectionManager - Connection can be kept alive indefinitely
Response false
Thanks,
Nithyananth
Check out the errors in your response. The fact that wasSuccessful returns false means there were problems with your create.
String errors = createResponse.getErrors();
System.out.println(errors[0]);
One problem is that your workspace reference is by name- they need to be by ref (which is of the format /[type]/[objectid])
newProject.addProperty("Workspace", "/workspace/12345");

Categories

Resources