DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Related

  • What Are the 7 Rs of Cloud Migration Strategy?
  • Deploy WordPress on AWS Using OpenEBS
  • Messaging in AWS Using SNS and SQS
  • Moving Away From AWS and Onto Heroku

Trending

  • Securing Your Applications With Spring Security
  • Choosing the Appropriate AWS Load Balancer: ALB vs. NLB
  • Best Practices for Developing Cloud Applications
  • Decoding Business Source Licensing: A New Software Licensing Model
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. Commissioning Glassfish 3 application servers on AWS EC2

Commissioning Glassfish 3 application servers on AWS EC2

Ben Wilcock user avatar by
Ben Wilcock
·
Jun. 08, 13 · Interview
Like (0)
Save
Tweet
Share
5.42K Views

Join the DZone community and get the full member experience.

Join For Free

service autonomy is one of the 8 key soa design principals. one way that you can achieve better service autonomy and create more scalable services is to give each service it’s own hardware to play with. cloud infrastructure like amazon’s elastic compute cloud (called ec2 for short) is designed to fill this need by alowing you to add hardware at short notice and scale it horizontally or vertically.

unfortunately, none of the default machine instance types offered by amazon ec2 at the time of writing included glassfish 3 java ee application servers as part of the basic install. this guide is intended to bridge that gap by showing you how you can commission your own basic glassfish 3 installation using amazon ec2.

assumptions (before you start):

you’ve set yourself up with an amazon web services user account.
you can log into the aws console and the ec2 sub-console.
you have followed amazon’s aws ec2 getting started guide (linux/unix not windows).
you have a security keypair already (part of the getting started tutorial).
you have used the browser based java ssh client to ‘connect’ to a machine (part of the tutorial).

warning about free t1.micro instances:

amazon’s ec2 t1.micro instances don’t meet the documented glassfish server requirements. these instances have limited memory, cpu and bandwidth. you can run glassfish on them, but they generally run out of memory quite quickly. on the plus side though, these t1.micro instances are free for the first year .

steps for: commissioning glassfish 3 on aws ec2.

1. create a new ec2 machine instance using the amazon linux ami (see screenshot). this is automatically ebs backed and can be 64 or 32 bit and based on a t1.micro instance if you want to qualify for the free service tier.

2. once the instance has started, connect to it using the ‘connect’ option from the dropdown menu for the machine in the my instances page.

3. once connected, in the java ssh client you’ll be prompted to apply a few patches to the machine using ‘sudo yum update’ command.

sudo yum update

4. if you try and run the ‘javac’ compiler command, you’ll get an error. this is because only the jre is installed by default. to rectify this, install the full openjdk developer kit. once done, the ‘javac’ command should be available. glassfish will need this later.

sudo yum install java-1.6.0-openjdk-devel

5. download glassfish 3.1.2 & unzip it to the current location. yon’t need sudo for these steps. if you use sudo, the domain won’t start properly if at all.

wget -c http://download.java.net/glassfish/3.1.2/release/glassfish-3.1.2.zip
unzip glassfish-3.1.2.zip

6. configure glassfish security so that you can use the built in web console. to do this we have to start the default domain, change the admin password, enable the secure admin feature and restart glassfish. to do all these things we need to start the ‘asadmin’ program that comes with glassfish…

./glassfish3/glassfish/bin/asadmin
asadmin> start-domain
asadmin> change-admin-password (initial is username:admin, password:[enter])
asadmin> enable-secure-admin (use the admin username and password which you just set)
asadmin> restart-domain
asadmin> exit

7. open some ports for the ec2 instance security group so that you can see applications and the glassfish console. find the security group being used for your ec2 machine instance and enable ports 8080, 8181 and 4848 as per the following screenshot.

8. you should now be able to login to your glassfish console. find the ‘public dns’ name for this ec2 machine instance on the my instances ‘details page’. pop this address into a browser and append the glassfish admin console port number on the end (4848). this will look like http://%5byour public dns]:4848/ and after a few minutes (while the console starts) the console login screen should appear as per the screenshot below.

you should now be able to login using the admin username and password that you setup earlier and deploy applications to the glassfish server. if you are new to glassfish, try the glassfish quick start guide .

optional steps: deploying the ‘hello duke’ sample web-app.

1. stop the glassfish server. from the asadmin program…

asadmin> stop-domain
asadmin> exit

2. move to the autodeploy folder and download the sample application to it.

cd glassfish3/glassfish/domains/domain1/autodeploy
wget -c http://glassfish.java.net/downloads/quickstart/hello.war

3. start the glassfish server. from the asadmin program…

asadmin> start-domain

4: try the sample application in your browser.

http://[your instance's public dns address here]:8080/hello

finally, in your browser window, you should now see java duke and he’s asking you for your name…

about the author.

ben wilcock is a freelance soa certified architect with a reputation for delivering exceptional service oriented architectures. you can read his blog at http://benwilcock.wordpress.com/ or contact him via his website at http://www.soagrowers.com/ “.





GlassFish AWS application Amazon Web Services

Published at DZone with permission of Ben Wilcock, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • What Are the 7 Rs of Cloud Migration Strategy?
  • Deploy WordPress on AWS Using OpenEBS
  • Messaging in AWS Using SNS and SQS
  • Moving Away From AWS and Onto Heroku

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: