Platform : Eclipse Juno, JBoss AS 7.1.1.
Learning from examples is always an effective way to learn something new especially for a beginner. This method is fun and giving us a quick start to get the feel and of course providing us a real look of what we are doing without spending too much time reading the theory. So what we are going to do now is to learn from the experts through so many JBoss example applications – from basic to the advance ones. This article explains the steps to install the example applications, not to explain how the example programs work. However once you are experienced in installing the examples, you are capable to begin your own journey to follow and learn the programming techniques by your self.
Obtaining the Examples
First we need to download the Quickstarts example applications from the JBoss website:
When arriving at the website, there is a long list of the example applications. We don’t need to download each example one by one, instead simply select an example then in the new page download a zip file that contains all the example applications. Save the zip file into the local computer and then extract it to a directory.
Installing the Examples
After the example applications are obtained, now it is time to install it.
Before installing the JBoss applications in Eclipse, be sure that you have installed the JBoss Tools plugin in your Eclipse. If not, you cannot install those examples. To install the plugin, please refer to the other article explaining JBoss Tools written by the same author.
- Open Eclipse and run the menu File –> Import.
Expand the Maven item, and then select Existing Maven Projects. Click Next to continue.
- In the new window, click the Browse button and then point to the directory where you extract the JBoss examples.
Click Next to continue. Eclipse will immediately validate each JBoss project. Please wait while the example applications are loaded into Eclipse. It may take some long time.
When it is completed, please ensure the example applications are loaded successfully. Be cautious if you encounter some error messages because they indicate something wrong with the installation. If you just find some warnings, then you may ignore it. You know how to differentiate errors and warnings, don’t you?
In some cases, the JBoss example fails to install is caused by the permission in the proxy server. If you are using an office computer and the connection to the Internet is governed by the proxy server policies then errors tend to happen because Eclipse tries to download some files from the Internet and the proxy server is not properly set in Eclipse. Please try to set the proxy server settings in Eclipse, or if the error persists try to install using your own computer at home.
If the example allocations are successfully installed, the projects are visible in the Project Explorer view in Eclipse
- Now let us try to run the simplest application: Hello World. Open the Project Explorer and locate the jboss-as-helloworld project. Right-click on the project name and select Run As and followed by Run on Server.
- Please select the available JBoss Application Server (JBoss AS) in the opened dialog window. If you don’t encounter any JBoss AS, then you may miss some prerequisites steps. Please refer to the earlier articles about installing and starting the JBoss AS.
If you find a JBoss AS, then select the server. The Hello World application is going to be loaded into that server.
- After the application is run from the application server, it will be displayed in the Eclipse built-in browser.
- Verify using the Server Explorer view, that the Hello World application is successfully hosted on the JBoss AS and started.
- For the final test, please access the same application using a browser from outside Eclipse (e.g. Internet Explorer or Firefox) by typing the URL manually. It should be displayed the same.
This article explains the steps to install JBoss example applications. After successfully installing one application, you are ready to install the subsequent ones using the same steps. I hope you can effectively learn to develop the JBoss applications through those amazing example programs.