my Glassfish instance uses my Windows computer name as domain name in urls, as so :
http://mymachine-567125f:8080/TemplateEJBService/TemplateEJB
Obviously, mymachine-567125f
is not known of any DNS, and as a consequence, url directly leads to the deepest void of intergalactic space.
So, is there a way to tell glassfish to instead use localhost
, or even my ip address, for its generated urls ?
Matt Handy's answer did not work for me. However, the solution that Matt gave in his comment to his answer did the trick. I'm repeating it here to give it more weight. There are two ways to do this:
- Set the
server name
for the HTTP listener in GlassFish admin console:
Configurations > server-config > Network Config > Network Configuration > Network listeners > http-listener-1 > Tab "HTTP" > "Server name".
Edit domain.xml, more specifically the server-name
attribute in
<network-config>
<protocols>
<protocol name="http-listener-1">
<http server-name="">
You can change the host name with the Glassfish admin console:
Configuration --> Virtual Servers --> Your server's name (usually: "server")
If you click on the virtual server, a page opens, containing an input field "Hosts". By default this should contain ${com.sun.aas.hostName}
.
Change it to your host's name.
Be careful if you have other webapps on your server. If you only want to change the hostname for a particular application and not for all, you have to create a new virtual server and assign the host nameto it.
Alternatively you could get the same by editing domain.xml in your domain/config dir. But I think you will be faster with the (often bashed and often slow) admin console.
To Change the Default Host Name Using the asadmin Command
asadmin set
server-config.jms-service.jms-host.default_JMS_host.host="0.0.0.0"
or you can set hostname
asadmin set
server-config.jms-service.jms-host.default_JMS_host.host="hostname"
You can get more information from this link:
http://docs.oracle.com/cd/E19798-01/821-1841/gjsdi/index.html