For a J2EE application running in WebLogic 8.3, does anyone
know how to get the app server DNS and port at runtime which is servicing the request? Calling InetAddress.getLocalHost().getHostName();
and request.getRequestURL(); provide the actual server name and/or URL entered
in the web browser. But this is
generally the clustered version of the URL and not the actual app server which ended
up processing the request.
One thought I had was to add some command line JAVA_OPTIONS
to the weblogic startup scripts which would “hard code” the real
server DNS and port for each server in the cluster. And then call System.getProperty(“myprop.appserver.dns”);
and System.getProperty(“myprop.appserver.port”);. This would be good because it would be
available at every tier of the application.
But this requires additional configuration which I would
like to avoid.
Thanks,
-Matt