How to download and run the Java EE 7 sample applications using the command line.

For WebSphere Application Server (WAS) V9, there are sample applications to demonstrate some of the Java EE 7 capabilities. You can download the samples from GitHub to deploy them on Liberty. The available samples include:

Find out more about each sample in the Knowledge Center.

Downloading and building the samples

Before you start, make sure you have installed Git and Maven packages for your operating system.

  1. Clone the Git repository for the sample you want to deploy. For example, for the sample.javaee7.websocket sample, change to the location where you want the files to be downloaded and enter the following command:

    git clone

    The files are downloaded to a new directory for the sample called sample.javaee7.websocket in the location where you ran the command.

  2. Move to the new sample directory that was just created.
  3. Use the Maven install command to build the sample:

    mvn install

  4. Maven creates a target directory in the sample directory with the WAR file that you can use to run the sample.

The sample is now downloaded and built. The next step is to run it.

Running the sample

You have the option of running the sample using Maven to install the Liberty server, or to just run it on a Liberty server that already exists.

Running the sample using Maven to install the Liberty server

  1. Move to the sample directory (e.g. sample.javaee7.websocket).
  2. Use maven to install a liberty server and run your application:

    mvn liberty:run-server

  3. Use your browser to access the home page of the application:


Running the sample on a separate, existing Liberty server

  1. Follow the steps in Download the WebSphere Liberty runtime.
    • To check which additional features you need to install for the sample, see the server.xml for the sample (in the sample’s GitHub repository at src/main/wlp/server.xml).
    • You can find the .war file in the target directory created by Maven when you downloaded and built the sample.
  2. Use your browser to access the home page of the application:


We’d greatly appreciate your feedback, and will be happy to answer any questions you may have on Stack Overflow.

2 comments on"Running the WAS Java EE 7 samples on Liberty without Eclipse"

  1. failed.error message:
    [INFO] Scanning for projects…
    [INFO] ————————————————————————
    [INFO] Building Java EE 7 WebSocket Sample 1.0-SNAPSHOT
    [INFO] ————————————————————————
    [INFO] ————————————————————————
    [INFO] ————————————————————————
    [INFO] Total time: 01:17 min
    [INFO] Finished at: 2016-01-12T12:21:19+08:00
    [INFO] Final Memory: 11M/155M
    [INFO] ————————————————————————
    [ERROR] Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its d
    ependencies could not be resolved: Failed to read artifact descriptor for org.ap
    ache.maven.plugins:maven-install-plugin:jar:2.4: Could not transfer artifact org
    .apache.maven.plugins:maven-install-plugin:pom:2.4 from/to central (https://repo Remote host closed connection during handshake: SSL p
    eer shut down incorrectly -> [Help 1]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR] For more information about the errors and possible solutions, please rea
    d the following articles:
    [ERROR] [Help 1]

    • Luis Enrique Cisneros Nieto February 09, 2016

      Hi, in which step is this happening?, also which OS are you using?

      Try to re-install Maven in your OS and in console command try $ mvn -v and post the result.

      Also try to install Maven in sample directory and something like this must appear at the end:

      [INFO] Installing /sample.javaee7.websocket/pom.xml to /root/.m2/repository/net/wasdev/wlp/sample/javaee7/sample.javaee7.websocket/1.0-SNAPSHOT/sample.javaee7.websocket-1.0-SNAPSHOT.pom
      [INFO] ————————————————————————
      [INFO] ————————————————————————
      [INFO] Total time: 5.650 s
      [INFO] Finished at: 2016-02-09T15:16:32-05:00
      [INFO] Final Memory: 22M/35M
      [INFO] ————————————————————————

      if this doesn’t appear, please try to re-install Maven in your OS and in console command try $ mvn -v and post the result.

      I have Apache Maven 3.3.9 and I’ve deployed the sample in both options in a Linux based OS without any problem if you can explain a little more about the problem i will try to help you more.


Join The Discussion

Your email address will not be published. Required fields are marked *