本文介绍了如何更改Glassfish生成的URL中的域名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Glassfish实例使用我的Windows计算机名称作为URL中的域名,如下所示:

my Glassfish instance uses my Windows computer name as domain name in urls, as so :

http://mymachine-567125f:8080/TemplateEJBService/TemplateEJB

很明显,mymachine-567125f在任何DNS中都是未知的,因此url直接导致星际空间的最深处.

Obviously, mymachine-567125f is not known of any DNS, and as a consequence, url directly leads to the deepest void of intergalactic space.

那么,有没有办法告诉glassfish改为使用localhost甚至我的IP地址作为生成的网址?

So, is there a way to tell glassfish to instead use localhost, or even my ip address, for its generated urls ?

推荐答案

马特·汉迪(Matt Handy)的答案对我不起作用.但是,马特在评论中给出的解决方案可以解决问题.我在这里重复它以增加重量.有两种方法可以做到这一点:

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. 在GlassFish管理控制台中为HTTP侦听器设置server name:配置>服务器配置>网络配置>网络配置>网络侦听器> http-listener-1>选项卡"HTTP">服务器名称".
  2. 编辑 domain.xml ,更具体地说是

  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

<网络配置>
  <协议>
   <协议名称="http-listener-1">
     < http服务器名称=">

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

这篇关于如何更改Glassfish生成的URL中的域名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 14:08