Getting HTTP-504 from OC4J to External HTTP or SOAP Resources

(Doc ID 336351.1)

Last updated on OCTOBER 02, 2017

Applies to:

Oracle Containers for J2EE - Version 9.0.2.0.0 to 10.1.2.3.0 [Release 9iAS to AS10gR2]
Information in this document applies to any platform.
Oracle Containers for J2EE - Version: 9.0.2.0.0 to 10.1.2.3.0
This problem can occur on any platform.
***Checked for relevance on 22-Feb-2013***

Symptoms

You have java code running in Oracle Containers for J2EE (OC4J) that is perhaps invoked by a Servlet, JSP or Enterprise Java Bean (EJB).
That code in turn accesses a further remote web server, possibly using java networking classes (e.g. URL, HttpClient etc.)
or possibly a remote WebService accessed via Simple Object Access Protocol (SOAP).

The code results in an error similar to the following:

05/09/13 21:51:54 java.io.IOException: Server returned HTTP response code: 504
                  for URL: http://remote.target.com:8000/some/path/some.target
05/09/13 21:51:54 at sun.net.www.proto.http.HttpURLConnection.
                  getInputStream(HttpURLConnection.jaa:715)

The HTTP-504 return status indicates a problem accessing the target of the remote call: 

504 Gateway Timeout The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server it accessed in attempting to complete the request.

Changes

If you have multiple applications running in the container, you may receive the error intermittently in both applications.
The errors can be triggered by the deployment of a new application or the arrival of request load (or more frequent requests) for a newly deployed or infrequently used application.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms