Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7599187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:36:02+00:00 2026-05-30T22:36:02+00:00

I am trying to make get requests by a servlet in my GWT application.

  • 0

I am trying to make get requests by a servlet in my GWT application. On compiling the code I am getting these errors.

[ERROR] Line 16: No source code is available for type org.apache.http.client.ClientProtocolException; did you forget to inherit a required module?
[ERROR] Line 16: No source code is available for type org.apache.http.ParseException; did you forget to inherit a required module?
[ERROR] Line 16: No source code is available for type org.json.simple.parser.ParseException; did you forget to inherit a required module?

What should I do to remove these errors?
Are these classes are not supported by GWT?

Following is the code I am using

public String getJSON() throws ClientProtocolException, IOException, ParseException{
    HttpClient httpclient = new DefaultHttpClient(); 
    JSONParser parser = new JSONParser();
    String url = "some - url - can't disclose";
    HttpResponse response = httpclient.execute(new HttpGet(url));
    JSONObject json_data = (JSONObject)parser.parse(EntityUtils.toString(response.getEntity()));
    JSONArray results = (JSONArray)json_data.get("result");
}

This code is working fine If I use this on a usual java project/ console application.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T22:36:03+00:00Added an answer on May 30, 2026 at 10:36 pm

    Java code running in GWT is translated to Javascript, so some classes that work on a JVM won’t work with GWT. The HttpClient and related classes are written to work on a JVM with full support for opening sockets, something that isn’t allowed in a web browser, so these classes cannot be used.

    To open a connection to the server you are using (subject to the browser Same Origin Policy), consider the RequestBuilder class, which allows you to provide a url and an HTTP method, and optionally headers, parameters, data, etc. This class is an abstraction over the XmlHttpRequest object in JavaScript, commonly used for AJAX requests in plain JS.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Getting this error on chrome while trying to make cross-domain requests with GWT application.
I am trying to make a get request from the GWT servlet to get
Can't seem to figure this out, see code below. Trying to make a GET
I'm trying to make my C# application multi threaded because sometimes, I get an
I'm trying to make a notification in Android. But i get the error in
Hi I am trying to make 2 GET requests to a single connection. ie
I'm trying to make a dynamic array in C# but I get an annoying
I'm trying to make a drop down menu using javascript/jquery but can't get my
I'm trying to make some text bold using HTML, but I'm struggling to get
Hi iam trying to make an update trigger in my database. But i get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.