Search code examples
glassfish-3

How to change domain name in Glassfish generated urls?


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 ?


Solution

  • 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:

    1. 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".
    2. Edit domain.xml, more specifically the server-name attribute in

      <network-config>
        <protocols>
          <protocol name="http-listener-1">
            <http server-name="">