JBoss Eclipse IDE provides an easy way to configure the packaging of various archives. There is no restriction of what can be packaged. In this tutorial, four packaging configurations will be defined:
When launched, these four packaging configurations will create the J2EE application ready to be deployed.
Procedure 9.1. Enable Packaging
| ![]() |
Procedure 9.2. Creating the EJB JAR
| ![]() |
We want to add the EJB classes and interfaces. Eclipse has generated the compiled classes into the bin folder (declared as the default output dir of the project). Select the FiboEJB.jar item and right-click in the area to pop-up the menu and choose Add Folder. A “Folder Selection” dialog appears. This dialog allows to select which folder (local to workspace or in the file system) to include into the package, to specify include and exclude filters (A la Ant) and to set a prefix that will be append when building the package. | ![]() |
Click on Project Folder. A “Folder Chooser” dialog appears. This dialog allows selecting which folder to include. This folder can be choosen among all the opened projects. Select the /Tutorial/bin folder and click OK. | ![]() |
The folder is now /Tutorial/bin. As we only want the EJB classes and interfaces, specify the following as an include filter: tutorial/ejb/*.class,tutorial/interfaces/*.class Click on OK | ![]() |
We now want to add the standard EJB deployment descriptor. Select the FiboEJB.jar item and right-click in the area to pop-up the menu and choose Add File. A “File Selection” dialog appears. | ![]() |
This dialog allows you to select which file (local to workspace or in the file system) to include in the package and to set a prefix which will be appended when building the package. | ![]() |
Click on Project File. A “File Chooser” dialog appears. This dialog allows to select which file to include. This file can be choosen among all the opened projects. Select the /Tutorial/src/META-INF/ejb-jar.xml folder and click OK. | ![]() |
The file is now /Tutorial/src/META-INF/ejb-jar.xml. The ejb-jar.xml must be located under the META-INF directory of the EJB package. Set the prefix to META-INF. Click on OK. | ![]() |
To add the specific EJB deployment descriptor, select the FiboEJB.jar item and right-click in the area to pop-up the menu and choose Add File. The file to choose is /Tutorial/src/META-INF/jboss.xml. The jboss.xml must be located under the META-INF directory of the EJB package. Set the prefix to META-INF. Click on OK. | ![]() |
The packaging configuration for the FiboEJB.jar is now complete. | ![]() |
Click the Add button on the right side of the list. Type FiboEJB-client.jar in the dialog and click OK. You have created a new packaging configuration that will produce the FiboEJB-client.jar file. | ![]() |
Select the FiboEJB-client.jar item and right-click in the area to pop-up the menu and choose Add Folder. A “Folder Selection” dialog appears. Click on Project Folder and select the /Tutorial/bin folder from the “Folder Chooser” dialog. As we only want the EJB interfaces, set the include filter to tutorial/interfaces/*.class. Click on OK. | ![]() |
The packaging configuration for the FiboEJB-client.jar is now complete. | ![]() |
Click the Add button on the right side of the list. Type FiboWeb.war in the dialog and click OK. You have created a new packaging configuration that will produce the FiboWeb.war file. | ![]() |
Select the FiboWeb.war item and right-click in the area to pop-up the menu and choose Add Folder. A “Folder Selection” dialog appears. Click on Project Folder and select the /Tutorial/bin folder from the “Folder Chooser” dialog. As we only want the Servlet class, set the include filter to tutorial/web/*.class. The classes must be located under the WEB-INF/classes of the War package. Set the prefix to WEB-INF/classes. Click on OK. | ![]() |
To add the standard Web deployment descriptor, select the FiboWeb.war item and right-click in the area to pop-up the menu and choose Add File. A “File Selection” dialog appears. The file to choose is /Tutorial/src/WEB-INF/web.xml. The web.xml must be located under the WEB-INF of the War package. Set the prefix to WEB-INF. Click on OK. | ![]() |
To add the JBoss specific Web deployment descriptor, select the FiboWeb.war item and right-click in the area to pop-up the menu and choose Add File. A “File Selection” dialog appears. The file to choose is /Tutorial/src/WEB-INF/jboss-web.xml. The jboss-web.xml must be located under the WEB-INF of the War package. Set the prefix to WEB-INF. Click on OK. | ![]() |
To add the EJB Client Jar, select the FiboWeb.war item and right-click in the area to pop-up the menu and choose Add File. A “File Selection” dialog appears. WarningIf you are running JBoss 4.0 or above, you should skip this step (see explanation above).
The file to choose is /Tutorial/FiboEJB-client.jar. But it doesn’t exist yet as the packaging has not been run. Instead of selecting it, go in the text field and type the name of the file /Tutorial/FiboEJB-client.jar. Even if the file doesn’t exist, it can be added to a packaging configuration. | ![]() |
The FiboEJB-client.jar must be located under the WEB-INF/lib directory of the War package. Set the prefix to WEB-INF/lib. Click on OK. | ![]() |
Select the FiboWeb.war item and right-click in the area to pop-up the menu and choose Add Folder. A “Folder Selection” dialog appears. Click on Project Folder and select the /Tutorial/docroot folder from the “Folder Chooser” dialog. This is the content of the Web Application. Click on OK. | ![]() |
The packaging configuration for the FiboWeb.war is now complete. | ![]() |
Click the Add button on the right side of the list. Type FiboApp.ear in the dialog and click OK. You have created a new packaging configuration that will produce the FiboApp.ear file. | ![]() |
To add the application deployment descriptor, select the FiboApp.ear item and right-click in the area to pop-up the menu and choose Add File. A “File Selection” dialog appears. The file to choose is /Tutorial/src/META-INF/application.xml. The application.xml must be located under the META -INF of the EAR package. Set the prefix to META -INF. Click on OK. | ![]() |
To add the EJB module, select the FiboApp.ear item and right-click in the area to pop-up the menu and choose Add File. A “File Selection” dialog appears. The file to choose is /Tutorial/FiboEJB.jar. But it doesn’t exist yet as the packaging has not been run. Instead of selecting it, go in the text field and type the name of the file /Tutorial/FiboEJB.jar. Even if the file doesn’t exist, it can be added to a packaging configuration. Click on OK. | ![]() |
To add the Webmodule, select the FiboApp.ear item and right-click in the area to pop-up the menu and choose Add File. A “File Selection” dialog appears. The file to choose is /Tutorial/FiboWeb.war. But it doesn’t exist yet as the packaging has not been run. Instead of selecting it, go in the text field and type the name of the file /Tutorial/ FiboWeb.war. Even if the file doesn’t exist, it can be added to a packaging configuration. Click on OK. | ![]() |
The packaging configuration for the FiboApp.ear is now complete. Click OK to save the packaging configurations. | ![]() |
Right-click on the project and select Run Packaging. The packaging will display its output in the console. The output should look like this: | ![]() |
After the execution, you should have a project that looks like this: | ![]() |