I got a problem with a httpPost from a Java-Application which is running on HCP-Trial-Account in a Tomcat7-Container. I use HttpClient 4.5.3.
The code runs on my local Tomcat7-Server fine and works. However, if deploy it to the HCP there occurs a problem.
public static Notebook getAllNotebooks(String code, String redirectUri) throws IOException, URISyntaxException{
ClassLoader classLoader = Connection.class.getClassLoader();
URL resource = classLoader.getResource("org/apache/http/impl/client/HttpClientBuilder.class");
String returnUri = "https://login.live.com/oauth20_token.srf";
HttpPost tokenRequest = new HttpPost(returnUri);
HttpClient client = new DefaultHttpClient();//HttpClientBuilder.create().build(); //Exception: http://stackoverflow.com/questions/22330848/httpclient-example-exception-in-thread-main-java-lang-nosuchfielderror-inst
tokenRequest.setHeader(HttpHeaders.CONTENT_TYPE, "application/x-www-form-urlencoded");
tokenRequest.setEntity(new UrlEncodedFormEntity(Connection.getParametersForURLBody(code, redirectUri), Consts.UTF_8));
tokenRequest.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0");
HttpResponse tokenResponse = client.execute(tokenRequest); //Here it gets stuck
The problem occurs when the tokenRequest is executed. The application gets stuck and the tokenRequest runs forever.
Here are the threads that are running forever which I can see in debug mode:
SAP JVM Debug Target
Daemon Thread [NioBlockingSelector.BlockPoller-1] (Running)
Daemon Thread [NioBlockingSelector.BlockPoller-2] (Running)
Daemon Thread [RMI TCP Connection(1)-127.0.0.1] (Running)
Thread [Timer-0] (Running)
Daemon Thread [RMI TCP Connection(2)-10.117.35.76] (Running)
Thread [pool-1-thread-1] (Running)
Thread [Timer-1] (Running)
Daemon Thread [ContainerBackgroundProcessor[StandardEngine[Catalina]]] (Running)
Daemon Thread [JCoTimeoutChecker] (Running)
Daemon Thread [http-bio-8001-Acceptor-0] (Running)
Daemon Thread [http-bio-8001-AsyncTimeout] (Running)
Daemon Thread [http-nio-127.0.0.1-9001-ClientPoller-0] (Running)
Daemon Thread [http-nio-127.0.0.1-9001-Acceptor-0] (Running)
Daemon Thread [http-nio-8041-ClientPoller-0] (Running)
Daemon Thread [http-nio-8041-Acceptor-0] (Running)
Daemon Thread [ajp-bio-8009-Acceptor-0] (Running)
Daemon Thread [ajp-bio-8009-AsyncTimeout] (Running)
Daemon Thread [RMI TCP Connection(10)-127.0.0.1] (Running)
Daemon Thread [RMI TCP Connection(11)-10.117.10.34] (Running)
Thread [main] (Running)
Daemon Thread [http-nio-8041-exec-1] (Running)
Daemon Thread [http-nio-8041-exec-2] (Running)
Daemon Thread [http-nio-8041-exec-3] (Running)
Daemon Thread [http-nio-8041-exec-4] (Running)
Daemon Thread [http-nio-8041-exec-5] (Running)
Thread [pool-2-thread-1] (Running)
Daemon Thread [http-nio-8041-exec-6] (Stepping)
Daemon Thread [http-nio-8041-exec-7] (Running)
Daemon Thread [http-nio-8041-exec-8] (Running)
Daemon Thread [http-nio-8041-exec-9] (Running)
Daemon Thread [http-nio-8041-exec-10] (Running)
Daemon Thread [RMI TCP Connection(idle)] (Running)
Daemon Thread [RMI TCP Connection(idle)] (Running)
The program gets stucked at this point.
I have no clue what to do and would really appreciate some hints and help :).
Greetings Maverin