Home > Documentation > Developer's guide > Tutorials > EJB applications > Stateless Session Bean |
This application will take you through the basics of Stateless Session Bean. This application will demonstrate how annotations like @Stateless, @Resource, @PostConstruct, @PreDestroy are used in an EJB3 application.
The application walks through a authentication page, where the user has to authenticate to move to the resource page of Apache Geronimo. In case of a new user, the user has to go through the registration process. Later the user will be directed to login page again once the registration is done. In the login page the bean class will check for the username and password entered by the user against a database.
Basically a Stateless Session EJB is used whenever there is a single step process and maintaining a session is obsolete. In this sample the user registration form is a one step process and hence we have used stateless session bean for its implementation. The login page is a misnomer and should not be considered as an implementation for stateless session ejb. This is because once logged in you need to maintain the session and stateless session beans are not meant to maintain the session.
To run this tutorial, as a minimum you will be required to have installed the following prerequisite software.
Details on installing eclipse are provided in the Development environment section.
This tutorial is organized in the following sections:
Due to some limitations in Geronimo Eclipse Plugin the generated deployment plan(openejb-jar.xml) does not have the correct namespace. Replace the existing namespace as shown in the figure with the following
<openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.2" xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2" xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen-2.0" xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.2" xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">
This will be explained in the deploy an run section
To make the datasource visible to EJB we need to add a dependency to the EJB deployment plan that is openejb-jar.xml. The above element can be obtained automatically from Geronimo Database Pool wizard. Select usage against the database pool jdbc/userds
Due to limitation with Geronimo Eclipse Plugin, you will have to export the Stateless Session EJB project and Web Application project as a jar and war respectively.
Bookmark this on Delicious Digg this | Privacy Policy - Copyright © 2003-2011, The Apache Software Foundation, Licensed under ASL 2.0. |