3

Can anyone tell me about glassfish server domain name for webapplication(struts2).

Now i am using my URL to run web application is:

http://localhost:8080/testapplication/

I want to change this URL to run my application as:

http://www.testapplicaiton.com/

So i need in help to change this domain name in Glassfish server. thanks in advance.Please provide your help.

shiva
  • 177
  • 2
  • 9
  • 24
  • Have a look at [this related question](http://stackoverflow.com/a/11151611/620338) – Matt Handy Aug 15 '12 at 09:55
  • Can u say about Step-by-Step process to achieve domain name in URL? I looked out related question. But having the same doubt as 'How to do DNS in glassfish server'? – shiva Aug 15 '12 at 11:10
  • 1
    DNS has nothing to do with Glassfish. You need a server that has a public IP address and point your registered domain to that server. Then you can start with configuring Glassfish. – Matt Handy Aug 15 '12 at 11:14
  • Your browser searches for the address on the internet and not on your local machine. You cannot do it this way unless you have a local name server (or an entry in your hosts file) that resolves testapplication.com to 192.168.2.4. I recommend to go back to the basics and learn how the internet works and what a browser does if you enter an URL and hit the enter button. – Matt Handy Aug 15 '12 at 11:59

2 Answers2

5

Create a file sun-web.xml with the following content

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC
        "-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 Servlet 3.0//EN"
        "http://www.sun.com/software/appserver/dtds/sun-web-app_3_0-0.dtd">
<sun-web-app>
    <context-root>/</context-root>
</sun-web-app>

and put it into the WEB-INF directory. This will allow you to get rid of 'testapplication' in your URL.

You also have to change port numbers to standard. There are several ways to do it. One of the them is to go to the web console of the application server then

Configuration->Network Config->Network Listeners

You have to provide 80 for Port parameter of the http-listener-1 and 443 for Port parameter of the http-listener-2 This allow you to get rid of the port number '8080' in your URL

(However the faster way is merely to make search in the domain.xml config file for '8080' and change port numbers there)

After these changes your application will respond on http:/ /localhost and https:/ /localhost

The domain name 'www.testapplicaiton.com' has nothing to do with Glassfish. You have to use DNS.

jjd
  • 2,158
  • 2
  • 18
  • 31
-3

Edit your the hosts file at the following path: c:\windows\system32\drivers\etc\hosts file At the end add entry as your PC IP 192.168.2.4. I ONE SPACE followed by www.testapplicaiton.com and save the file and Restart PC. your PC IP can be found at C:\ipconfig/all (Press Enter Key) Note down the IPv4 IP Address. Note: while editing start the Note pad in the Administrator Mode. You can test your website ONLY on LAN not on INTERNET. For Internet you need a domain www.testapplicaiton.com and STATIC ip and then PORT FORWARDING ON SPECIFIC PORT ON YOUR ROUTER. ALRIGHT then, Get set and Go!!! Good Luck2U.