Posts Tagged ‘websphere


Getting Apache Tomahawk to work in Websphere 6.1 and JSF 1.1

This page describes how to get Apache MyFaces Tomahawk to work with IBM Websphere 6.1 / JSF 1.1 / Servlet Specification 2.4 combo.


  • Java 1.5
  • Maven 2
  • Eclipse or IBM RAD 7.5 Development Environment
  • Websphere Test Environment (understand how to create and deploy an Ear file)
  • Servlet 2.4, JSF 1.1 (Default in WAS 6.1)


Websphere 6.1 Application server comes pre-installed with Sun’s Reference Implementation of JSF. Unless you change the Classloader policy of your application to PARENT_LAST it is difficult to get the myfaces-impl and myfaces-api to play nice with the JARS that come pre-installed. Also if you are converting an existing application, then changing the classloader policy can open up a new can of worms. Therefore it is just easier to use the JSF Implementation available by default on the Websphere App Server.

Note: The examples in this page do NOT use the “standard maven directory structure”.  The jsp and the WEB-INF files will be kept in the “WebContent” folder instead of “src/main/webapp”. This is on purpose since we want this project to work in RAD 7.5 development environment.

Project Setup

Create a blank project using Maven archetype. Open up the command prompt and navigate to an empty directory.

mvn archetype:generate -DarchetypeArtifactId=maven-archetype-webapp

groupId: com.test
artifactId: jsfTest

Answer the rest of the questions with defaults “Just hit the enter key”

Since we are not using the maven standard directory structure you need to add the “WebContent” and the “WebContent/WEB-INF” folders right under the project main directory. Once these folders are created then move the files from the “src/main/webapp” to “WebContent”.


The archetype will set up most of the directory structure and generate a blank web.xml file and a pom.xml. At this time open up the pom.xml file and modify it to the way you see it below.

Notice in the file below, the myfaces-impl and myfaces-api are in the “provided” scope. This means that the jars will be available during compile time but will NOT be included during runtime.


<project xmlns="" xmlns:xsi=""
  <name>jsfTest Maven Webapp</name>


	    <scope>provided</scope> <!--use compile scope for testing with jetty-->

	    <scope>provided</scope> <!--use compile scope for testing with jetty-->

							<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/WebSphere v6.1 JRE</classpathContainer>



<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app xmlns=""
	xmlns:xsi="" id="WebApp_ID"

  <display-name>Archetype Created Web Application</display-name>


	<!-- extension mapping for adding <script/>, <link/>, and other resource tags to JSF-pages  -->
	    <!-- servlet-name must match the name of your javax.faces.webapp.FacesServlet entry -->
	    <servlet-name>Faces Servlet</servlet-name>

	<!-- extension mapping for serving page-independent resources (javascript, stylesheets, images, etc.)  -->

        <servlet-name>Faces Servlet</servlet-name>

        <servlet-name>Faces Servlet</servlet-name>



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

<!DOCTYPE faces-config PUBLIC
    "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"




<%@ page session="false" contentType="text/html;charset=utf-8"%>
<%@ taglib uri="" prefix="h"%>
<%@ taglib uri="" prefix="f"%>
<%@ taglib uri="" prefix="t" %>

            <h1>Input Text Help</h1>
        <t:outputText value="hello tomahawk"/>

        <h:outputText value="Select helper text:"/>
        <t:inputTextHelp value="" id="i1" helpText="Hello World"/>
        <h:outputText value="Select helper text:"/>
        <t:inputTextHelp value="" id="i2" selectText="true" helpText="TT.MM.JJJJ"/>

Generated Javascript in Websphere 6.1 (important)

This step is important don’t skip it.

The Apache Tomahawk framework generates javascript for some of the components. You need to enable the following setting in “Application servers > server1 > Web container > Custom Properties”
Set the custom property “” = true

Also don’t forget to do the same thing when your program reaches QA or PROD environments.

Testing using Websphere Test Environment

In order to run a Dynamic Web Project in the Application server built into RAD just create an Enterprise Project and put the Web Project into the EAR. Deploy the ear just like any other project. Start the application server and navigate to http://localhost:9081/jsfTest/index2.jsf

Testing using Jetty

This application can also be tested using jetty servlet engine. You just need to make sure to change the two <scope>provided</scope> tags to <scope>compile</scope>

After changing the pom.xml file above just type “mvn jetty:run” on the command line and then navigate to http://localhost:8080/index2.jsf using your browser.


Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 74 other followers

March 2017
« Mar    

Blog Stats

  • 800,977 hits