EJB Deployment   Next» Next»

Lesson 4Configuring the J2EE reference implementation software
Objective Configure the J2EE software.

Configure Jakarta EE Reference Implementation

To configure the "Jakarta EE reference implementation" (currently GlassFish Server Open Source Edition, maintained by the Eclipse Foundation), follow these steps. GlassFish serves as the reference implementation for Jakarta EE, supporting the latest Jakarta EE specifications.
1. Download GlassFish Server
  1. Visit the Eclipse GlassFish Download Page.
  2. Select the latest stable version of GlassFish that supports the Jakarta EE version you are working with (e.g., Jakarta EE 10).
  3. Download the appropriate distribution for your operating system.

2. Install GlassFish Server
  1. Extract the downloaded ZIP or TAR file to a preferred directory:
    unzip glassfish-<version>.zip -d /opt
    Replace <version> with the actual version number.
  2. Navigate to the GlassFish installation directory:
    cd /opt/glassfish-<version>

3. Configure the Environment
  • Add the bin directory of GlassFish to your system’s PATH:
    export PATH=/opt/glassfish-<version>/bin:$PATH
  • Set the JAVA_HOME variable to point to your Java installation (Java 11+ is typically required for modern Jakarta EE versions):
    export JAVA_HOME=/path/to/java

4. Start the GlassFish Server
Start the GlassFish domain (default domain is `domain1`):
asadmin start-domain
To confirm the server is running, access the default admin console in your browser:
  • URL: http://localhost:4848
  • Default username: admin
  • Default password: Leave blank (you can configure this during setup).

5. Deploy Jakarta EE Applications
  1. Package your Jakarta EE application as a WAR or EAR file.
  2. Deploy the application using one of the following methods:
    • Admin Console:
      • Navigate to http://localhost:4848.
      • Go to the Applications tab.
      • Click Deploy... and upload your WAR/EAR file.
    • Asadmin CLI:
      asadmin deploy /path/to/your-app.war

6. Configure the Server
  • Data Sources: Configure JDBC connection pools and resources for database access.
    • Admin Console: Go to Resources > JDBC.
    • CLI Example:
              asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.cj.jdbc.MysqlDataSource --restype javax.sql.DataSource --property user=root:password=root:databaseName=mydb:serverName=localhost:port=3306 myPool
              asadmin create-jdbc-resource --connectionpoolid myPool jdbc/myDB
              
  • Security: Configure realms for authentication (e.g., file, database).
  • Logging: Adjust logging levels via domain.xml or the Admin Console.
  • Ports: Modify default ports in domain.xml if necessary.

7. Stop the Server To stop the server when not in use:
asadmin stop-domain

Tips for Best Practices
  1. Enable HTTPS: Configure SSL for secure communication:
    • Generate a keystore or use an existing certificate.
    • Update the domain.xml file with HTTPS listener configurations.
  2. Performance Tuning: Optimize thread pools, connection pools, and memory settings in domain.xml.
  3. Backup Configuration: Regularly back up the domain configuration by copying the domains directory.

With these steps, your Jakarta EE reference implementation will be ready for deployment and development of enterprise applications.


The steps described here are also described in the configuration guide that is part of the Jakarta EE documentation.
This course assumes that the client, the bean, and the JNDI server are all on the same system For this course, most of the defaults that are set up automatically during installation work fine without any changes.
Note: Bring up the J2EE cofiguration guide documentation (<J2EE_HOME>/doc/index.html) in a new browser window and select

Configure Reference Implementation Software- Exercise

Click the Exercise link to configure the software.
Configure Reference Implementation Software- Exercise In the next lesson, you will create the deployable jar file.

SEMrush Software