OC4J Caches Resolved DNS IP Addresses Indefinitely

(Doc ID 727942.1)

Last updated on MARCH 08, 2017

Applies to:

Oracle Application Server 10g Enterprise Edition - Version: to
This problem can occur on any platform.


Domain names are being referenced in java code, for example,  mail.ourdomain.com
If the IP address of this changes, the old value is 'cached' by OC4J.
This means the program fails to contact the mail server or whatever other service is being requested.

The following program demonstrates the issue, presuming you have the ability to change the IP address of the named resource :

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.*;
import javax.servlet.http.*;
import java.net.InetAddress;

public class Servlet1 extends HttpServlet {
private static final String CONTENT_TYPE = "text/html; charset=windows-1252";

public static int mycounter = 0;
public void init(ServletConfig config) throws ServletException {

public void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
out.print("google is: " + InetAddress.getByName("your-resource.com") + "<br>");
out.print("counter is: " + mycounter++ + "<br>");


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