jst j2ee
test plan: Runnning an EAR module containing an EJB module on JONAS 4.x.
Intoduction
 

This test case walkthroughs the steps required to deploy and run an ear module in the eclipse.

 
Steps
 

  1. First set up JONAS Runtime from the Windows->Preferences->Server->Installed Runtime.



    Figure 1: Setup the JONAS Runtime from Windows->Preferences->Server->Installed Runtime.


  2. Open J2EE perspective, from the Dynamic Web Projects, right click and choose "New" and then choose "J2EE Web Project"

    Figure 2: Open the J2EE Perspective.

    Figure 3: Enter the name of the new Project, select your Target runtime, and uncheck "Add module to EAR project".



  3. Create a servlet by right clicking on the web project you created, select "New>Class"..

    Figure 4: Enter a Java package and Java name. Select javax.servlet.http.HttpServlet as the super class.



  4. Open the new HeaderSnoop.java under "TestWebProject/Java Resources/JavaSource//HeaderSnoop.java" and copy following method into the body of the file:
    public void doGet(HttpServletRequest req, HttpServletResponse resp) 
    		throws ServletException, IOException
    {
    	resp.setContentType("text/plain"); 
    	PrintWriter out = resp.getWriter(); 
    	Enumeration names = req.getHeaderNames();
    	while(names.hasMoreElements()) { 
    		String name = (String)names.nextElement(); 
    		String val = req.getHeader(name); 
    		if( val != null ) { 
    			out.println(name+":"+val ); 
    		} 
    	} 
    }
    					


  5. Add the following declaration to your web.xml after the display-name element:
    <servlet>
    	<servlet-name>HeaderSnoop</servlet-name>
    	<servlet-class>org.test.HeaderSnoop</servlet-class>
    	</servlet> <servlet-mapping>
    	<servlet-name>HeaderSnoop</servlet-name>
    	<url-pattern>/HeaderSnoop</url-pattern>
    </servlet>
    
    					


  6. Configure Tomcat from the Servers view in the J2EE perspective

    Figure 5: By default, the available module groupings are presented to the user.



  7. Hit finish and you will see following

    Figure 6: By default, the available module groupings are presented to the user.



  8. Go to the project in the Project Explorer, select the web project, right click and select "Run As", you will see Apache Tomcat, create runtime configuration for the web project by selecting "New" button.

    Figure 7: By default, the available module groupings are presented to the user.


  9. Now Run the server from the Servers view, and view the servlet.