0

When using apache library for HttpClient and HttpPost with GWT generates 500 Internal Server Error.
I am using packages as:

org.apache.http.client.HttpClient
org.apache.http.client.methods.HttpPost

Calling the below code from RPC Impl class (server side) this error is generated.

client.execute(post);

It gives an error in browser console.log as below:

http://localhost:<port>/<AppName>/package.name.Main//MyServiceImpl 500 (Internal Server Error)

Suggest what exactly the problem is, and how will I be able find the solution on the same.

Added: I am using tomcat 8.0 as server and Netbeans IDE 8.0.1 for development and GWT-2.3.0.

In Browser Inspect Element -> Network Tab, I am getting below information for POST Request:

Remote Address:127.0.0.1:8084
Request URL:http://localhost:<port>/<AppName>/package.name.Main//MyServiceImpl
Request Method:POST
Status Code:500 Internal Server Error
Request Headersview source
Accept:*/*
Accept-Encoding:gzip,deflate
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Content-Length:683
Content-Type:text/x-gwt-rpc; charset=UTF-8
Cookie:JSESSIONID=0FEAB78577E68748D4FBFC6E26FD4DCC

Inside Neatbeans, server logs I am getting below error. My method which is having a call to HttpClient post is giving the error:

threw an unexpected exception: java.lang.NoSuchFieldError: DEF_CONTENT_CHARSET
Mandar Pandit
  • 2,171
  • 5
  • 36
  • 58
  • Check your server's logs for details - either the built in Jetty instance or whatever standalone server you are using. Without that we can't help you further - the 500 status code thrown to the client side is just a generic way of saying "Something went wrong on the client side, check the logs (no, not the browser's console)." – Igor Klimer Dec 04 '14 at 08:50
  • I am using tomcat 8.0 as server and Netbeans IDE 8.0.1 for development and GWT-2.3.0. – Mandar Pandit Dec 04 '14 at 10:04
  • ...and what does it say in the Tomcat's logs? `catalina.out` or just the server's console in Netbeans. You are posting what the server is returning to the client side (in most cases, it's just `500 Internal Server Error`, meaning you didn't expect this exception). The real reason is usually clearly stated in the server's logs. – Igor Klimer Dec 04 '14 at 10:16
  • Error is Netbeans server logs: my_method() threw an unexpected exception: java.lang.NoSuchFieldError: DEF_CONTENT_CHARSET – Mandar Pandit Dec 04 '14 at 10:29
  • possible duplicate of [java.lang.NoSuchFieldError: DEF\_CONTENT\_CHARSET](http://stackoverflow.com/questions/18246979/java-lang-nosuchfielderror-def-content-charset) – Igor Klimer Dec 04 '14 at 14:24

0 Answers0