Configuring JBoss Weld to Run with JavaServer Pages on Google App Engine

This tutorial will guide users through the process of developing and deploying a web application on version 1.3.5 of Google's AppEngine for Java using the reference implementation of the "Contexts and Dependency Injection (JSR-299)" API - JBoss Weld.  

JBoss Weld is designed to be used in a Java EE container such as Geronimo, Glassfish, JBoss AS, WebLogic, WebSphere, etc. with JavaServer Faces 1.2 and above.  The extension-based approach employed by the JBoss team developing the reference implementation for JSR-299 makes it relatively easy to use Weld in other environments such as Java SE or a standard Servlet Container such as Jetty or Tomcat.


Software Requirements

Required Software

In order to build the sample application and have it run on the Google App Engine platform, you will need to have the following software downloaded and installed locally.

Optional Software

You can download the Google AppEngine SDK v1.3.5 and install it locally on your system; however, this tutorial is written from the Eclipse perspective using the Google Plugin for Eclipse.

Pre-Configuration Steps

The following steps should be performed in advance of the process outlined below.
  1. Download and install Eclipse SDK 3.6.
  2. Follow the instructions outlined on the "Quick Start" page to install the Google Plugin for Eclipse.

Creating a New Project

  1. From the 'New' sub-menu on the 'File' menu, select the "Google Web Application Project".

  2. Give your project a name in the 'Project Name' field.  For the purposes of this tutorial, we will use "Google AppEngine JBoss Weld".
  3. Enter your project's default package name in the 'Package' field.  For the purposes of this tutorial, we will use "com.wildstartech.gae.weld".
  4. Remove the check mark from the 'Use Google Web Toolkit' box in the "Google SDKs" portion of the dialog.
  5. Ensure the "Use Google App Engine" option has a check mark beside it.
  6. Left-click on the 'Finish' button.

Importing the JBoss Weld Files

The following steps will guide you through the process of importing the files which provide support for the "Contexts and Dependency Injection" API using version 1.0.1 of the reference implementation - JBoss Weld.
  1. In the "Project Explorer" tab, located on the left side of your IDE, expand your project and navigate to and left-click on the WEB-INF/lib directory.

  2. Left-click on the 'File' menu and select the 'Import...' menu item.
  3. When presented with the "Import" dialog, left-click on the 'File System' item under the "General" option.
  4. Left-click on the 'Next' button.
  5. Left-click on the 'Browse...' button and select the folder on your local hard disk drive into which you uncompressed the files found in the archive you downloaded from the "Weld Distribution Downloads" page.  When you have selected the directory, left-click on the 'Open' button.
  6. Left-click on the arrow appearing to the left of the weld-1.0.1-Final folder.
  7. Left-click on the arrow appearing to the left of the artifacts folder.
  8. Left-click on the cdi folder.
  9. Place a check mark beside the cdi-api.jar file as shown in the figure below.

  10. Left-click on the weld folder.
  11. Place check marks beside the weld-api.jar, weld-core.jar, and weld-servlet.jar files as shown in the figure below.

  12. Left-click on the 'Finish' button to complete the process of importing the files.
  13. You will see that you now have an artifacts folder in your WEB-INF/lib folder.

  14. Expand the artifacts folder.
  15. Expand the cdi folder.
  16. Left-click on the cdi-api.jar file and drag it up and drop it onto the lib folder.
  17. Expand the weld folder.
  18. Select the weld-api.jar, weld-core.jar, and weld-servlet.jar files and drag them up an drop them onto the lib folder.
  19. Steps 14 through 18 will move the JBoss Weld libraries out of their sub-folders and into the WEB-INF/lib directory.
  20. Right-click on the artifacts folder to display the pop-up menu for the folder.

  21. Left-click on the 'Delete' menu option.
  22. When presented with the "Confirm Delete" dialog, simply left-click on the 'OK' button.

  23. After completing the process outlined above, the WEB-INF/lib folder in your web application should look similar to what is shown in the figure below.

Configuration File Changes


Edit the appengine-web.xml file found in the WEB-INF directory of the project to allow the web application to store data in the session created for clients visiting our site.  Add the <sessions-enabled>true</sessions-enabled> line as shown below.

<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="">
  <!-- Configure java.util.logging -->
  <property name="java.util.logging.config.file" value="WEB-INF/"/>

Do not forget to modify the contents of the <application></application> tag to reflect the name of your App Engine project.  Save the changes to the appengine-web.xml file and close it.


Edit the web.xml file found in the WEB-INF directory of the project to add org.jboss.weld.environment.servlet.Listener class ServletContextListener, ServletRequestListener, and HttpSessionListener.

<?xml version="1.0" encoding="utf-8"?>

<web-app xmlns:xsi=""



   xsi:schemaLocation="" version="2.5">

   <!-- JBoss Weld 1.0.1 Compatibility -->








Modifying the Web Application's Default Page

A Google App Engine web project will, by default, setup the index.html file as the default file for your web application.  In the section above, we specified a change to the <welcome-file-list> configuration parameter which instructs the App Engine's runtime environment to look for the index.jsp page as the default page.

As such, we we will rename the AppEngine's default index.html file to index.jsp.
  1. Locate and right-click on the index.html file in the war directory shown in the "Package Explorer" window.
  2. When the context-sensitive menu is displayed, left-click on the 'Rename...' menu item.


  3. When presented with the "Rename Resource" dialog, ensure the 'New name:' field indicates the index.html file should be renamed to index.jsp.

  4. Left-click on the 'OK' button to complete the file rename operation.


Bryzak, Shane. "Weld, JSF 2.0 and Google App Engine - Navigating the minefield (Part 1)" 05 Feb 2010. 05 Aug 2010.

Copyright © 2010, Wildstar Technologies, LLC.