J2EE programming (2)

Source: Internet
Author: User

Create a J2EE Application
You cannot directly deploy enterprise components (ejbs) to a J2EE server. You must add the components to a J2EE application before deploying them. In this section, you will create a new J2EE application called ConverterApp and save it as ConverterApp. ear.
1. Start the J2EE server at the command line prompt:
J2ee? Verbose
(Stop the server command j2ee-stop .)
2. Run the deployment tool in another terminal window:
Deploytool
(Obtain deployment tool help by pressing F1)
3. Create a New J2EE Application
A. Select the "file" menu in the Deployment Tool
B. Select "New Application" from the "file" menu"
C. Click to browse
D. Locate the directory where the. ear file is stored in the file selection box.
E. Name the file ConverterApp. ear.
F. Click "new application"
G. Click "OK"
Enterprise component (EJB) Packaging
In this section, you will run the create EJB wizard of the Deployment Tool to complete the following tasks:
· Create a component deployment descriptor
· Package descriptors and component classes as. jar files
· Package the EJB. jar file to the ConverterApp. ear file of the J2EE Application
Select create EJB from the "file" menu to start creating a new EJB. The wizard displays the following dialog box:
Introduction dialog box:
A. Read the wizard features
B. Click "Next"
Ejb jar dialog box:
A. Select ConverterApp in THE combox marked with "Enterprise Bean will go in.
B. Enter ConverterJAR in the JAR Display Name field and declare that the EJB. jar file contains the component. The Name is displayed in the tree structure.
C. Click Add content text field
D. At the top of the content editing dialog box, enter the directory containing the. class file.
E. Select related. class under this directory to add: Converter. class, ConverterEJB. class, and ConverterHome. class.
F. Click OK.
G. click Next.
Comprehensive dialog box:
A. Select "session" in the component type"
B. Select "stateless"
B. Select ConverterEJB In the EJB combo box.
C. Select ConverterHome in the Local interface combo box.
D. Select Converter in the remote interface combo box.
E. Enter ConverterBean in the enterprise component naming field.
F. click Next.
Environment portal dialog box:
Because you can skip the subsequent dialog box, you can click Finish to finish creating an EJB application task.
Deploy J2EE applications
Now the J2EE application contains the enterprise component (EJB), which can be deployed.
1. Specify the JNDI name of the enterprise component
A. in the Application Deployment Tool, select ConverterApp in the application tree structure
B. Select the JNDI name label.
C. In the JNDI Name field, enter MyConverter and confirm.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.