Development of the above EJB application proceeds as follows:
Create the project for the EJB
In order to create the enterprise bean, first create an EJB project. When the EJB project is created as directed by the wizard, the classpath and other settings required for the build are set automatically.
Create the Session Bean
Use the following procedure to create a session bean:
Create the data class
Create the data class to be used to implement the session bean.
Create the pattern for the session bean
Use the wizard to create the session bean pattern. Since the application completes using one method, create a stateless session bean.
Implement the session bean
Declare the method in the session bean created using the wizard to implement processing.
Create an EAR project
Create a project in order to create an EAR file for deployment as one application including the EJB client. When creating the EAR project, specify to include the created EJB project in the EAR file. Since the EJB client is not yet created, specify to include the EJB client in the EAR file when creating the EJB client project.
Create the EJB client
Use the following procedure to create the EJB client:
Create the client project
Create a dynamic Web project for creating a Web application as an EJB client.
Set the build path
Set the build path for invoking the enterprise bean from the Web application.
Create a servlet class
Use the wizard to create a servlet as a controller for receiving Web application requests.
Create an I/O page
Use the wizard to create the Web application I/O page.
Specify the Dependency Injection
Set the Dependency Injection in the field such that the session bean method is invoked from the servlet.
Implement the session bean invocation processing
Implement the processing for invoking the session bean method using the field that declared the Dependency Injection.
Check the application operation
Use the following procedure to check the Application operation:
Associate the project and the server
Set which server the application is deployed on. Since the applications are grouped as an EAR, add the EAR project to the server.
Set the breakpoints
Set the breakpoints for the debugger to check the program operation during execution.
Launch the server
Launch the server so that it can receive requests in relation to the application from Web browsers. Deployment is performed automatically before the server starts.
Execute the application
Launch the Web browser and access the application URL to start checking the operation of the application.
Debug the application
Debug the program and check that the application is operating correctly.
Deploy the application to the operating environment.
Use the following procedures to deploy the application to the operating environment:
Export the application
Create an EAR file to deploy the application to the operating environment.
Deploy the application to the operating environment
Deploy the EAR file from the Interstage Java EE Admin Console.