Installing JBoss in Eclipse

Overview

This document describes how to setup and run JBoss from within Eclipse. You should never use this configuration to accept production data. Running JBoss from within Eclipse should be used for testing and debugging purposes only.

Assumptions

We assume that you already have Eclipse installed. If not, please refer to Installing Eclipse(add link).

Download and Extract

  • Navigate over to jboss.org . There you will find a pre-compiled version of JBoss AS 4.2.1 (jboss-4.2.1.GA.zip).
  • Download it.
  • Extract the files from the ZIP archive. If you don't have a ZIP extractor, you could try an open source utility called 7-zip .
  • Move the jboss-4.2.1 directory to some location (C:\jboss maybe?).

Map the JBoss directory to an Eclipse Project

  • Right click on the Navigator panel.
  • Select New
  • Choose Project...
  • Expand General
  • Highlight Project
  • Click Next
  • Enter JBoss as the Project name
  • Click Finish
  • Right click on the JBoss project
  • Select New
  • Choose Folder
  • Click Advanced
  • Check Link to folder in the file system
  • Click Browse...
  • Navigate to C:\jboss
  • Click OK
  • Click Finish

Classloader Settings

Due to the file layout, the way the EAR file is constructed, and the way classes are loaded by default, our application doesn't work out of the box on JBoss. One particular class loader setting has to be changed. It is really important that you make this change, otherwise you will get tons of ClassCastExceptions and MethodInvocationExceptions.

Edit jboss/server/default/deploy/jboss-web.deployer/META-INF/jboss-service.xml setting UseJBossWebLoader to true .

Setup the Data Sources

These configuration files are also located in the "config" module directory under config/host/(hostname) .

Copy the following text into jboss/server/default/deploy/gateway-ds.xml

<?xml version="1.0" encoding="UTF-8"?>
<datasources>
        <local-tx-datasource>
                <jndi-name>GatewayDS</jndi-name>
                <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}gateway-hsql${/}localDB</connection-url>
                <driver-class>org.hsqldb.jdbcDriver</driver-class>
                <user-name>sa</user-name>
                <password></password>
                <min-pool-size>5</min-pool-size>
                <max-pool-size>20</max-pool-size>
                <idle-timeout-minutes>5</idle-timeout-minutes>
                <track-statements/>
        </local-tx-datasource>
</datasources>

Copy the Gateway EAR file

Copy the file gateway-ear-jboss-X.X.X.ear that you built with Maven to jboss/server/default/deploy/ . You can do this with copy and paste in the Navigator panel.

Add the Server View

  • Go to the Window menu
  • Select Show View
  • Choose Other...
  • Expand Server
  • Highlight Servers
  • Click OK

Server Setup

  • Right click on the Servers panel
  • Select New
  • Choose Server
  • Expand JBoss
  • Select JBoss 4.2
  • Click Next
  • Click Browse...
  • Browse to C:\jboss\
  • Click Finish

Starting the Server

Click on the start button (a green circle with a white arrow inside)