div.collapsecontent{display:block;}

Express (Distributed operating systems), v8.0 > Develop and deploying applications > Rapid deployment of J2EE applications > Constructing a J2EE application from artifacts > Dropping J2EE artifacts into a free-form project


Add and deleting enterprise beans to a free-form project

We can drop enterprise bean (EJB) artifacts or module files (ejb.jar) into a free-form project. The EJB artifacts can be annotated or non-annotated; they can contain source or compiled classes. The EJB artifacts include the EJB classes or the EJB interfaces (remote, local, home, and primary key class for entity beans).


Before you begin

Restriction: We can use the rapid deployment tools for packaging applications at J2EE 1.3 or 1.4 specification-levels. However, the rapid deployment tools do not support Java EE 5.0 (or later) nor J2EE 1.2 specification-level. For tools support of deploying Java EE 5 and later modules, you can use the monitored directory starting in WAS V8.0 release. For more details about the monitored directory, see Ways to install enterprise applications or modules and Installing enterprise application files by adding them to a monitored directory topics.

Prerequisites


Procedure

  1. Use your file management system to place your EJB artifacts properly into the free-form project. The directory name of the free-form project has the same string value providedd for the -project parameter used in the wrd-config command.
  2. The following activities occur when you drop EJB artifacts into a free-form project:

    • The EJB interface classes are mapped into the imported classes folder of the EJB client JAR project.
    • The EJB classes are mapped into the imported classes folder of the EJB module project.
    • A new enterprise bean entry is created in the deployment descriptor (found in the ejbModule\META-INF\ejb-jar.xml file in the EJB module project).
    • A new enterprise bean binding is created in the bindings with a default JNDI name.
    • The application is synchronized with the server.

  3. (Optional) Use the Universal Test Client to test your enterprise beans.


Example

This example shows the activities of the bean entry in the deployment descriptor when EJB resources are added and removed from the free-form project.

Tip: To monitor rapid deployment activities, run your rapid deployment session with console output. Run the rapid deployment launch tool as follows:

  1. The console output can look like this when adding an enterprise bean Java source file (called MyEJBBean.java), remote interface Java source file (called MyEJB.java), and home interface (called MyEJBHome.java) to a free-form project (called MyProject):
    [08:47:25 PM] [/MyProject/ejbs/MyEJB.java] Added
    [08:47:25 PM] [/MyProject/ejbs/MyEJBBean.java] Added
    [08:47:25 PM] [/MyProject/ejbs/MyEJBHome.java] Added
    [08:47:30 PM] [/MyProject/bin/ejbs/MyEJB.class] copied to project [MyProjectEJBClient]
    [08:47:30 PM] [/MyProject/bin/ejbs/MyEJBBean.class] copied to project [MyProjectEJB]
    [08:47:30 PM] [/MyProject/bin/ejbs/MyEJBHome.class] copied to project [MyProjectEJBClient]
    [08:47:32 PM] Enterprise bean added to ejb-jar.xml: MyEJB
    [08:47:32 PM] Enterprise bean binding for [MyEJB] added to ejb-jar-bnd.xmi.  JNDI Name is: [ejb/MyEJBBean]
    
    A new enterprise bean entry is created in the deployment descriptor (found in the ejbModule\META-INF\ejb-jar.xml file in the EJB module project):
    <session id="Session_1092185252700">
    <ejb-name>MyEJB
    </ejb-name>
    <home>ejbs.MyEJBHome
    </home>
    <remote>ejbs.MyEJB
    </remote>
    <ejb-class>ejbs.MyEJBBean
    </ejb-class>
    <session-type>Stateless
    </session-type>
    <transaction-type>Container
    </transaction-type>
    </session> 
    A new enterprise bean binding is created in the bindings with a default JNDI name. The ibm-ejb-bnd.xmi file might contain the following entries:
    <ejbBindings xmi:id="EnterpriseBeanBinding_1092185252700" jndiName="ejb/MyEJBBean">
    <enterpriseBean xmi:type="ejb:Session" href="META-INF/ejb-jar.xml#Session_1092185252700"/>
    </ejbBindings> 
  2. The console output can look like this example when adding a local interface (called MyEJBLocal.java) and local home interface (called MyEJBLocalHome.java) for the same bean in the same free-form project:
    [08:52:59 PM] [/MyProject/ejbs/MyEJBLocal.java] Added
    [08:52:59 PM] [/MyProject/ejbs/MyEJBLocalHome.java] Added
    [08:52:59 PM] [/MyProject/bin/ejbs/MyEJBLocal.class] copied to project [MyProjectEJBClient]
    [08:52:59 PM] [/MyProject/bin/ejbs/MyEJBLocalHome.class] copied to project [MyProjectEJBClient]
    [08:53:01 PM] Local view type added for ejb: MyEJB
    
    An update is made to the existing deployment descriptor (found in the ejbModule\META-INF\ejb-jar.xml file in the EJB module project):
    <session id="Session_1092185252700">
    <ejb-name>MyEJB
    </ejb-name>
    <home>ejbs.MyEJBHome
    </home>
    <remote>ejbs.MyEJB
    </remote>
    <local-home>ejbs.MyEJBLocalHome
    </local-home>
    <local>ejbs.MyEJBLocal
    </local>
    <ejb-class>ejbs.MyEJBBean
    </ejb-class>
    <session-type>Stateless
    </session-type>
    <transaction-type>Container
    </transaction-type>
    </session> 
  3. The console output can look like this example when the local interface (called MyEJBLocal.java) is removed from the same free-form project:
    [08:56:27 PM] [/MyProject/bin/ejbs/MyEJBLocal.class] Deleted
    [08:56:27 PM] [/MyProject/ejbs/MyEJBLocal.java] Deleted
    [08:56:28 PM] Local view type removed ejb: MyEJB
    
    Since the local interface was removed from the free-form project and the existing local home interface is not sufficient to define a local view type the bean deployment descriptor (found in the ejbModule\META-INF\ejb-jar.xml file in the EJB module project) is updated to reflect the removal of the local view type:
    <session id="Session_1092185252700">
    <ejb-name>MyEJB
    </ejb-name>
    <home>ejbs.MyEJBHome
    </home>
    <remote>ejbs.MyEJB
    </remote>
    <ejb-class>ejbs.MyEJBBean
    </ejb-class>
    <session-type>Stateless
    </session-type>
    <transaction-type>Container
    </transaction-type>
    </session> 
  4. The console output can look like this example when the remote interface (called MyEJB.java) is removed from the same free-form project:
    [09:00:04 PM] [/MyProject/bin/ejbs/MyEJB.class] Deleted
    [09:00:04 PM] [/MyProject/ejbs/MyEJB.java] Deleted
    [09:00:09 PM] Enterprise bean removed from ejb-jar.xml: MyEJB
    
    Since the remote interface has been removed from the free-form project, the existing home interface is not sufficient to define a remote view type. Both the remote and local view types are not defined, so the bean and its bindings are removed from the deployment descriptor.


Feedback

+

Search Tips   |   Advanced Search