Enterprise Java Beans (EJB) Sample

Description

This sample demonstrates injection of an EJB into a servlet. The application consists of a servlet and stateless session bean. The servlet uses annotations to inject the stateless session bean, and then performs a call on the hello method of the bean.

This sample can be installed onto runtime versions 8.5.5.0 and later.

Instructions

To run the EJBSample application:

  1. Extract the sample into the Liberty installation by running the command below from the root of your server installation:
    java -jar EJBSample.jar
  2. Start the EJBSample server by running the command below from the bin directory in the Liberty profile installation:
    server run EJBSample
  3. Confirm the application started by looking for the following message in the log:
    CWWKZ0001I: Application EJBSample started in XX.XX seconds.
  4. In your browser, enter the URL for the application: http://localhost:9132/EJBApp/sampleServlet (where 9132 is the default HTTP endpoint).
  5. In your browser, you should see the message "Hello EJB World".

Notes

  • The application is automatically installed because it is located in the server dropins directory. Any number of applications can be installed from this location.
  • Source code for the application can be found in the application's EAR file, located in the EJBSample/dropins folder.

Sample Structure

  • wlp
    • usr
      • servers
        • EJBSample
          • Copyright.txt
          • dropins
            • EJBApp.ear
          • readme.html
          • server.xml

Support Information

For further information and resources for developers using IBM WebSphere Application Server, please visit wasdev.net.

Licensed Materials - Property of IBM © Copyright IBM Corp. 1997, 2013. All Rights Reserved. IBM, and the IBM logo are trademarks or registered trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at Copyright and trademark information.