Skip to content

herestam/jakarta-api-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Perfect πŸ‘ β€” here’s a clear, complete, copy-and-save deployment guide for your Jakarta EE (GlassFish 7) project. It includes all commands, what each one does, and the expected output or result β€” so you can follow it anytime in the future.


🧭 Jakarta EE Deployment Guide (GlassFish 7 + Maven WAR)

This guide explains how to build, deploy, stop, and redeploy a Jakarta EE web project manually using Maven and GlassFish 7.


βš™οΈ PREREQUISITES

Before starting, make sure you have:

  • Java 17+ installed

    java -version
  • Maven 3.8+ installed

    mvn -v
  • Your Jakarta EE project created (for example: jakarta-api-demo)

    ~/Desktop/coding/java/day1/jakarta-api-demo/
    

🧩 STEP 1 β€” Build the Project

From your project root:

cd ~/Desktop/coding/java/day1/jakarta-api-demo
mvn clean package

πŸ’‘ What it does:

  • Cleans old builds
  • Compiles your Java source code
  • Packages it into a WAR file

πŸ—‚οΈ Result:

You should see a new file here:

target/jakarta-api-demo.war

🧰 STEP 2 β€” Download and Extract GlassFish 7

Download GlassFish:

wget https://download.eclipse.org/ee4j/glassfish/glassfish-7.0.4.zip

Unzip:

unzip glassfish-7.0.4.zip

This creates a folder named:

glassfish7/

πŸ“‚ STEP 3 β€” Navigate to the Admin Tool Directory

Go to the bin folder that contains the asadmin command-line tool:

cd glassfish7/glassfish/bin

πŸš€ STEP 4 β€” Start the Default Domain

Start the built-in domain (domain1):

./asadmin start-domain

πŸ’‘ What it does:

  • Starts the GlassFish server
  • Default HTTP port β†’ 8080
  • Admin Console β†’ http://localhost:4848

βœ… Output Example:

Waiting for domain1 to start ...................
Successfully started the domain : domain1
domain  Location: /.../glassfish7/glassfish/domains/domain1
Log File: /.../glassfish7/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.

🌐 STEP 5 β€” Deploy Your Application

Deploy your newly built WAR file:

./asadmin deploy ~/Desktop/coding/java/day1/jakarta-api-demo/target/jakarta-api-demo.war

πŸ’‘ What it does:

  • Copies your WAR file into the GlassFish domain
  • Deploys it under /jakarta-api-demo
  • Makes it accessible at http://localhost:8080/jakarta-api-demo/

βœ… Expected Output:

Application deployed with name jakarta-api-demo.
Command deploy executed successfully.

πŸ§ͺ STEP 6 β€” Verify Deployment

Open in browser:

http://localhost:8080/jakarta-api-demo/index.html

or if your app has REST endpoints, try:

http://localhost:8080/jakarta-api-demo/api/users

🧹 STEP 7 β€” Stop the Domain

To gracefully stop the running GlassFish domain:

./asadmin stop-domain

βœ… Output Example:

Waiting for the domain to stop ................
Command stop-domain executed successfully.

🧩 STEP 8 β€” Start or Stop Specific Domain (Optional)

GlassFish supports multiple domains. If you want to control a specific one (like domain1), use:

./asadmin start-domain domain1
./asadmin stop-domain domain1

πŸ” STEP 9 β€” Redeploy / Update Your App

When you modify your code and rebuild it, you have two options:

Option A β€” Undeploy first, then deploy again:

./asadmin undeploy jakarta-api-demo
./asadmin deploy ~/Desktop/coding/java/day1/jakarta-api-demo/target/jakarta-api-demo.war

Option B β€” Force redeploy directly:

./asadmin deploy --force=true ~/Desktop/coding/java/day1/jakarta-api-demo/target/jakarta-api-demo.war

βœ… This replaces the old version automatically.


🧾 STEP 10 β€” Check What’s Deployed

List all deployed applications:

./asadmin list-applications

Example output:

jakarta-api-demo <enabled>  (root)
Command list-applications executed successfully.

⚑ STEP 11 β€” Restart the Domain (If Needed)

If GlassFish behaves strangely or you’ve changed configs:

./asadmin restart-domain

βœ… This will:

  • Stop the domain
  • Restart it automatically
  • Keep all previous deployments

πŸ—ƒοΈ FILE LOCATION REFERENCE

Purpose Path
Project Root ~/Desktop/coding/java/day1/jakarta-api-demo/
Build Output (WAR) ~/Desktop/coding/java/day1/jakarta-api-demo/target/jakarta-api-demo.war
GlassFish Home ~/Desktop/coding/java/day1/glassfish7/
Admin Tool ~/Desktop/coding/java/day1/glassfish7/glassfish/bin/asadmin
Default Domain glassfish7/glassfish/domains/domain1
Server Log glassfish7/glassfish/domains/domain1/logs/server.log
Admin Console http://localhost:4848
App URL http://localhost:8080/jakarta-api-demo/

βœ… QUICK COMMAND REFERENCE

Action Command
Build WAR mvn clean package
Start server ./asadmin start-domain
Deploy app ./asadmin deploy <path-to-war>
List apps ./asadmin list-applications
Undeploy app ./asadmin undeploy jakarta-api-demo
Redeploy app ./asadmin deploy --force=true <path-to-war>
Stop server ./asadmin stop-domain
Restart server ./asadmin restart-domain

πŸ’‘ TIP: Create a Simple Deployment Script

You can automate this by saving the following as deploy.sh:

#!/bin/bash
PROJECT=~/Desktop/coding/java/day1/jakarta-api-demo
WAR=$PROJECT/target/jakarta-api-demo.war
GF=~/Desktop/coding/java/day1/glassfish7/glassfish/bin

cd $PROJECT
mvn clean package
$GF/asadmin deploy --force=true $WAR

Make it executable:

chmod +x deploy.sh

Run it anytime with:

./deploy.sh

βœ… That’s your full Jakarta EE + GlassFish deployment workflow β€” from build β†’ deploy β†’ stop β†’ redeploy, all explained step by step.

Would you like me to format this as a clean Markdown document (README.md) so you can drop it directly into your project folder for future reference?

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors