| <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html lang="en-us" xml:lang="en-us"> |
| <head> |
| <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> |
| <meta name="copyright" content="Copyright (c) 2000, 2011 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html. Contributors: IBM Corporation - initial API and implementation" /> |
| <meta name="DC.rights.owner" content="(C) Copyright 2000, 2011" /> |
| <meta content="public" name="security" /> |
| <meta content="index,follow" name="Robots" /> |
| <meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' /> |
| <meta content="concept" name="DC.Type" /> |
| <meta name="DC.Title" content="EJB 2.x development resources" /> |
| <meta name="abstract" content="This topic describes resources and development tools that are commonly used in EJB version 2.x development." /> |
| <meta name="description" content="This topic describes resources and development tools that are commonly used in EJB version 2.x development." /> |
| <meta content="EJB, developing, resources, EJB development" name="DC.subject" /> |
| <meta content="EJB, developing, resources, EJB development" name="keywords" /> |
| <meta scheme="URI" name="DC.Relation" content="../topics/ceover.html" /> |
| <meta scheme="URI" name="DC.Relation" content="../topics/tecrtpro.html" /> |
| <meta scheme="URI" name="DC.Relation" content="../topics/ceclientjars.html" /> |
| <meta scheme="URI" name="DC.Relation" content="../topics/teimp.html" /> |
| <meta scheme="URI" name="DC.Relation" content="../topics/teexp.html" /> |
| <meta content="XHTML" name="DC.Format" /> |
| <meta content="ceresrc" name="DC.Identifier" /> |
| <meta content="en-us" name="DC.Language" /> |
| <link href="../../org.eclipse.wst.doc.user/common.css" type="text/css" rel="stylesheet" /> |
| <title>EJB 2.x development resources</title> |
| </head> |
| <body id="ceresrc"><a name="ceresrc"><!-- --></a> |
| |
| |
| <h1 class="topictitle1">EJB 2.x development resources</h1> |
| |
| |
| |
| <div><p>This topic describes resources and development tools that are commonly |
| used in EJB version 2.x development.</p> |
| |
| <dl> |
| <dt class="dlterm"><strong>EJB modules</strong></dt> |
| |
| <dd> <p>EJB modules are displayed in the Project Explorer view of the Java™ EE |
| perspective, and they correspond to EJB projects.</p> |
| <p>An EJB module is used |
| to assemble one or more enterprise beans into a single deployable unit. An |
| EJB module is developed in an EJB project, and it can either be exported as |
| a standalone EJB JAR file, or combined with other EJB or Web modules within |
| an enterprise application. An EJB JAR file uses the format of a standard Java archive |
| file. An EJB module contains the following: </p> |
| <ul> |
| <li>One or more enterprise beans and their associated .class and .java files.</li> |
| |
| <li>Graphics and other files depending on the need of the enterprise bean. </li> |
| |
| <li>A deployment descriptor. The file type for the deployment descriptor is |
| Extensible Markup Language (XML). This file declares the contents of the EJB |
| module, defines the structure of the beans in the module, and provides a description |
| of how the beans are to be used at run time. </li> |
| |
| <li>A MANIFEST.MF file in the <span class="uicontrol">META-INF</span> directory. The |
| manifest file can contain a class path entry, with references to other JAR |
| files or EJB modules in a J2EE enterprise application. It defines the module's |
| external dependencies.</li> |
| |
| </ul> |
| <p>An EJB module is installed and runs in an EJB container.</p> |
| <p>An |
| enterprise bean is a Java component that can be combined with |
| other resources to create distributed client/server applications.</p> |
| <div class="note"><span class="notetitle">Note:</span> If |
| you choose to create an EJB client JAR file for your EJB module, the client |
| interface classes for the enterprise beans will not be included in the EJB |
| JAR file, but are included in the EJB client JAR file.</div> |
| </dd> |
| |
| |
| <dt class="dlterm"><strong>EJB projects</strong></dt> |
| |
| <dd> <p>In the workbench, you create and maintain resources for enterprise |
| applications in projects. An EJB project is a logical module that allows you |
| to organize your enterprise beans.</p> |
| <p>The workbench supports EJB 1.1, EJB |
| 2.0, and EJB 2.1 projects. The J2EE specification level of a containing EAR |
| project must be set to J2EE 1.3 or higher for EJB 2.0 projects, and J2EE 1.4 |
| for EJB 2.1 projects. In an EJB 1.1 project, you will only be able to create |
| EJB 1.1 beans.</p> |
| <p>An EJB project is a specialized Java project. |
| Like a Java project, an EJB project must have one or more source |
| folders to contain the source and output files for the project. By default, |
| the source folder is named <strong>ejbModule</strong>, but you can change that name |
| when you create the project or new source folders. When you publish or deploy |
| the project, the contents of the folder or folders are aggregated. </p> |
| <p>You |
| cannot use the EJB project as the source folder, doing so will cause errors. |
| Also, though you can have more than one source folder in the project, only |
| one of these source folders can contain the <span class="uicontrol">META-INF</span> folder |
| in which the MANIFEST.MF and deployment descriptor files reside.</p> |
| <div class="note"><span class="notetitle">Note:</span> If |
| you choose to create an EJB client JAR file for your EJB module, the client |
| interface classes for the enterprise beans will not be included in the EJB |
| project, but in separate EJB client JAR project. EJB client JAR projects are |
| displayed in the Project Explorer as Java projects under the <strong>Other Projects</strong> node.</div> |
| </dd> |
| |
| |
| <dt class="dlterm"><strong>EJB client projects</strong></dt> |
| |
| <dd> <p>The EJB tooling supports the creation of EJB client JAR projects for |
| EJB modules. An EJB client JAR project contains all the interface classes |
| that a client program needs to use the client views of the enterprise beans |
| that are contained in the EJB project. When you create an EJB client project |
| for an EJB project, a new Java project is created and added to your |
| workspace. The EJB client project is added as a project utility JAR file to |
| each module that the EJB project belongs to.</p> |
| <p>By default, when you use |
| the wizard to create an EJB project, an EJB client JAR project is also created. |
| However, you can clear this option in the wizard.</p> |
| <div class="tip"><span class="tiptitle">Tip:</span> You |
| can also add the EJB client project to another enterprise application that |
| does not include the EJB project as a module. This will ensure that the EJB |
| client JAR file is exported and packaged with the EAR file when the application |
| is exported.</div> |
| </dd> |
| |
| |
| <dt class="dlterm"><strong>Enterprise beans</strong></dt> |
| |
| <dd> <p>An enterprise bean is a Java component that can be combined with |
| other resources to create distributed client/server applications.</p> |
| <p>There |
| are three types of enterprise beans: entity beans, session beans, and message-driven |
| beans. Typically, all types of beans are used together within an enterprise |
| application.</p> |
| <dl> |
| <dt class="dlterm"><strong>Entity beans</strong></dt> |
| |
| <dd>Entity beans store permanent data. Entity beans with container-managed |
| persistence (CMP) require database connections. Entity beans with bean-managed |
| persistence manage permanent data in whichever manner is defined in the bean |
| code. This can include writing to databases or XML files, for example.</dd> |
| |
| |
| <dt class="dlterm"><strong>Session beans</strong></dt> |
| |
| <dd>Session beans do not require database access, though they can obtain it |
| indirectly (as needed) by accessing entity beans. Session beans can also obtain |
| direct access to databases (and other resources) through the use of resource |
| references.</dd> |
| |
| |
| <dt class="dlterm"><strong>Message-driven beans</strong></dt> |
| |
| <dd>Message-driven beans are a special kind of enterprise bean that act as |
| message consumers in the JMS messaging system. As with standard JMS message |
| consumers, message-driven beans perform business logic based on the message |
| contents. In several ways, the dynamic creation and allocation of message-driven |
| bean instances mimics the behavior of stateless session enterprise beans. |
| However, message-driven beans are different from stateless session enterprise |
| beans (and other types of enterprise beans) in a couple of ways:<ul> |
| <li>Message-driven beans process multiple JMS messages asynchronously, rather |
| than processing a serialized sequence of method calls.</li> |
| |
| <li>Message-driven beans have no home or remote interface, and therefore cannot |
| be directly accessed by internal or external clients.</li> |
| |
| </ul> |
| </dd> |
| |
| </dl> |
| </dd> |
| |
| |
| <dt class="dlterm"><strong>Deployment descriptors</strong></dt> |
| |
| <dd> <p>A deployment descriptor contains configuration data that the runtime |
| environment uses for an application. A deployment descriptor can include information |
| about the following: </p> |
| <ul> |
| <li>The structure and content (enterprise beans, for example) of the application.</li> |
| |
| <li>References to internal and external dependencies. For example, an enterprise |
| bean in an EJB module can require another enterprise bean that is not bundled |
| in the same module.</li> |
| |
| <li>References to resource factory objects, such as URLs or JDBC data sources.</li> |
| |
| <li>Security roles that the container uses when implementing the required |
| access control for the application.</li> |
| |
| <li>Transactional information about how (and whether) the container is to |
| manage transactions for the application.</li> |
| |
| </ul> |
| <p>Deployment descriptors are XML files packaged with the application's |
| files in a Java archive file. An EJB deployment descriptor is called |
| ejb-jar.xml and is located in the <strong>META-INF</strong> folder of an EJB project. |
| A J2EE application contains one application-level deployment descriptor file, |
| governing the application as a whole. It also contains several component-level |
| deployment descriptors, one for each module in the application.</p> |
| </dd> |
| |
| </dl> |
| |
| </div> |
| |
| <div> |
| <ul class="ullinks"> |
| <li class="ulchildlink"><strong><a href="../topics/tecrtpro.html">Creating EJB projects</a></strong><br /> |
| An EJB project is used to organize the resources contained in an EJB module.</li> |
| <li class="ulchildlink"><strong><a href="../topics/ceclientjars.html">EJB 2.x client JAR projects</a></strong><br /> |
| An EJB client JAR project contains all the class files that a client program needs to use the client view of the enterprise beans that are contained in the EJB module.</li> |
| <li class="ulchildlink"><strong><a href="../topics/teimp.html">Importing EJB 2.x JAR files</a></strong><br /> |
| You can import beans and other metadata from an EJB JAR file into a new or existing EJB project.</li> |
| <li class="ulchildlink"><strong><a href="../topics/teexp.html">Exporting EJB 2.x projects to EJB JAR files</a></strong><br /> |
| After you have tested your enterprise beans, you can export the module into an EJB JAR file.</li> |
| </ul> |
| |
| <div class="familylinks"> |
| <div class="parentlink"><strong>Parent topic:</strong> <a href="../topics/ceover.html" title="The workbench provides a specialized environment that you can use to develop and test enterprise beans that conform to the distributed component architecture defined in the Sun Microsystems Enterprise JavaBeans (EJB) version specification. This product supports the Enterprise JavaBeans 1.1, 2.0, 2.1, and 3.0 specification levels.">EJB 2.x application development</a></div> |
| </div> |
| </div> |
| |
| </body> |
| </html> |