HelloWorld-JDG is a basic example that shows how to store and retrieve data to/from the cache. Users can access the cache either from a servlet or from a JSF page through request scoped beans.
Infinispan is configured in clustered distributed mode with synchronous replication. Entries have their lifespan (expiration) and are removed from the cache after 60 seconds since last update.
HelloWorld-JDG example works in Library mode. In this mode, the application and the data grid are running in the same JVM. All libraries (JAR files) are bundled with the application and deployed to Red Hat JBoss Enterprise Application Platform. The library usage mode only allows local access to a single node in a distributed cluster. This usage mode gives the application access to data grid functionality within a virtual machine in the container being used.
All you need to build this project is Java 6.0 (Java SDK 1.6) or better, Maven 3.0 or better.
The application this project produces is designed to be run on Red Hat JBoss Enterprise Application Platform (EAP) 6.1 or later.
If you have not yet done so, you must Configure Maven before testing the quickstarts.
The following shows the command line to start the server with the web profile:
For Linux: $JBOSS_HOME/bin/standalone.sh For Windows: %JBOSS_HOME%\bin\standalone.bat
Start the server with pre-configured port offset so that the server can run on the same host
For Linux: $JBOSS_HOME2/bin/standalone.sh -Djboss.socket.binding.port-offset=100 For Windows: %JBOSS_HOME2%\bin\standalone.bat -Djboss.socket.binding.port-offset=100
NOTE: The following build command assumes you have configured your Maven user settings. If you have not, you must include Maven setting arguments on the command line. See Build and Deploy the Quickstarts for complete instructions and additional options.
Type this command to build and deploy the archive to the first server:
mvn clean package jboss-as:deploy
target/jboss-helloworld-jdg.warto the first running instance of the server.
Type this command to build and deploy the archive to the second server (running on different ports):
mvn clean package jboss-as:deploy -Djboss-as.port=10099
target/jboss-helloworld-jdg.warto the second running instance of the server.
The application will be running at the following URLs:
You can test replication of entries in the following way:
NOTE: Entries expire and simply disappear after 60 seconds from last update.
To access predefined servlets and directly store/retrieve a key in the cache, access the following URLs:
http://localhost:8080/jboss-helloworld-jdg/TestServletPut http://localhost:8180/jboss-helloworld-jdg/TestServletGet (note the different port 8180)
When you are finished testing, type this command to undeploy the archive from both running servers:
mvn jboss-as:undeploy mvn jboss-as:undeploy -Ddeploy.port=10099
You can also start the server and deploy the quickstarts from Eclipse using JBoss tools. For more information, see Use JBoss Developer Studio or Eclipse to Run the Quickstarts
If you want to debug the source code or look at the Javadocs of any library in the project, run either of the following commands to pull them into your local repository. The IDE should then detect them.
mvn dependency:sources mvn dependency:resolve -Dclassifier=javadoc
If you want to test the application, there are simple Arquillian Selenium tests prepared. To run these tests on EAP:
Build the quickstart using:
mvn clean package
Type this command to run the tests (server paths can be the same):
mvn test -Puitests-clustered -Das7home=/path/to/first/server -Das7home2=/path/to/second/server