outsource from india chennai india programmers freelance php coder freelance outsource scripts programming complicated perl patterns php module installation
outsource from india perl installation and configuration php installation linux system administration US$15,US$19,US$11,US$10 cheap programmer
india outsource outsource india chennai india programmers php perl mysql freelance freelance programmer
SHOWCASE of php and perl scripts CONTACT US for php custom perl scripts
HOME
 
Next Previous Contents

7. How to Setup Enterprise Java Bean (EJB) Support

To be written.

7.1 BEA WebLogic

To be written.

See http://www.beasys.com/linux/for more information.

7.2 EJBoss

Background

EJBoss has been renamed JBoss and is well advanced with stable J2EE compliant releases at http://www.jboss.org/.

This section was written when it was still EJBoss 0.95 and needs to be updated.

Download

JBoss can be downloaded from the JBoss website at http://www.jboss.org/.

Installation

I suggest installing files in the /usr/local directory. After downloading, run:

mkdir /usr/local/ejboss 
mv ejboss* /usr/local/ejboss

Unjar the file:

jar xvf ejboss095_jdk122.jar

You should see various files and directories created under /usr/local/ejboss.

The above example shows EJBoss 0.95 for JDK 1.2.2. Substitute the file names as appropriate.

Setting up Your Environment

The environment variables to set up are:

  • CLASSPATH

The CLASSPATH environment variable references all JARs and directories that you will need to compile and run Java programs.

Include the EJBoss JAR and the beans/generated directory in your CLASSPATH.

export CLASSPATH=/usr/local/ejboss/lib/ejboss095_jdk122.jar:/usr/local/ejboss/beans/generated:$CLASSPATH

Confiming Your Installation

You are now ready to compile and run a simple EJB application. Create the following three source files for the server.

First, the business interface.

// EJBTest.java

import javax.ejb.*;
import java.rmi.RemoteException;

public
 interface EJBTest extends EJBObject { 
  public String greet() throws
 RemoteException;

}

Second, the home interface.

// EJBTestHome.java

import javax.ejb.*;
import java.rmi.RemoteException;

public
 interface EJBTestHome extends EJBHome {

  public EJBTest create() throws
 
   CreateException, RemoteException;
}

Third, the bean implementation class.

// EJBTestBean.java

import javax.ejb.*;
import java.rmi.RemoteException;

public
 interface EJBTestBean implements SessionBean {

  private SessionContext
 mContext = null;

  public void ejbPassivate() {
    System.out.println("EJBTestBean
 passivated.");
}

  public void ejbActivate() {
    System.out.println("EJBTestBean
 activated.");
}

  public void ejbCreate() {
    System.out.println("EJBTestBean
 created.");
}

  public void ejbRemove() {
    System.out.println("EJBTestBean
 removed.");
}

  public void setSessionContext() {
    System.out.println("EJBTestBean
 context set.");
    mContext = context;
}

  public String greet()
 {
    return "Hello, I'm an EJB!";
}

}

Compile the server source files with the Java compiler:

javac EJBTest*.java

If the compiler produces errors, double check the syntax and confirm your PATH and CLASSPATH.

Now that you have successfully written and compiled the server source files, you need to deploy your bean to EJBoss. Deploying a bean to EJBoss requires several steps that must be performed exactly.

First, create the file ejb-jar.xml.

<?xml version="1.0" encoding="Cp1252"?>
 
<ejb-jar ID="">
     <description></description>
     <display-name></display-name>
     <small-icon></small-icon>
     <large-icon></large-icon>
     <ejb-client-jar></ejb-client-jar>
     <enterprise-beans>
       <session>
         <description>Nextgen bean</description>
         <ejb-name>nextgen.EJBTest</ejb-name>
         <home>EJBTestHome</home>
         <remote>EJBTest</remote>
         <ejb-class>EJBTestBean</ejb-class>
         <session-type>Stateful</session-type>
         <transaction-type>Bean</transaction-type>
         <env-entry>
           <description></description>
           <env-entry-name></env-entry-name>
           <env-entry-type>java.lang.String</env-entry-type>
           <env-entry-value></env-entry-value>
         </env-entry>
         <resource-ref>
           <description></description>
           <res-ref-name></res-ref-name>
           <res-type></res-type>
           <res-auth>Container</res-auth>
         </resource-ref>
       </session>
     </enterprise-beans>
     <assembly-descriptor />
   </ejb-jar>

The above file, which must be named ejb-jar.xml identifies the interface and class names of files that you just created as well as a name for the object.

Second, relative to the directory of the three class files you just created, create a META-INF directory.

mkdir META-INF
mv ejb-jar.xml META-INF

Third, package all four files into a jar.

jar cvf EJBTest.jar EJBTest*.class META-INF/ejb-jar.xml

You should see that it added the manifest as well as the three class files and the XML deployment descriptor file.

Fourth, put the JAR you just created in the EJBoss beans directory.

mv EJBTest.jar /usr/local/ejboss/beans

Fifth, move the class files you created to the EJBoss beans/generated directory.

mv EJBTest*.class /usr/local/ejboss/beans/generated

(This fifth step is redudant due to a bug in EJBoss 0.95. )

You are now ready to start the EJBoss server.

cd /usr/local/ejboss

sh server.sh

You should see the proxy files compile automatically and confirmation that your EJB is deployed.

You are now ready to write, compile and test the simple client applicaiton.

7.3 Bullsoft JOnAS EJB

To be written.

See http://www.bullsoft.com/ejb/for more information.


Next Previous Contents
Linux HOWTO full list
   This document, LDP HOWTO-INDEX, is copyrighted (c) 1995 - 2002 by Tim Bynum, Guylhem Aznar, Joshua Drake and Greg Ferguson. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is available at http://www.gnu.org/copyleft/fdl.html. If you have questions, please contact the LDP.
Web Design Copyright © 1999-2003. Chrisranjana Software Solutions Pvt Ltd. syndicate rss feed