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 7661901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:40:03+00:00 2026-05-31T13:40:03+00:00

I have a server that has on it a servlet that functions as the

  • 0

I have a server that has on it a servlet that functions as the back end of my mobile app. It works fine on my computer when I test it in Eclipse but when I try to get data from the server, this comes out in the log.

Mar 15, 2012 4:38:37 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [Hello] in context with path [] threw exception
java.io.UnsupportedEncodingException: The character encoding [ISO-8859-1, application/json] is not supported
at org.apache.tomcat.util.buf.B2CConverter.getCharset(B2CConverter.java:74)
at org.apache.tomcat.util.buf.B2CConverter.reset(B2CConverter.java:159)
at org.apache.tomcat.util.buf.B2CConverter.<init>(B2CConverter.java:97)
at org.apache.catalina.connector.InputBuffer.setConverter(InputBuffer.java:556)
at org.apache.catalina.connector.InputBuffer.checkConverter(InputBuffer.java:518)
at org.apache.catalina.connector.Request.getReader(Request.java:1238)
at org.apache.catalina.connector.RequestFacade.getReader(RequestFacade.java:505)
at com.myserver.server.Hello.decodeRequest(Hello.java:319)
at com.myserver.server.Hello.doPost(Hello.java:93)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:1763)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

What is going on? Is it the hosting company or me?

EDIT: here is a list of the jars I am using.

asm-3.1.jar

jackson-core-asl-1.8.3.jar

jackson-jaxrs-1.8.3.jar

jackson-mapper-asl-1.8.3.jar

jackson-xc-1.8.3.jar

jersey-client-1.10.jar

jersey-core-1.10.jar

jersey-json-1.10.jar

jersey-server-1.10.jar

jersey-servlet-1.10.jar

jettison-1.1.jar

jsr311-api-1.1.1.jar

sqlite-jdbc-3.7.2.jar

The code that posts the JSON:

public class SendJSON{
JSONArray outr = new JSONArray();

GetSet gs = new GetSet();
URI u;
String out;

public JSONArray sendJ(final JSONArray json) throws JSONException{

    ATask task = new ATask(json);
    AsyncTask<URL, Integer, JSONArray> t = task.execute();
    try {
        outr = t.get();
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (ExecutionException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return outr;
}

public JSONArray sendJ2(final JSONArray json) throws JSONException {

    try {
        u = new URI("http://mycensoredurl/Hello");
    } catch (URISyntaxException e1) {
        e1.printStackTrace();
    }

    HttpClient client = new DefaultHttpClient();

    HttpConnectionParams.setConnectionTimeout(client.getParams(), 10000); //Timeout Limit HttpResponse response;
    HttpPost post = new HttpPost(u); 

    StringEntity se = null;
    try {

        se = new StringEntity( json.toString());
    } catch (UnsupportedEncodingException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }

    se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));

    post.setEntity(se); 

    StringBuilder builder = new StringBuilder();
    try {
        HttpResponse response = client.execute(post);
        StatusLine statusLine = response.getStatusLine();
        int statusCode = statusLine.getStatusCode();
        if (statusCode == 200) {
            Log.d("DEBUG", "status code = 200");
            HttpEntity entity = response.getEntity();
            InputStream content = entity.getContent();
            BufferedReader reader = new BufferedReader(
                    new InputStreamReader(content));
            String line;
            while ((line = reader.readLine()) != null) {
                builder.append(line);
            }
        } else {
            Log.e(SendJSON.class.toString(), "Failed to download file");
        }
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    Log.d("JSON RESPONSE SHOULD", "BE NEXT..");

    Log.d("JSON RESPONSE LENGTH", ""+ builder.length());
    out = builder.toString();
    gs.setOut(out);

    Log.d("SendJSON... JSON RESPONSE String", ""+ out);
    return new JSONArray(out); 
}

private class ATask extends AsyncTask<URL, Integer, JSONArray>{
    private JSONArray jary;

    private ATask(JSONArray json) {
        this.jary = json;
    }

    @Override
    protected JSONArray doInBackground(URL... params) {
        try {
            outr = sendJ2(jary);
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return outr;
    }

}

}

The async task in there, I think, is b.s. and doesn’t need to be there. A professor had me put it in there as part of an assignment. (This is not homework help by the way, that class is over)

  • 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-31T13:40:04+00:00Added an answer on May 31, 2026 at 1:40 pm

    Looks like your Content-Type header is coming back broken – it should be something like:

    Content-Type: application/json; charset=ISO-8859-1
    

    but it looks like it’s probably coming back as:

    Content-Type: application/json; charset=ISO-8859-1, application/json
    

    or something similar. Look at the headers with something like Wireshark

    This looks like the problem:

    se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
    

    I suspect that application/json shouldn’t be part of the encoding – it’s part of the content type. Try changing it to:

    se.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I seem to have an app on my Dev server that has lots of
I have a simple GWT project in Eclipse, it has a servlet that calls
I have a server that has several virtual machines running on it. I'm trying
I have a remote server that has win2003 installed I can connect to the
We have a dev server that has managed to become indexed by Google. Page
We have a SQL 2000 server that has widely varied jobs that run at
I have a SQL Server DB that has a table of products, and another
I have a table in SQL server that has the normal tree structure of
I have access to an Oracle server that has some databases that I would
I have a folder on my remote server that has a few .png files

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.