Tutorial for building J2EE Applications using JBOSS and ECLIPSE

AI权益加码!Claude Code、Cursor等20+工具免费用! 购周边限时加赠Coding Plan Lite,畅享主流AI工具!学习进阶更高效! 阅读详情

Table of Contents

Tutorial.

Preface

About the Authors

Acknowledgments

Disclaimer

Introduction

Prerequisites for this tutorial

Tools required for this tutorial

Case Study Overview


Chapter 1.

Configuration of ECLIPSE using JBOSS and LOMBOZ

Install Eclipse

Install JBOSS

Creating Database Schema

Install Lomboz

Lomboz Configuration

Configure JBOSS to run from within Eclipse

Test your configuration


Chapter 2.

Overview Of J2EE Technology and Concepts

J2EE Components

J2EE Clients

Web Components

Business Components

Enterprise Information System Tier

J2EE Containers


Packaging

J2EE Platform Roles

Distributed Architecture in J2EE

Java Naming Directory Interface (JNDI) Architecture


Chapter 3.

Creating a Stateless Session Bean

Tasks

Create J2EE Project

Create StoreAccess Stateless Bean

Setup DAO

Create StoreAccess's DAO Interface

Add Business Method

Implement DAO Interface

Add Callback Method

Deploy StoreAccess Bean

Create your Test Client

Test your Client


Chapter 4.

Creating a Stateful Session Bean

Tasks

Create StoreAccessState Stateful Bean

Create StoreAccessSate's DAO Interface

Add Business Method

Add Callback Method


Implement DAO Interface

Deploy StoreAccessState Bean

Create your Test Client

Test your Client


Chapter 5.

Creating a BMP Entity Bean

Tasks

Create Customer BMP Entity Bean

Create Customer's DAO Interface

Add Finder Methods

Add Business Methods

Implement Customer's DAO Interface :

Deploy Customer Bean

Add Create Method in StoreAccess

Add Business Method in StoreAccess

Create your Test Client


Test your Client

Exercise


Chapter 6.

Creating a CMP Entity Bean

Tasks

Create Item CMP Entity Bean

Implement ejbCreate Method

Add Finder Methods

Add Business Methods

Add Callback Methods

Deploy Item Bean

Add Business Method in StoreAccess


Create your Test Client

Test your Client

Exercise


Chapter 7.

Creating a Message Driven Bean

Tasks

Create RequestItems MDB Bean

Create Immutable Value Object RequestItem

Implement onMessage Method

Deploy RequestItems Bean

Create Test Client


Test your Client

Exercise


Chapter 8.

Creating Web Clients

Create AccessController Servlet

Implement init method

Implement methods doGet and doPost

Deploy AccessController Servlet

Test your Servlet

Create JSP Page

Add Html and JSP Tags

Deploy Module OnlineStore

Test your JSP Page


Chapter 9.

Creating Web Services

Web Services Standards

Web Services In Java

Installing AXIS

Configuring AXIS with JBOSS

Create the Web Service

Deploy the Web Service

Create Web Service Test Client

Test your Client

Create and Test Web Client

Create and Test VB.Net Client

Create and Test Perl Client


Feedback

Feedback






Preface.

This tutorial is about building Java 2 Platform, Enterprise Edition (J2EE) components using Eclipse as an Integrated Development Environment (IDE) and JBOSS as the Application Server. Tutorial covers step-by-step development of J2EE components, starting from setting up Eclipse, JBOSS and Lomboz. Lomboz uses Xdoclet (Attribute Oriented Programming) for rapid development of J2EE components. Importantly, all of the tools used in this tutorial can be downloaded free of charge, so there should be nothing stopping you!

Eclipse provides an excellent IDE, with features like refactoring and debugging. JBOSS is integrated within Eclipse using JBOSS plug-in. Lomboz is another plug-in used for building J2EE components, which provides wizards for bean creation, method creation, deployment of bean, test client creation etc. JBOSS is an integrated application server with convenient built-in components such as the Hypersonic Database and Jetty as the Web Engine. This bundling of all the key components of a J2EE environment assists beginners in learning how to develop J2EE applications. Having gained some skills and confidence, beginners can move on to tools provided by other vendors.

One of the problems J2EE developers face is that of synchronizing their code with J2EE's deployment descriptors. As development of components progresses, developers have to keep updating deployment descriptors, a generally tedious activity which can lead to other mistakes, instead of this devoting time to the business logic of the application. Xdoclet generates these interfaces and helper classes along with deployment descriptors, by parsing source files. These files are generated from templates that use the information provided in the source code and its JavaDoc tags. XDoclet allows developers to concentrate on only one Java source file per component, that is, concentrate on the business logic of the application, and the rest is done by Xdoclet.

For so many years developers have been looking for some sort of a tool which speeds up this process of development and deployment, and Xdoclet is certainly a step in that direction. Hopefully you'll find that Xdoclet makes development and deployment rapid and easy. So explore the power of Xdoclet, Eclipse and JBOSS!



About the Authors.

Glen McCallum.

Glen joined TUSC in 1990. He has extensive experience in software development for the telecommunications industry, including C, C++, Perl and Java. Outside of TUSC, Glen continues to fiddle with such technologies as he thinks are “cool”. This includes TCP/IP networking, security, cryptography, VPNs, digital video capture, Bluetooth, PDAs and J2EE, all on Linux. His wife and two young sons complete a “pure Linux” household.

Vishal Sharma.

Vishal was born in 1976 in India. He studied mechanical engineering, graduating in 1998. After working in that field for 6 months, he came to Australia and obtained a Master's degree in Computer Science. Since graduating from RMIT Melbourne in 2001 he first worked as a software engineer in Mcom Solutions developing communication protocols. Vishal joined TUSC in 2002 and has enjoyed a varied diet of different projects since then. Most recently he has been involved in building multi-tiered Web applications for the telecommunications industry, with a particular focus on J2EE technology.



Acknowledgments.

We'd like to thank some particular TUSC people: Rod Bower, Telecommunications Business Unit Manager, Sebastian Bellofiore, Delivery Manager and Marcia Abbott, Business Improvement Manager for their support and help in this initiative, and of course our colleagues for their collaboration; Simon Shields, Andrew Hendry and Ray Walford.

Vishal wishes to thank Glen McCallum for his guidance, inspiration and invaluable support in bringing this to you all.



Disclaimer.

TUSC MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MATERIAL INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OR SUITABILITY FOR A PARTICULAR PURPOSE.

TUSC shall not be liable for errors contained herein or for incidental consequential damages in connection with the supply of, performance of, or use of this material.

This document contains proprietary information which is protected by copyright.

All rights are reserved. No parts of this document may be photocopied, reproduced or translated to another language without the prior written permission of TUSC.

© Copyright 2003 TUSC Computer Systems Pty. Ltd.



Introduction.

Prerequisites for this tutorial.

Before you start this tutorial, you should ideally have a working knowledge of Java technology, XML, J2EE technology and some exposure to SQL, JDBC concepts, and Xdoclet (Attribute Oriented Programming). Even if you are new to a lot of this then don't panic – just expect to do a bit more learning along the way!

All the examples covered in this tutorial were developed on RedHat Linux 8.0, Sun Microsystem's JDK (j2sdk1.4.1_02), using Eclipse 2.1 as the IDE, and Lomboz 2.1_02 plugin for Eclipse. JBOSS-3.2.1 is being used as an application server to deploy applications. Jetty is used as the web server and Hypersonic SQL as the database, both of which are integrated in the JBOSS application server.

Tools required for this tutorial.

You will need a current version of Java Development Kit (JDK) or Java Runtime Environment (JRE) - at least JDK 1.3 onwards. Eclipse 2.1 is required as an Integrated Development Environment (IDE) along with the Eclipse plug-in Lomboz 2.1_02 for J2EE applications development and JBOSS integration.

JBOSS-3.2.1 is being used as an application server to deploy applications, together with its embedded Jetty web server and Hypersonic SQL database as noted above.

Case Study Overview.

For this tutorial we are using a case study similar to Inventory, rather than using any complex scenario or going into strict database design, as our aim is to learn how to design and develop various J2EE components using this new revolutionary approach of Attribute Oriented Programming with the help of these tools.

We have a database schema called 'MyStore' which is composed of five tables.

Table Supplier records details of those suppliers (many) who sell different materials to MyStore as request is sent to these suppliers from MyStore manager as need arises.

Table Manager records details of managers who run MyStore, currently there is only one manager.

Table Customer records details of those customers (many) who have bought some items at least once.

Table Items maintains an inventory of available/non-available items (many).

Table StoreAccess records the authentication details of all customers, suppliers and manager for on-line access of MyStore.

The MyStore Database is shown in the figure below.




 

To access data from the database and do business operations, we will create various J2EE components including Session, Entity and Message-driven Enterprise Java Bean components along with Web clients using Servlets and JSP pages.

Figure below presents an overview of the MyStore application's architecture.




 

Note : In the case of Web clients, a request is sent by Servlets/JSP (Java Server Pages) to beans using RMI (Remote Method Invocation). Stateless, Stateful and Bean Managed Persistence (BMP) Entity Beans access data from the database using Data Access Objects (DAO), which are wrappers for Java Database Connectivity (JDBC) code, while Container Managed Persistence (CMP) Entity Beans don't require a DAO, as the container manages communication between the Beans and the database, which is a very powerful feature. Finally, in the case of Java clients requests are made via Java middleware technology (RMI, CORBA, Java Messaging) to Entity Beans.

All beans together with their public behaviors/methods which will be implemented during the course of this tutorial are shown below. StoreAccessBean is a Session facade bean, which exposes its interface to the Presentation Tier, while encapsulating the complex business interactions with Customer, Manager, Item and Suppler Entity beans.


MyStore customers, suppliers and manager login into the system using the StoreAccess stateless session bean. Once authenticated, they request information about MyStore's inventory, manager details, customer details and supplier details using the various interfaces available in the StoreAccess bean, which invokes methods on the remaining beans, from where the information is requested. RequestItems and DeliverItems are Message Driven Beans which listen for messages from a JMS producer and transfer messages to appropriate beans.

Now lets start this tutorial, with setting up the environment in chapter 1.

Tutorial for building J2EE Applications using JBOSS and ECLIPSE -2 Chapter 2. Overview Of J2EE Technology and ConceptsThe Java 2 Enterprise Edition (J2EE) is a multitiered architecture for implementing enterprise-class applications and web based applications. T 阅读详情

相关推荐

Tutorial for building J2EE Applications using JBOSS and ECLIPSE Chapter 3

在阅读这一章的时候,基本没有什么障碍,但是有一个地方文章是写错了。 在Create DAO Interface  那一节中“Go to src > add package named au.com.tusc.dao > Add a class StoreAcessDAOImpl in that package”红色字体错了,应该是StoreAccessDAOImpl。 还有就是因为使用不同版本的j

中国 IT 应用/ Adapting information technology in china 1200

Tutorial for building J2EE Applications using JBOSS and ECLIPSE -7

Chapter 7. Creating a Message Driven BeanThis chapter covers how to create a Message Driven Bean (MDB) EJB component. We will create two MDB beans, DeliverItems and RequestItems as shown below.

阿龙专栏 1495

Tutorial for building J2EE Applications using JBOSS and ECLIPSE -5

Chapter 5. Creating a BMP Entity BeanThis chapter describes how to create a Bean Managed Persistence (BMP) EJB component. We will create two BMP beans, Customer and Manager, as shown below. The

阿龙专栏 1729

Tutorial for building J2EE Applications using JBOSS and ECLIPSE -1

Chapter 1Configuration of ECLIPSE to use JBOSS and LOMBOZInstall Eclipse. First of all we have to set up Eclipse Integrated Development Environment (IDE) with JBOSS as our application server.

阿龙专栏 1942

Tutorial for building J2EE Applications using JBOSS and ECLIPSE Chapter 1

现在才补回chapter的阅读经历是因为觉得有一个地方的确要提一下。 在安装配置的时候,资料上说明是使用jboss-3.2.1和lomboz.21_02,我决定使用jboss 3.2.5和lomboz 213。虽然对jboss新增的版本特性不清楚,但是我想既然能升级,已经是解决了已经遗留的问题。但是我在配置的时候却给我增添了麻烦。lobmboz 213并没有对jboss 3.2.5有相应的配置文件

中国 IT 应用/ Adapting information technology in china 1263

Tutorial for building J2EE Applications using JBOSS and ECLIPSE(1)

Chapter 1Configuration of ECLIPSE to use JBOSS and LOMBOZInstall Eclipse. First of all we have to set up Eclipse Integrated Development Environment (IDE) with JBOSS as our application server.So go to

Zero'Coffee 1362

Tutorial for building J2EE Applications using JBOSS and ECLIPSE(3)

Chapter 3. Creating a Stateless Session BeanThis chapter covers how to create a stateless session EJB component. This bean will be responsible for authenticating the user by communicating with the dat

Zero'Coffee 1135

Tutorial for building J2EE Applications using JBOSS and ECLIPSE -3

Chapter 3. Creating a Stateless Session BeanThis chapter covers how to create a stateless session EJB component. This bean will be responsible for authenticating the user by communicating with t

阿龙专栏 1614

Tutorial for building J2EE Applications using JBOSS and ECLIPSE Chapter 2 part 2

J2EE中的分布式应用(Distributed Architecture in J2EE ) 刚好在huihoo论坛看了一篇文章说到如何提高jboss的RMI/IIOP的效率问题,“有个应用是客户端swing+j2ee SERVER ,跑在内网没问题的。现在有个客户,很多分支机构,都是通过adsl(2m带宽)连到总部。j2ee服务器放在总部,感觉特别慢”,这个问题我现在还找不到解决的方法。刚好又看

中国 IT 应用/ Adapting information technology in china 1925

Tutorial for building J2EE Applications using JBOSS and ECLIPSE -4

Chapter 4. Creating a Stateful Session BeanThis chapter covers how to create a stateful session EJB component. Unlike stateless beans, stateful bean instances are associated with a particular cl

阿龙专栏 1432

Tutorial for building J2EE Applications using JBOSS and ECLIPSE(4)

Chapter 4. Creating a Stateful Session BeanThis chapter covers how to create a stateful session EJB component. Unlike stateless beans, stateful bean instances are associated with a particular client s

Zero'Coffee 1142

Tutorial for building J2EE Applications using JBOSS and ECLIPSE-6

Chapter 6. Creating a CMP Entity BeanThis chapter covers how to create a Container Managed Persistence (CMP) EJB component. We will create two CMP beans, Item and Supplier as shown below. The It

阿龙专栏 1566

Tutorial for building J2EE Applications using JBOSS and ECLIPSE(2)

Chapter 2. Overview Of J2EE Technology and ConceptsThe Java 2 Enterprise Edition (J2EE) is a multitiered architecture for implementing enterprise-class applications and web based applications. This te

Zero'Coffee 1112

Tutorial for building J2EE Applications using JBOSS and ECLIPSE Chapter 2 part 1

All J2EE components are written in the Java programming language 这句话开宗明义的说明了J2EE只能用java来开发,我听说有一些开源爱好者已经可以做到用.net来做,然后通过一些转换器来工作,我也不是很了解这个东西。不过就我而言,要开发.net的就用微软的东西,不要想太多,毕竟那个才是专业的。开发j2ee还是用java算了。 T

中国 IT 应用/ Adapting information technology in china 1396

Tutorial for building J2EE Applications using JBOSS and ECLIPSE-9

Chapter 9 . Creating Web Services :Web services promises to be the next generation of software development. In essence, a web service is a means of interfacing to web or enterprise application

阿龙专栏 2232
上一篇: Eclipse实践(3)
下一篇: Tutorial for building J2EE Applications using JBOSS and ECLIPSE -1
jhlcss
博客等级 码龄25年 1粉丝 23原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值