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:

  1. Introduction
  2. System Requirements
  3. Installation And Configuration
  4. Presentation in Explorer
  5. Features
  6. 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.

  1. From the NetBeans IDE, use the menu and select 'Tools' / 'Update Center' option to invoke the 'Update Center Wizard'.(fig-1.1)
  2. In the 'Update Center Wizard' Choose 'Install manually downloaded modules' option and press 'Next' button. (fig-1.2)
  3. Now add the nbJBoss.nbm file which you have downloaded using the 'ADD' button and press the button 'Next'.(fig-1.3).
  4. Now in the "Select modules to install" page select 'NbJBoss' from the "Include to Install" list and click on 'Next' (fig-1.4).
  5. The "SIPTech License Agreement" should pop-up, read the agreement carefully and if you agree to the agreement click on 'Accept'. (fig-1.5).
  6. 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)
  7. 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).
  8. 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).
  9. 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).

  1. Select menu option 'File' | 'New EJB Template'.(fig-3.1)
  2. 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).
  3. 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.
  4. Using the 'Specify Bean Type' combobox select the "Stateless Session" option.
  5. Now click on button 'Finish' to generate Bean, Home Interface and Remote Interface source.( fig-3.3)
  6. 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)

  1. Select menu option 'File' | 'New EJB Template'.(fig-3.5)
  2. 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 ).
  3. 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)
  4. 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).
  5. 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)
  6. 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)

  1. Select menu option 'File' | 'New EJB Template'.(fig-3.11)
  2. 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).
  3. 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)
  4. 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).
  5. 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'.
  6. 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).
  7. 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).
  8. 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.

  1. 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)
  2. Select menu option 'File' | 'Mount File System'.(fig-4.2)
  3. 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 ).
  4. 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 ).
  5. 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.

  1. 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)
  2. Compile these files.
  3. To invoke the Jar packager select the menu option 'Files' / 'Package EnterpriseBean'.
  4. 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).
  5. 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).
  6. 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).
  7. Here you may configure the EJB Properties, Click 'Next' navigate to 'XML View' panel . (fig-5.5).
  8. Here you can view the generated xml file. Click on 'Finish' to generate the JAR file.(fig-5.6).
  9. 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.

  1. Load the file system containg the jar/ ear files.
  2. Select one of the files, use the pop-up menu option 'Verify' or use Tools / Verify menu option.(fig-6.1)
  3. 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.

  1. Use the menu option 'Tools'/ 'Configuration Editor' (fig-7.1)
  2. In the 'Configuration Editor panel' use the browse option and select the folder containing JBoss configuration files.(fig-7.2)
  3. Select the file from the 'File List', to open the configuration file. (fig-7.3)
  4. 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.

  1. 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).
  2. 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)
  3. An information window will indicate if the connection is successful.(fig-8.3)
  4. If successful, the JBoss Server instance will be listed in the "JBoss Server Registry" (fig-8.4)

Steps to remove the JBoss Server Instance.

  1. Select the Server instance under the 'JBoss Server Registry' node found in the 'Runtime' view of IDE.
  2. Use the POP-up menu option "Remove JBoss Server".(fig-8.5)
  3. A confirmation dialog will confirm the removal (fig-8.6)
  4. 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.

  1. An Instance of JBoss should be registed successfully in the JBoss Server Registry.
  2. Select the JAR file from the "FileSystem" view.
  3. Either use the Pop-up menu option 'Deploy' / use the menu option 'Tools' / 'Deploy' (fig-9.1)
  4. The 'Deploy to Server' will pop-up listing the registered server.
  5. Select the server to which you would like to deploy the JAR file and click on 'OK'.(fig-9.2)
  6. An information window will indicate if the deployment was successful.(fig-9.3).

Steps to UnDeploy a JAR file.

  1. Select the 'JAR' file from the 'FileSystem' which was deployed to JBoss Server.
  2. Use the Pop-up menu option 'Undeploy' / menu option 'Tools' / 'Undeploy'.(fig-9.4)
  3. 'Remove from Server' window pop-up, select the server from which to undeploy the JAR file, then click on 'OK' button. (fig-9.5)
  4. 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.

  1. Select the JBoss Server Instance under the 'JBoss Server Registry' in the 'Runtime' view of the IDE.
  2. Use the pop-up menu option 'JBoss Console' or use menu option 'Tools' / 'JBoss Console'. (fig-10.1)
  3. 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.

  1. Select the JBoss Server Instance under the 'JBoss Server Registry' in the 'Runtime' view of the IDE.
  2. Use the pop-up menu option 'JNDI Browser' or use menu option 'Tools' / 'JNDI Browser'. (fig-11.1).
  3. 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.

  1. Start the JBoss server in the debug mode. 
  2. Load the file system containing the EJB source files, and deployable JAR file.
  3. Deploy the JAR on to the JBoss server Instance.
  4. Open the EJB source code and place a break point.
  5. Make use of the menu option 'Tools' / 'Option' / 'Uncategorized' and populate the properties as below.(fig-12.1)
  6. Now to connect to debugger to the JBoss server use the menu option 'Debug' / 'Start JBoss Debugger'.(Fig-12.2)
  7. The Debugger Console window will confirm the connection & status of debugger.
  8. 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)
  9. You can make use on the menu oprion 'Debug' / 'Finish' to terminate the remote Debugger connectivity. (fig-12.4).
  10. Confirm the disconnection in the 'Finish Debug Session' dialog(fig-12.5)

Known Issues

  1. If j2ee.jar is in the system's classpath, then HTTPServer will not behave as it should and deployment will fail.
  2. Configuration files of type .conf, can not be edited.
  3. JBoss Server registry is not persistant.
  4. 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