Skip to main content

What's the workaround for hardcoded hostnames on Amazon EC2?

1 reply [Last post]
malcolm83
Offline
Joined: 2010-01-20

I'm trying to build a Linux image on EC2 that includes Glassfish. I know that Sun has provided some pre-built glassfish AMIs, but for various reasons I need to create my own. When Glassfish is installed on Linux it hardcodes the hostname in a number of config files an also in WSDL files. When I bundle this image and launch a new instance using that bundled image, each time the hostname will be different.

I'm not really sure why the hostname has to be hardcoded into all these places, or what the impacts would be of changing them all to something like "localhost" .

I haven't tried out the pre-configured Glassfish AMIs but I would have to think they have found a solution to this problem. Maybe a startup script that modifies the config files?

I've also created Glassfish images for Windows and these seem to have no problems.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Sreeram Duvur

The problem may be that domain creation is hardcoding the hostname.
The best way to have your AMI instance create the domain or Node Agent
on the fly as it comes up.

I have tried this approach and have not seen any problems so far. Can
you give ami-31608d58 a try? This AMI is capable of clustering as
well. There is a README in /opt. If you look at the scripts there you
can get some ideas on how to make your particular use case work.

Not sure if this AMI is public yet. Should be in a day or two.

HTH

Sreeram

On Jan 20, 2010, at 8:44 AM, glassfish@javadesktop.org wrote:

> I'm trying to build a Linux image on EC2 that includes Glassfish. I
> know that Sun has provided some pre-built glassfish AMIs, but for
> various reasons I need to create my own. When Glassfish is
> installed on Linux it hardcodes the hostname in a number of config
> files an also in WSDL files. When I bundle this image and launch a
> new instance using that bundled image, each time the hostname will
> be different.
>
> I'm not really sure why the hostname has to be hardcoded into all
> these places, or what the impacts would be of changing them all to
> something like "localhost" .
>
> I haven't tried out the pre-configured Glassfish AMIs but I would
> have to think they have found a solution to this problem. Maybe a
> startup script that modifies the config files?
>
> I've also created Glassfish images for Windows and these seem to
> have no problems.
> [Message sent by forum member 'malcolm83' (mmcrober@harris.com)]
>
> http://forums.java.net/jive/thread.jspa?messageID=381982
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net