|
OracleAS and getServerName
Getting the server name from OracleAS
I've just had a few discussions with a customer who was wondering why a call to the HttpServletRequest.getServerName()
method from within a servlet was only returning the hostname of the
system and not the fully qualified domain name as they were requiring,
and as was happening in the Oracle9iAS 9.0.2 release.
After a bit of digging and playing around, I found that when the
OracleAS environment is used, consisting of Oracle HTTP Server (OHS),
mod_oc4j and OC4J, the actual value returned from the getServerName()
method call is based on the settting of the ServerName value which is set in the OHS httpd.conf file -- $ORACLE_HOME/Apache/Apache/conf.
# ServerName allows you to set a host name which is sent back to clients for
# your server if it's different than the one the program would get (i.e., use
# "www" instead of the host's real name).
ServerName peterman.au.oracle.com
This ServerName value is transmitted to the OC4J instance along with the actual request data sent by mod_oc4j.
The good thing about this is that the ServerName that is available to
the servlets will be independent of the actual backend OC4J instance on
which the servlet is actually executing and will reflect where the
actual request was received -- a good thing when you have multiple OC4J
nodes load balanced behind an OHS.
My guess on how this panned out for the customer in question is that
the installer obtained the hostname of the system which was reported as
only the hostname and not the fully qualified domain name. This was
then used as the value to be substitued throughout all of the
configuration file templates.
The customer themselves came up with another solution which I was
unaware of but happy to hear about since it fixed their problem.
Evidently, and I say evidently because I've never used it and I can't
seem to find anything about it in the install guide, there is a runtime
property you can supply to the Oracle Installer which it will use as
the hostname.
This takes the form of :
./runInstaller OUI_HOSTNAME=
Re-running
the installation and supplying this runtime parameter solved the
customers specific problem, allowing the fully qualifed domain name to
be returned.
So if you're plagued with a hostname when what you want it actually a
fully qualified domain name, there's some things to look at.
© Copyright 2004 buttso.
Last update: 4/14/2004; 1:45:11 PM.
|