Top 13 Glassfish Interview Questions You Must Prepare 19.Mar.2024

A database server is not started by default when you start the GlassFish Server domain. If your applications require a database back end, you must start and stop the database server manually.

The following procedures describe how to start and stop the Java DB server that is bundled with GlassFish Server. For information about starting and stopping other database servers, see the documentation for your specific product.

To Start the Java DB Server

At least one GlassFish Server domain must be started before you start the database server.

Run the asadmin start-database command.

The general form for the command is as follows:

as-install/bin/asadmin start-database --dbhome directory-path

For example, to start the Java DB server from its default location:

as-install/bin/asadmin start-database --dbhome as-install-parent/javadb

To Stop the Java DB Server

Run the asadmin stop-database command:

as-install/bin/asadmin stop-database.

The process of configuring and enabling applications to run within the GlassFish Server

framework is referred to asdeployment.

To Obtain the Sample Application

Download a copy of thehello.warsample application fromhttp://glassfish.java.net/

downloads/quickstart/hello.war.

Save thehello.warfile in the directory of your choice.

This directory is referred to as sample-dir

To Deploy the Sample Application From the Command Line

The sample application must be available before you start this task. To download the sample, see “To Obtain the Sample Application” on page @At least one GlassFish Server domain must be started before you deploy the sample application.

Run the asadmin deploy command.

The general form for the command is as follows:

as-install/bin/asadmin deploy war-name

To deploy the hello.war sample, the command is as follows:

as-install/bin/asadmin deploy sample-dir/hello.war

Access thehelloapplication by typing the following URL in your browser:

http://localhost:8080/hello

The application's start page is displayed, and you are prompted to type your name.

Type your name and click Submit.

The application displays a customized response, giving you a personal Hello.

To List Deployed Applications From the Command Line

Run the asadmin list-applications command:

as-install/bin/asadmin list-applications

To Undeploy the Sample Application From the Command Line

Run the asadmin undeploy command.

The general form for the command is as follows:

as-install/bin/asadmin undeploy war-name

Forwar-name, use the literal hello, not the full hello.warname.

For the hello.war example, the command is as follows:

as-install/bin/asadmin undeploy hello

When you install GlassFish Server, a default domain nameddomain1 is created. The following  procedures describe how to start and stopdomain1when it is the only domain.

To Start the Default Domain

GlassFish Server software must be installed before you start the domain.

Run the asadmin start-domain command without an operand:

as-install/bin/asadmin start-domain

The command starts the default domain, domain1.

for starting any domain (e.g domain name: employee): as-install/bin/asadmin start-domain employee

To Stop the Default Domain

Run the asadmin stop-domain command without an operand:

as-install/bin/asadmin stop-domain

The command stops the default domain, domain@for stopping any domain (e.g domain name: employee): as-install/bin/asadmin stop-domain employee

Yes. Organizations interested in evaluating the technology can download it from e-delivery.

  • Domain name : domain1
  • Master password : changeit
  • asadmin(1M) command-line utility : as-install/bin
  • Configuration files : domain-dir/config
  • Log files : domain-dir/logs
  • Administration server port : 4848
  • HTTP port : 8080
  • HTTPS port : 8181
  • Pure JMX clients port : 8686
  • Message Queue port : 7676
  • IIOP port : 3700
  • IIOP/SSL port : 3820
  • IIOP/SSL port with mutual authentication : 3920

The GlassFish Server Administration Console provides a browser interface for configuring,

administering, and monitoring GlassFish Server.

To Start the Administration Console

At least one GlassFish Server domain must be started.

Type the URL in your browser.

The default URL for the Administration Console on the local host is as follows:

http://localhost:4848

If prompted, log in to the Administration Console.

You will be prompted to log in if you chose to require an administration password at the time GlassFish Server was installed.

To Deploy the Sample Application Automatically

You can deploy applications automatically by placing them in the  as-install/domains/domain-name/autodeploydirectory, wheredomain-nameis the name of the domain for which you want to configure automatic deployment.

For this example, use the default domain, domain1:

as-install/domains/domain1/autodeploy

The sample application must be available before you start this task.

Copy the applicationWAR file to theas-install/domains/domain-name/autodeploydirectory.

On UNIX, Linux, and Mac OS X systems, type this command:

cp sample-dir/hello.war as-install/domains/domain-name/autodeploy

OnWindows systems, type this command:

copy sample-dirhello.war as-installdomainsdomain-nameautodeploy

GlassFish Server automatically discovers and deploys the application. The default URL for the application is as follows:

http://localhost:8080/hello/

To Undeploy the Sample Application Automatically

Change to the domain'sautodeploydirectory.

cd as-install/domains/domain-name/autodeploy

Delete the sample application'sWAR file to undeploy and remove the application.

On UNIX, Linux, and Mac OS X systems, type this command:

rm hello.war

OnWindows systems, type this command:

del hello.war

Sun GlassFish Enterprise Server was renamed Oracle GlassFish Server in February 2010 when Oracle Corporation acquired Sun Microsystems.

All Oracle GlassFish Server Control features are available with an Oracle GlassFish Server license.

GlassFish Server Open Source Edition provides a server for the development and deployment of  Java Platform, Enterprise Edition (Java EE platform) applications and web technologies

based on Java technology. GlassFish Server 3.1 provides the following:

  • A lightweight and extensible core based on OSGi Alliance standards
  • A web container
  • An easy-to-use Administration Console for configuration and management
  • Update Tool connectivity for updates and add-on components
  • Support for high availability clustering and load balancing.

Oracle GlassFish Server 2 is best for deployments that require support for Java Platform, Enterprise Edition 5 (Java EE 5) standard, centralized administration, or clustering support for high availability. Oracle GlassFish Server 3 is ideal for organizations that want to leverage Java EE 6 standard, improve developer productivity, and enable lightweight deployments using the Java EE 6 Web Profile. It also offers service availability through the mod_jk load balancing.

Sun GlassFish Enterprise Manager will be rebranded as Oracle GlassFish Server Control in the next release of the product. 

The graphical Administration Console of GlassFish Server enables you to perform the following deployment-related tasks:

To Deploy the Sample Application by Using the Administration Console

The sample application must be available before you start this task. At least one GlassFish Server domain must be started before you deploy the sample application.

Launch the Administration Console by typing the following URL in your browser: http://localhost:4848

  1. Click the Applications node in the tree on the left. The Applications page is displayed.
  2. Click the Deploy button. The Deploy Applications or Modules page is displayed.
  3. Select Packaged File to be Uploaded to the Server, and click Browse.
  4. Navigate to the location in which you saved thehello.warsample, select the file, and click  Open .You are returned to the Deploy Applications or Modules page.
  5. Specify a description in the Description field, for example: hello
  6. Accept the other default settings, and click OK.You are returned to the Applications page.
  7. Select the check box next to thehelloapplication and click the Launch link to run the application.

The default URL for the application is as follows:
http://localhost:8080/hello/
To View Deployed Applications in the Administration Console

1) Launch the Administration Console by typing the following URL in your browser:

http://localhost:4848

2) Click the Applications node in the tree on the left.

Expand the node to list deployed applications. Deployed applications are also listed in the table on the Applications page.

To Undeploy the Sample Application by Using the Administration Console

  1. Launch the Administration Console by typing the following URL in your browser http://localhost:4848
  2. Click the Applications node in the tree on the left.
  3. The Applications page is displayed.
  4. Select the check box next to thehellosample application.
  5. Remove or disable the application.
  • To remove the application, click the Undeploy button.
  • To disable the application, click the Disable button.