Click here to Skip to main content
15,891,745 members
Articles / Programming Languages / C++
Article

Websphere Application Server 6.1 .J2EE Client PART I

Rate me:
Please Sign up or sign in to vote.
3.40/5 (4 votes)
31 Jan 20075 min read 78.8K   17   5
How to setup Java IDE for J2EE to Develop / Deploy / Run a Complete J2EE solution on Windows XP Client For Web Sphere Application Server 6.1
Sample Image - maximum width is 600 pixels

Introduction

In this Two part of the article i shall explain how to build a simple J2EE Console Client to run on Windows XP platform using Java 1.5 SDK to talk to J2EE (EJB Component) on Websphere Application Server Version 6.1. Eclipse 3.2.1 as well as XDoclet 1.2.3.

The Article assumes Websphere 6.1 has been installed on a Windows 2003 platform. Though other OSs should not make any difference.

The article will follow a simple approach to write a Stateless Session bean and a Console based J2EE client with minimum amount of code required then deploy the EJB Component to Websphere as well as the Client package Both manually, I shall focus mainly on how to setup an Ideal Development Environment for the pieces of software technologies above to work together in Harmony without any automated tools for deployment or packaging.

In Part I i shall explain how to setup the Java development Environment as well as generate the J2EE Classes using Eclipse XDocLet Support. Then In Part II of the Article i shall explain the Packaging, Deployment and running of the solution on Websphere Server and Client.

Note: Installing and Administering IBM Web Sphere 6.1 as well as how J2EE is programmed or does work is out of the scope of this article.

Background (optional)

I didn't expect to to write a Java Article here at the time at all, Having stopped writing Java code for the Past 3 Years! and spending almost all the past 3 Years writing .NET Code ..However, I came across an exceptional Task at my work place to have a Batch Scheduling Product communicating with an EJB that is hosted within the latest version of IBM Web Sphere Application Server Version 6.1.

To complete this -Daunting- task i needed to go through a complete Development Life-cycle for a simple Windows console based Client for J2EE on Websphere. Before i start i wishfully thought that the Java communities by now would have established enough programming resources repository and Web Forums that would make my life so perfect. To my amazement and disappointment i could NOT put my hand on a single source of information that describes how to compose a J2EE development Environment for Websphere 6.1 using the latest Eclipse / XDoclet IDE technology!

Hence, i shall put here my experience achieving the above. Hopefully, it might help others.

Setting Up the Development Environment.

First The list of pre-requisites :-

Second. Start by installing Java JDK Version 5.0 above on the Client Machine. Then XCOPY the Application Client for web sphere application server 6.1 under any folder on the client machine.(For Example: c:\Websphere6.1Client)

Now. It is time to install the Eclipse WTP. Extra t / Unzip the complete file/folder list to any folder on the Client Machine (For Example: c:\eclipse). And for the XDoclet Extract / Unzip the complete file/folder to any directory on the Client machine (For Example: c:\XDocLet)

Finally start Eclipse and apply the following Configuration Changes:

  • Change the Eclipse Project Perspective : Window/Open Perspective/other/J2EE
  • Image 2
  • Point Eclipse to the current JDK. Window/preferences/Installed JREs/Add your JDK path for example c:\program files\java\jdk1.5.0_10
  • Image 3
  • Point Eclipse to the Run-time of the Web Sphere Application Server 6.1. Window/preferences/Server/Installed Runtimes where the physical folder on the Websphere Application Server 6.1 C:\Program Files\IBM\WebSphere\AppServer\lib is mapped to a Network share for the WebSphere Folder such as \\your machine\WebSphere_6.1\AppServer\lib
  • Image 4
  • Point eclipse to the XDoclet library. Window/preferences/XDocLet
  • Image 5
  • The Set the Tree Node ejbdoclet under the path above to the values:
  • Image 6
  • Finally, set the Tree Node webdoclet to the values:
  • Image 7

Creating the Session Bean

We need first to tell Eclipse to Create a J2EE Project Skeleton for us, then we use XDoclet to Fill that Skeleton with the java Bean componenents' classes.

From the Eclipse menu File/New/Project...

Image 8

Then From the Eclipse menu start the XDocLet Java bean Wizard File/New/Other choose from the List Folder EJB/XDocLet Enterprise JavaBean.

Image 9
Choose Session Bean
Image 10

Then Fill the Class Information below after selecting the Project we created above from the List in the Project Drop Down List. (Remember to choose lower case simple names for the package and Indented informative Names for the classes)
Image 11

Complete the Wizard above with your own values for the generated J2EE classes and the Client.

Points of Interest

Now, before concluding this Part (Part I) of the article let us have a look at the generated code at this stage:

If we have a quick look at the Project explorer (right top pane) we can identify the following items (Assuming my own Project name Prefix ControlM)

Image 12

  • The J2EE Project which mainly contain the The EAR XML Project file with all Modules listed.
  • The J2EE Client Project which contain the Main.java console application Under the appClietntModule Folder in the tree. this will be our J2EE Client. along with the tree nodes for the
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub

}

/* (non-Java-doc)
* @see java.lang.Object#Object()
*/
public Main() {
super();
}

The discussion of the Implementation of the Client is left to the next part of this Article.

  • The J2EE Classes under the Project EJB Tree Node and under the EJB Module tree node.
    • The Java Package tree node.
    • The Bean Class where the J2EE Create Method(s) and Business methods are implanted.
    • The Remote Interface for the EJB.
    • The Home Interface for the EJB.
    • The Local and LocalHome. (Not used in the Console based Client J2EE solution)
    • The Session Been Class where container actions during EJB Instance life cycle can be triggered and implemented here.
    • The utility Java Class for the EJB solution that has standard generated code for JNDI lookup.(No implementation required here)

We will have a close look at some the classes above when we implement our simple J2EE Component and Client in the next and final part of this article.

History

N/A.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Systems Engineer
Australia Australia
I have been working in IT with different titles and role specs for the last 11 years!
currently I am a Senior Software Engineer at a large banking corporation in syndey-Australia. Working mainly with Microsoft technologies especially .NET anything.
When I am not at work, I like reading or hanging out with friends, and if not I should be driving somewhere in Sydney streets late at night Wink | ;-)

Comments and Discussions

 
QuestionPART II? Pin
mtresse19-Jun-07 21:58
mtresse19-Jun-07 21:58 
AnswerRe: PART II? Pin
Ayman Amin Ibrahim19-Jun-07 22:15
Ayman Amin Ibrahim19-Jun-07 22:15 
Suggestionsimple Pin
biz19508-Aug-12 22:56
biz19508-Aug-12 22:56 
Generaleclipse Pin
Phil_Nebula13-Feb-07 23:41
Phil_Nebula13-Feb-07 23:41 
GeneralRe: eclipse Pin
Ayman Amin Ibrahim19-Jun-07 22:17
Ayman Amin Ibrahim19-Jun-07 22:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.