Netbeans: NbJBoss Module (ver 2.3.6)
User View
Version : 0.3
Author : Sip Technologies
Abstract:
This document describes how the user needs to work
with the Netbeans / JBoss integration module.
The module is expected to add support for developing J2EE applications
using the IDE.
Document History:
[09/17/2001] : version 0.1 : first version of the
document.
[07/20/2003] : version 0.2 : second version of the document.
[05/14/2004] : version 0.3 : third version of the document.
Contents:
- Introduction
- System Requirements
- Installation And
Configuration
- Presentation in
Explorer
- Features
- Known Issues
1. Introduction
NbJBoss is a plugin for the NetBeans(TM) IDE that
provides a set of tools that makes J2EE application development for
JBoss(TM) Application Server as convenient as can be. JBoss provides a
set of cool, easy-to-use tools to develop and deploy J2EE applications
on JBoss. It integrates the JBoss Application Server directly into the
popular NetBeans IDE - extending the functionalities of the IDE to
include development, deployment and management tools for JBoss.
2. System Requirements
The basic system requirements of NetBeans 3.6 apply
here.
3. Installation
And Configuration
This module is distributed as an nbm (NetBeans
module). To install the downloaded NBM file. please follow the following
steps.
- From the NetBeans IDE, use the menu and select 'Tools' / 'Update
Center' option to invoke the 'Update Center Wizard'.(fig-1.1)
- In the 'Update Center Wizard' Choose 'Install manually downloaded
modules' option and press 'Next' button. (fig-1.2)
- Now add the nbJBoss.nbm file which you have downloaded using the
'ADD' button and press the button 'Next'.(fig-1.3).
- Now in the "Select modules to install" page select 'NbJBoss' from
the "Include to Install" list and click on 'Next' (fig-1.4).
- The "SIPTech License Agreement" should pop-up, read the agreement
carefully and if you agree to the agreement click on 'Accept'. (fig-1.5).
- In the 'Download Modules' page the NetBeans should load NbJBoss
2.3.6,Once loading is complete and 'Next' button is enabled. Now click
on the button 'Next'.(fig-1.6)
- In the "View Certificates and Install Modules" page select the
NbJBoss - 2.3.6 (Not Signed) option. Since its not signed, you may get a
warning dialog, Click on the botton 'Yes'. Then click on finish(fig-1.7).
- You have to restart the IDE to register the NbJBoss module.You
would get a pop-up window with the Option to Restart now / later.(fig-1.8).
- Linux Red Hat 9 Users should edit the user's /etc/hosts file,
supplying your IP address and m/c name. (Sample hosts.dat file).
4. Presentation in
the Explorer
Upon installation of this module,
All the J2EE Application EAR files, Web
Application WAR files and EJB Jars that are mounted on the IDEs
"Filesystem" view get listed with new icons. (fig-2.1)
In the "Runtime" view a new node "JBoss Server
Registry" is added with it's unique icon. JBoss server instances, which
are running in the local system or remote system can be added as child
of this node.(fig-2.2)
5. Features
5.1 EJB Template Wizard
EJB Template is where you can generate the EJBs of
different specifications 1.1 & 2.0. You can specify the 'FileSystem
Name', 'Package Name', required 'Class Name'. Based up on the
information gathered from the user new EJB files are created. Now using
the source editor you can modify the given basic template and save
it.Here below are some examples of creating EJBs using NbJBoss's EJB
Template wizard.
Steps to create a Session Bean (EJB 1.1).
- Select menu option 'File' | 'New EJB Template'.(fig-3.1)
- The 'EJB Template' wizard pops-up displaying the 'Entry Panel'
provide the 'FileSystem', 'Package Name' and 'EJB Name' Click on the
button 'Next'.(fig-3.2).
- The 'EJB Types' panel is displayed here you can select the EJB
Specification 1.1 / 2.0, select 'EJB 1.1' using the 'Specify the EJB
Spec' combo-box.
- Using the 'Specify Bean Type' combobox select the "Stateless
Session" option.
- Now click on button 'Finish' to generate Bean, Home Interface and
Remote Interface source.(
fig-3.3)
- Refresh the "FileSystem" using the pop-up menu option 'Refresh'
and expand the generated files would be listed. (fig-3.4).
Steps to create a CMP(EJB 1.1 Top-Down)
- Select menu option 'File' | 'New EJB Template'.(fig-3.5)
- The 'EJB Template' wizard pops-up displaying the 'Entry Panel'
provide the 'FileSystem', 'Package Name' and 'EJB Name' Click on the
button 'Next'.( fig-3.6
).
- The 'EJB Types' panel pops-up, make sure that the following
values are selected for the properties, then click on the button 'Next'.
(fig-3.7)
- Select EJB Spec - EJB 1.1
- Select Bean Type - Entity
- Persistance Type - CMP
- Properties / Field Mapping - Top-Down.
- The 'Top-Down mapping' panel pops-up.Click on the Button 'Add' to
set CMP fields, its data type & make sure that atleast one of the
fields is marked as 'primary',then click on the button 'Next'.(fig-3.8).
- The 'Finder Methods' panel pops-up, here you may specify the
Finder method signatures for which the stubs will be created, else you
may click on 'Finish'.(fig-3.9)
- Refresh the "FileSystem" using the pop-up menu option 'Refresh'
and expand the generated files would be listed.(fig-3.10).
Steps to create a CMP (EJB 2.0 Bottom-Top)
- Select menu option 'File' | 'New EJB Template'.(fig-3.11)
- The 'EJB Template' wizard pops-up displaying the 'Entry Panel'
provide the 'FileSystem', 'Package Name' and 'EJB Name' Click on the
button 'Next'.(fig-3.12).
- The 'EJB Types' panel pops-up, make sure that the following
values are selected for the properties, then click on the button 'Next'.
(fig-3.13)
- Select EJB Spec - EJB 2.0
- Select Bean Type - Entity
- Persistance Type - CMP
- Properties / Field Mapping - Bottom-Top.
- In the "Database Connection Panel" enter valid information for
Driver,URL, UserName and Password, then click on "Connect to Database",
If the connection is successful you will get a "Connectin Successful"
message.(fig-3.14).
- Now click on button 'Next' to move to "Table Selection" panel,
here select the Database Table for which you would like to create EJB,
then click on 'View'.
- The "view" lists the available fields in the Table. At least one
of the fields should be marked "Primary", now click on 'Next' button .(fig-3.15).
- In the "Finder Methods" panel you may specify the Finder method
signatures for which the stubs will be created, else you may click on
'Finish'.(fig-3.16).
- Refresh the "FileSystem" using the pop-up menu option 'Refresh'
and expand the generated files would be listed.(fig-3.17).
5.2 Compilation.
This feature can be used to compile
EJB(Session/Entity) files.
Steps to Compile an EJB file.
- Make sure that EJB source files (HomeInterFace, RemoteInterface,
Bean in case of EJB 2.0, you may also have the LocalHome and
LocalRemote) are available under proper package structure, in the
'FileSystem' of NetBeans IDE.(fig-4.1)
- Select menu option 'File' | 'Mount File System'.(fig-4.2)
- The 'New Wizard' pops-up displaying the 'Select Filesystem Type'
Select Archive Files from the File system and Click on the button
'Next'.( fig-4.3 ).
- The 'New Wizard' displaying the 'Select Archives', Select
jboss-j2ee.jar File from the JBoss3.2.1/client Folder and Click on the
button 'Finish'.( fig-4.4
).
- Either use the Pop-up menu option 'Compile' / use the menu option
'Build'/ 'Compile' (fig-4.5)
5.3 Packager.
This feature can be used to package a EJB JAR, Web
Application WAR or Enterprise Application EAR files.
Steps to Package an EJB JAR file.
- Make sure that EJB source files (HomeInterFace, RemoteInterface,
Bean in case of EJB 2.0, you may also have the LocalHome and
LocalRemote) are availabe under proper package structure, in the
'FileSystem' of NetBeans IDE.(fig-5.1)
- Compile these files.
- To invoke the Jar packager select the menu option 'Files' /
'Package EnterpriseBean'.
- Specify the 'Jar Display Name', 'Jar Description', 'Target
Location' and the JAR file name with extension (eg jarfilename.jar).
Then click on the button 'Next'(fig-5.2).
- In the 'EJB Properties panel', you may provide the BeanName, Bean
Type, Bean Class Files as contents, Specify the Home Interface, Bean,
Remote Interface, (Local Home and Local Remote as well in case of EJB
2.0)., JNDI Name, Local JNDI Name (EJB 2.0 only) and EJB Description.
Then click on the button 'Next' (fig-5.3).
- In the 'EJB Common Properties' panel you may specify the Roles,
JAAS & Container Configuration settings. Click 'Next' to navigate to
'Configure EJBs' panel.(fig-5.4).
- Here you may configure the EJB Properties, Click 'Next' navigate
to 'XML View' panel . (fig-5.5).
- Here you can view the generated xml file. Click on 'Finish' to
generate the JAR file.(fig-5.6).
- Refresh the filesystem to view the generated EJB JAR file (fig-5.7).
5.4 Verifier
This feature can be used to verify of a EJB-JAR or
Enterprise Application-EAR is valid.
Steps to verify a JAR file.
- Load the file system containg the jar/ ear files.
- Select one of the files, use the pop-up menu option 'Verify' or
use Tools / Verify menu option.(fig-6.1)
- A message winwod will indicate if the file is verified
Successfully / not.(fig-6.2)
5.5 Configuration
Editor (JBoss)
This can be used to edit the JBoss App Server
configuration files.
Steps to invoke Configuration Editor.
- Use the menu option 'Tools'/ 'Configuration Editor' (fig-7.1)
- In the 'Configuration Editor panel' use the browse option and
select the folder containing JBoss configuration files.(fig-7.2)
- Select the file from the 'File List', to open the configuration
file. (fig-7.3)
- You may edit the file then Save it
5.6 JBoss Server Registry.
Using this feature you may connect to a JBoss Server
Instance running on local system or on a remote system.
Steps to Add An Instance of JBoss Server.
- In the "Runtime" view of the NetBeans IDE select the "JBoss
Server Registry" node, Use the pop-menu option "Add JBoss Server"/ use
the Menu option File/ Add JBoss Server.(fig-8.1).
- In the "Add JBoss Server" window enter a 'Name' (user defined)
for the server, 'Address' of the System on which the JBoss Server is
running, if localsystem enter 'localhost / 127.0.0.1', and the Port
number (by default JBoss server 3.2.1 runns on port on 1099). Then click
on the button 'OK'.(fig-8.2)
- An information window will indicate if the connection is
successful.(fig-8.3)
- If successful, the JBoss Server instance will be listed in the
"JBoss Server Registry" (fig-8.4)
Steps to remove the JBoss Server Instance.
- Select the Server instance under the 'JBoss Server Registry' node
found in the 'Runtime' view of IDE.
- Use the POP-up menu option "Remove JBoss Server".(fig-8.5)
- A confirmation dialog will confirm the removal (fig-8.6)
- An information window will indicate if the removal was
successful.(fig-8.7).
5.7 Deployer
This feature can be used to Deploy / Undeploy a JAR /
WAR / EAR file to a JBoss Server Instance.
Steps to Deploy a JAR file.
- An Instance of JBoss should be registed successfully in the JBoss
Server Registry.
- Select the JAR file from the "FileSystem" view.
- Either use the Pop-up menu option 'Deploy' / use the menu option
'Tools' / 'Deploy' (fig-9.1)
- The 'Deploy to Server' will pop-up listing the registered server.
- Select the server to which you would like to deploy the JAR file
and click on 'OK'.(fig-9.2)
- An information window will indicate if the deployment was
successful.(fig-9.3).
Steps to UnDeploy a JAR file.
- Select the 'JAR' file from the 'FileSystem' which was deployed to
JBoss Server.
- Use the Pop-up menu option 'Undeploy' / menu option 'Tools' /
'Undeploy'.(fig-9.4)
- 'Remove from Server' window pop-up, select the server from which
to undeploy the JAR file, then click on 'OK' button. (fig-9.5)
- After successful undeployment an Information dialog confirms the
same. (fig-9.6)
5.8 JBoss Console
This feature is used to invoke the JBoss Console, of
the registered JBoss server instances.
Steps to invoke JBoss Console.
- Select the JBoss Server Instance under the 'JBoss Server
Registry' in the 'Runtime' view of the IDE.
- Use the pop-up menu option 'JBoss Console' or use menu option
'Tools' / 'JBoss Console'. (fig-10.1)
- A browser window opens if not already open, and the JBoss console
page is displayed (May have to wait if you are invoking the JBoss
Console for the first time). (fig-10.2)
5.9 JNDI Browser.
This feature is used to invoke the JBoss JNDI browser,
of the registered JBoss server instances.
Steps to invoke JNDI Browser.
- Select the JBoss Server Instance under the 'JBoss Server
Registry' in the 'Runtime' view of the IDE.
- Use the pop-up menu option 'JNDI Browser' or use menu option
'Tools' / 'JNDI Browser'. (fig-11.1).
- A browser window opens if not already open, and the JNDI Browser
page is displayed (May have to wait if you are invoking the JNDI Browser
for the first time). (fig-11.2)
5.10 JBoss Debugger
Use this feature to debug the applications running on
the JBoss server.
Steps to debug an EJB deployed on JBoss Server.
- Start the JBoss server in the debug mode.
- Load the file system containing the EJB source files, and
deployable JAR file.
- Deploy the JAR on to the JBoss server Instance.
- Open the EJB source code and place a break point.
- Make use of the menu option 'Tools' / 'Option' / 'Uncategorized'
and populate the properties as below.(fig-12.1)
- connector : null
- debugger : Default Debugger
- host : IP address of the Remote system oin which the JBoss
server is running.
- port : port as specified in the debugging script of JBoss
server.
- Now to connect to debugger to the JBoss server use the menu
option 'Debug' / 'Start JBoss Debugger'.(Fig-12.2)
- The Debugger Console window will confirm the connection &
status of debugger.
- Run the EJB Client program which invokes the EJB discussed above.
Up on the control reaching the break point the Debugger takes control
and you can debug as any java program.(fig-12.3)
- You can make use on the menu oprion 'Debug' / 'Finish' to
terminate the remote Debugger connectivity. (fig-12.4).
- Confirm the disconnection in the 'Finish Debug Session' dialog(fig-12.5)
Known Issues
- If j2ee.jar is in the system's classpath, then HTTPServer will
not behave as it should and deployment will fail.
- Configuration files of type .conf, can not be edited.
- JBoss Server registry is not persistant.
- In Linux Red Hat 9 user's etc/hosts file should have proper
values otherwise IDE will generate error. Refer the point 9 in this link