I am writing a java servlet for a REST interface using jersey. I have the following really weird problem: As soon as I POST to some resource I receive an internal server error (status 500). the localhost_access_log*.txt shows entries of the form
0:0:0:0:0:0:0:1 - - [27/Jan/2015:18:04:30 +0100] "POST /server/rest/requests HTTP/1.1" 500 1039
indicating the problem. However, I see no concrete error message, i.e. some kind of exception being thrown on the console (I am currently using eclipse). After the indication
INFO: Server startup in 5476 ms
Nothing appears any more. The start goes smooth without any problems as well. Also, it seems like the error occurs before any of my handler code is executed, as a corresponding breakpoint in eclipse is never reached. Does anyone have any ideas on how to get a handle on what is actually happening?
Well, I finally got it. I was using genson to convert between JSON / Java classes. Unfortunately the package silently fails when it receives malformed input and the server reacts by returning the internal error message...
Related
I want to handle error response. When I use local server I can get error message when exception is hit but when I use the same hosted app It shows response with error message which is null "message":""
I have noticed that when the excptionerror is thrown the server gets stoped a while and the response error comes empty due to network delay. But for local database there is no delay which leads the server to keep responding no matter which response it has
I've been having some issues with NoHandlerException's in a multi server configuration. I've been trying to figure out exactly when I get this exception but
I can not find any good description on what it actually means that no handler was found.
The thing here is that everything actually seems to work fine, we are not receiving any error reports on this from our production system, and we are not able
to reproduce the error in our test systems. But we can clearly see a big amount of no handler found errors in our production logs.
So my question is, could this error be due to some bad load-balancing? Like that we send our users between
different servers and the server receiving server does not have an updated state for this user/session? Or should it be some configuration error on the Spring-application
that can not be affected by the load balancing?
When I have searched for other people with the same error they seem to get it all the time, but I get it only sporadically
The error we receive:
Uncaught service() exception root cause AppName: javax.servlet.ServletException: org.springframework.web.portlet.NoHandlerFoundException: No handler found for portlet request: mode 'view', phase 'ACTION_PHASE', parameters map['action' -> array<String>['myController.parameter']]
Try to check xml somewhere contains portlet. Normally every handler stage error cased by configuration.
I have a Java-based client that receives data from a Tomcat 6.0.24 server webapp via JAX-WS. I recently upgraded the server with new functionality that can take a long time (over 30 seconds) to run for certain inputs.
It turns out that for these long operations, some kind of timeout is occurring. The client gets an HTTP 400 Bad Request error, and shortly afterwards (according to my log timestamps, at least) the server reports a Broken Pipe.
Here's the client's error message:
com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 400: Bad Request
And the server's:
javax.xml.ws.WebServiceException: javax.xml.stream.XMLStreamException: ClientAbortException: java.net.SocketException: Broken pipe
I've tried experimenting with adding timeout settings on the service's BindingProvider, but that doesn't seem to change anything. The default timeout is supposed to be infinite, right?
I don't know if it's relevant, but it might be worth noting that the client is an OSGI bundle running in a Karaf OSGI framework.
Bottom line, I have no idea what's going on here. Note that the new functionality does work when it doesn't have to run for too long. Also note that the size of the new functionality's response is not any larger than usual - it just takes longer to calculate.
In the end, the problem was caused by some sort of anti-DoS measure on the server's public gateway. Unfortunately, the IT department refused to fix it, forcing me to switch to polling-based communication. Oh well.
Im building one application that requests one http connection, thus I have two different situations, one while Im programming at home and another while Im at my work. In my work I have one proxy server and at home not. At home my request is always ok, in my job I receive random failures.
In my console, the stack trace points:
HTTP error fetching URL. Status=503, URL=http://www.google.com/sorry/?continue=http://google.com/search%3Fq%3Dmake%2BSearch
Which means:
503 Service Unavailable. The server is currently unavailable (because it is overloaded or down for maintenance). Generally, this is a temporary state.
So, the stack traces points the error to the google server, as its not available, but since I dont receive this error at home Im almost sure the error is with the proxy server. Copying the link of the error to the browser I could see that google is blocking the request since is a sort of automatic request. Anyway, Im using:
System.setProperty("http.proxyHost", "");
System.setProperty("http.proxyPort", "");
to handle the proxy connection, even though its not working fully correct, sometimes the connection works, sometimes not returning the error up there. Is there anything I could possibly do to solve this situation such as refresh my IP?
I've got a RESTful Web-Service that does some IO and database activity in order to return a result.
There are some Exceptions that I would like to see, ie exception thrown because an expected variable is not set, or my database is no longer exists, etc...
However when I throw these exceptions they get caught and wrapped in a HTTP 500 (Internal Server Error) exception and that is what the client gets (As opposed to the root exception).
I would like to see my exception here, instead of going to have to look through the Application server logs.
You can implement an ExceptionMapper that returns anything you want. So, for example, it can put the whole exception with the stacktrace to the response.
Is it what you want at client side? I'm not sure.
It can be quite a difficult job for a client to rebuild the exceptions and rethrow it.
In addition, it's quite unsecure, since the stacktrace will expose the server's internal code to the client.
I suggest you declare some server error codes that make sense to client and that you want to expose. Example:
1000 - connection to database failed.
2000 - something else
So for specific exceptions, in the ExceptionMapper you can map the server exceptions to error codes and then remap them at the client side.