Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8372

Re: How to call servlet from Java application on HCP?

$
0
0

Hi Matthias,

 

we are running on HCP dev landscape. our servlet is also running on HCP. Our web app which schedule a background job (which will call servlet) is also running on HCP.

This is a very basic scenario to support loosely coupled architecture.

I copied the code in the link you provided and configured destination for my servlet. the code is like below.   But I got following error message:

 

java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequest

 

 

Do you know why? Is some Maven dependency missing?

 

Best regards

 

Ying

 

 

-----------------------------------------------------------------------------------------------------------

Code:

 

 

 

            // Get HTTP destination

            Context ctx = new InitialContext();           

            HttpDestination destination = (HttpDestination) ctx.lookup("java:comp/env/" +  "JCOTest");

            httpClient = destination.createHttpClient();

           

            final String baseURL = destination.getURI().toString();

           

            String destinationURL = null;

            destinationURL = baseURL;

 

            httpGet = new HttpGet(destinationURL);

       logger.error("after call HTTP request");

      

            HttpResponse httpResponse = httpClient.execute(httpGet);

         logger.error("get HTTP response");

        

            // Check response status code

            int statusCode = httpResponse.getStatusLine().getStatusCode();


Viewing all articles
Browse latest Browse all 8372

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>