EJB

EJB Projects

EJB Project 1

EJB Examples

EJB EXAMPLE

Install an Enterprise JavaBeans Server
Previous Home Next

EJB components run inside Enterprise JavaBeans containers, which are supplied by Enterprise JavaBeans server vendors and the all instructions below will assist in downloading and installing a BEA Weblogic server in which the DemoBean will run.

  1. First Downloaded BEA WebLogic's server from the BEA WebLogic web site.
  2. Then extract the distribution using jar or the unzip utility. and the throughout this tutorial it is assumed that Weblogic is installed in the /export directory, for example, /export/weblogic.
  3. After that downloading the latest version of the Java Development Kit from the Java Development Kit for Solaris web site.
  4. Set your CLASSPATH on the server host:
  5. Add weblogic/classes and weblogic/lib/weblogicaux.jar to your Java CLASSPATH. Make sure you have . or your current directory in the CLASSPATH as well.
  6. Add weblogic/lib/solaris to your LD_LIBRARY_PATH
  7. Edit the BEA WebLogic properties file weblogic.properties
  8. Set the system password property, weblogic.password.system
  9. Start the Weblogic server using the startWebLogic.sh script.

 

After following the steps in this tutorial to build and deploy the example bean, check that the Enterprise JavaBeans bean has been deployed correctly, either by checking the server command-line window, or by opening the Console and examining EJB under the Distributed Objects you should see DemoBean deployed, and you can monitor its activity.

Building A Stateless Session bean:
Remote Interface:
  • This step we are creating the Enterprise JavaBeans remote interface.
  • Save the code example to a file as indicated.

Remote interface is the client's view of the Enterprise JavaBeans, and the task of the Enterprise JavaBeans developer is to declaring this interface using Java RMI syntax. It is the responsibility of the Enterprise JavaBeans' container tools provider to generate the code of this interface.

Note: The limitations on what can be specified in this interface. For a full total list to see the Enterprise JavaBeans Specification, and it's important that, all objects are using, the parameters, return values, and exceptions are valid types in the Java to IDL Mapping Specification.

For the simple DemoBean here is the remote interface source. Save this to a file named Demo.java.

package ejb.demo;
import java.rmi.RemoteException;
import java.rmi.Remote;
import javax.ejb.*;
public interface Demo extends EJBObject, Remote 
	{

   // NB this simple example does not even do a

  // lookup in the database

  public String demoSelect() throws RemoteException;
 }
 
Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: