Created at:

Modified at:

JBoss notes

Note: I'm not a experienced Java developer. If you find any errors, please,

Contact

Running your application

(Using JBoss 5.1.0.GA)

There are different ways of running the application with JBoss. I like to use the deploy word for a production environment only, although it is used in a more broader sense sometimes, almost being a synonym of "run". I'll use it for production scenario only.

Software deployment

Configuration of JBoss

JBoss configuration is scattered among logs of XML files. The one we are going to touch is, just below the JBoss, located at server/<servername>/conf/bootstrap/profile.xml. In <servername> I'm using default but it can change according to your setup.

Running it in your development environment

In profile.xml file, you will find the following snippet of configuration::

    <property name="applicationURIs">
            <list elementClass="java.net.URI">
                    <value>${jboss.server.home.url}deploy</value>
            </list>
    </property>

To add the your application, you should add the directory of it and related
libraries::

    <property name="applicationURIs">
            <list elementClass="java.net.URI">
                    <value>${jboss.server.home.url}deploy</value>
                    <value>file:///home/foo/libs/</value>
                    <value>file:///home/foo/project/app/project.ear/lib/</value>
                    <value>file:///home/foo/project/app/</value>
            </list>
    </property>

Remember: you don't need to generated the EAR file in this case. EAR files are necessary for deploying only.

This is a good method for development, because JBoss will not have to unpack and load the whole EAR file over and over again. If you change a JSP file, the change appear on-the-fly. If you changed a Java class, you need to compile it again (generating the class file) and need to touch the META-INF/application.xml.

Note: This is also called Exploded Deployment. For more information see the following link documentation:

Deployment: JBoss 5.1.0 Administration and Configuration Guide

Deploying it in your production environment

The deploying phase consists in generating a package file, normally a EAR file that holds everything somebody need to run the application (3rd party libraries and so on).

EAR file

Everything you have to do is to put the EAR file in the default deploy directory (usually ${jboss.server.home.url}deploy, i.e., server/<servername>/deploy) your change the applicationURIs property (as we did above) to have the directory where the EAR file is.

Telling JBoss to link URLs and your application

JBoss runs at port 8080 by default. But what will be the index of your application? Edit the server/<servername>/deployers/jbossweb.deployer/remotehosts.properties file. Add entries like that::

    projectRemoteHost = http://localhost:8080/project

Troubleshooting

*** PROFILES MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}

The following error::

    13:56:59,512 ERROR [ScopedProfileServiceController] Error installing to Create: name=ProfileKey@1e2b619[domain=default, server=default, name=applications] state=Configured mode=On Demand requiredState=Installed
    ...
    13:56:59,513 ERROR [STDERR] Failed to boot JBoss:
    13:56:59,514 ERROR [STDERR] java.lang.IllegalStateException: Incompletely deployed:

    *** PROFILES IN ERROR: Name -> Error
    Profile: ProfileKey@1e2b619[domain=default, server=default, name=applications] in error due to java.lang.reflect.InvocationTargetException

    *** PROFILES MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}
    ProfileKey@d4a0be[domain=default, server=default, name=default] is missing following dependencies: ProfileKey@1e2b619[domain=default, server=default, name=applications]{Installed:**ERROR**}

is difficult to know the reason it happened. My problem is that I was using a version of JBoss 5-1-0.GA modified by the supplier of the application and it was lacking some files and directories that probably its IDE created automatically (I don't use a IDE).

The solution I found was to use the original version of JBoss. See this:

Bug 771647: EAP in standalone package cannot start production and all profiles