このコンテンツは選択した言語では利用できません。

Chapter 15. The Hello World Quickstart


15.1. The Hello World Quickstart

Hello World is a simple quickstart that illustrates how to store and retrieve data from a cache using Red Hat JBoss Data Grid. For this quickstart, users can access the cache in two ways:

  • from a servlet.
  • from a JSF page using request scoped beans.

All libraries (JAR files) bundles with the application are deployed to JBoss Enterprise Application Platform 7.x. JBoss Data Grid’s Library mode only allows local access to a single node in a distributed cluster. This mode also allows the application to access the data grid functionality within a virtual machine in the target container.

Important

The Hello World quickstart works only in JBoss Data Grid’s Library mode.

Location

JBoss Data Grid’s Hello World quickstart is available at the following location: jboss-datagrid-{VERSION}-quickstarts/

15.2. Quickstart Prerequisites

The prerequisites for this quickstart are as follows:

  • Java 8.0 (Java SDK 1.8) or better
  • JBoss Enterprise Application Platform 7.x or JBoss Enterprise Web Server 2.x
  • Maven 3.0 or better
  • Configure the Maven Repository. For details, see Install and Use the Maven Repositories.

15.3. Start Two Application Server Instances

Before deploying the Hello World quickstart, start two instances of your application server (JBoss Enterprise Application Platform 7.x).

Start the First Application Server Instance

  1. Navigate to the Root Directory

    In the command line terminal, navigate to the root for your JBoss server directory.

  2. Start the First Application Server

    Depending on your operating system, use the appropriate command from the following to start the first instance of your selected application server:

    1. For Linux:

      $JBOSS_HOME/bin/standalone.sh
      Copy to Clipboard Toggle word wrap
    2. For Windows:

      $JBOSS_HOME\bin\standalone.bat
      Copy to Clipboard Toggle word wrap

Start the Second Application Server Instance

  1. Clone the Application Server

    Create a copy of the selected JBoss Server to create a second instance.

  2. Navigate to the Root Directory

    In the command line terminal, navigate to the root for your JBoss server directory.

  3. Start the Second Application Server

    Use the appropriate command for your operating system from the following commands. This command starts the server with the provided port offset to ensure that both the server instances run on the same host.

    1. For Linux:

      $JBOSS_HOME2/bin/standalone.sh -Djboss.socket.binding.port-offset=100
      Copy to Clipboard Toggle word wrap
    2. For Windows:

      $JBOSS_HOME2\bin\standalone.bat -Djboss.socket.binding.port-offset=100
      Copy to Clipboard Toggle word wrap

15.4. Build and Deploy the Hello World Quickstart

Before building and deploying the quickstart, ensure that all the listed prerequisites are met and that the two application server instances are running (see for details).

Build and Deploy the Hello World Quickstart

  1. Navigate to the Required Directory

    In the command line terminal, navigate to the root directory of the quickstart on the command line interface.

  2. Build and Deploy to the First Application Server Instance

    Use the following command to build and deploy the quickstart to the first application server instance as follows:

    # mvn clean package wildfly:deploy
    Copy to Clipboard Toggle word wrap

    This command deploys target/[path]jboss-helloworld-jdg.war to the first running server instance.

  3. Build and Deploy the Second Application Server Instance

    Use the following command to build and deploy the quickstart to the second application server instance with the specified ports as follows:

    # mvn clean package wildfly:deploy -Dwildfly.port=10090
    Copy to Clipboard Toggle word wrap

    This command deploys target/[path]jboss-helloworld-jdg.war to the second running server instance.

15.5. Access the Running Application

The Hello World quickstart application runs on the following URLs:

15.6. Test Replication on the Application

Use the following instructions to test that cache entries are replicating from the first server instance to the second as desired.

Test Replication on the Application

  1. Access the First Server

    Access the first application server and enter the key and value.

    1. Access the first application server in a browser window using the following URL:

      http://localhost:8080/jboss-helloworld-jdg
      Copy to Clipboard Toggle word wrap
    2. Insert the key foo.
    3. Insert the value bar.
  2. Access the Second Server

    Access the second application server and enter the key and value.

    1. Access the second application server in a browser window using the following URL:

      http://localhost:8180/jboss-helloworld-jdg
      Copy to Clipboard Toggle word wrap
    2. Click Get Some.
    3. Get the key foo.
    4. Click Put Some More.
    5. Insert the key mykey.
    6. Insert the value myvalue.
  3. Get All Keys and Values

    Access the first server and request all keys.

    1. Access the first application server in a browser window using the following URL:

      http://localhost:8080/jboss-helloworld-jdg
      Copy to Clipboard Toggle word wrap
    2. Click Get Some.
    3. Click Get All to request all key and values.

As the results of the last step show, all the data added at each server has been replicated to the other server.

Note

Entries expire after 60 seconds from the most recent update.

Directly Access Keys in the Cache

To interact with predefined servlets or to directly store and retrieve keys from the cache, use the following URLs:

http://localhost:8080/jboss-helloworld-jdg/TestServletPut
Copy to Clipboard Toggle word wrap
http://localhost:8180/jboss-helloworld-jdg/TestServletGet
Copy to Clipboard Toggle word wrap

15.7. Remove the Application

Use the following procedure to remove the Hello World application:

Remove the Application

  1. Start the Application Servers

    Ensure that both server instances are running.

  2. Navigate to the Root

    In the command line terminal, navigate to the root directory of the quickstart.

  3. Remove the Archive

    Use the following commands to remove the archive from both the server instances.

    1. Remove the archive from the first server as follows:

      mvn wildfly:undeploy
      Copy to Clipboard Toggle word wrap
    2. Remove the archive from the second server as follows:

      mvn wildfly:undeploy -Dwildfly.port=10090
      Copy to Clipboard Toggle word wrap
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2026 Red Hat
トップに戻る