Official documentation available

There is also official documentation available regarding the JBoss application server.

Because I had to install a newer version of JBoss / WildFly recently, I'll describe the setup process I did because it was in the end slightly easier than described in the documents mentioned above. This guide is for the JetBrains IDEA (Ultimate) IDE but you might be able to adjust it also for an Eclipse environment.

This guide was created with Magnolia 5.4.4JBoss WildFly versions 8.2.1.Final and 10.0.10.Final on with IDEA 15 Utilmate on Mac OS X Yosemite.

Configure JAAS

Magnolia integrates the Java Authentication and Authorization service. To make this work with JBoss, adjust the configuration as described in the official documentation (JBoss AS 7). For your convenience, below is the final configuration for the Magnolia JAAS part. I have added to urn:jboss:domain:security:1.2

JBOSS_HOME/standalone/configuration/standalone.xml
...
<login-module code="org.apache.jackrabbit.core.security.SimpleLoginModule" flag="required"/>
...
<security-domain name="magnolia" cache-type="default">
	<authentication>
    	<login-module code="info.magnolia.jaas.sp.jcr.JCRAuthenticationModule" flag="requisite"/>
        <login-module code="info.magnolia.jaas.sp.jcr.JCRAuthorizationModule" flag="required"/>
    </authentication>
</security-domain>
<security-domain name="Jackrabbit" cache-type="default">
	<authentication>
    	<login-module code="org.apache.jackrabbit.core.security.SimpleLoginModule" flag="required"/>
    </authentication>
</security-domain>

This is the whole configuration block:

JBOSS_HOME/standalone/configuration/standalone.xml
<subsystem xmlns="urn:jboss:domain:security:1.2">
	<security-domains>
    	<security-domain name="other" cache-type="default">
        	<authentication>
            	<login-module code="org.apache.jackrabbit.core.security.SimpleLoginModule" flag="required"/>
                <login-module code="Remoting" flag="optional">
                	<module-option name="password-stacking" value="useFirstPass"/>
                </login-module>
                <login-module code="RealmDirect" flag="required">
                	<module-option name="password-stacking" value="useFirstPass"/>
                </login-module>
            </authentication>
        </security-domain>
        <security-domain name="magnolia" cache-type="default">
        	<authentication>
            	<login-module code="info.magnolia.jaas.sp.jcr.JCRAuthenticationModule" flag="requisite"/>
                <login-module code="info.magnolia.jaas.sp.jcr.JCRAuthorizationModule" flag="required"/>
            </authentication>
        </security-domain>
        <security-domain name="Jackrabbit" cache-type="default">
        	<authentication>
            	<login-module code="org.apache.jackrabbit.core.security.SimpleLoginModule" flag="required"/>
            </authentication>
        </security-domain>
        <security-domain name="jboss-web-policy" cache-type="default">
        	<authorization>
            	<policy-module code="Delegating" flag="required"/>
            </authorization>
        </security-domain>
        <security-domain name="jboss-ejb-policy" cache-type="default">
        	<authorization>
                <policy-module code="Delegating" flag="required"/>
            </authorization>
        </security-domain>
        <security-domain name="jaspitest" cache-type="default">
        	<authentication-jaspi>
            	<login-module-stack name="dummy">
                	<login-module code="Dummy" flag="optional"/>
                </login-module-stack>
                <auth-module code="Dummy"/>
            </authentication-jaspi>
        </security-domain>
    </security-domains>
</subsystem>

Create a JBoss deployment descriptor within your webapp project

Again, see also the official documentation.

MAGNOLIA_WEBAPP_DIRECTORY/WEB-INF/jboss-deployment-structure.xml
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
  <deployment>
    <exclude-subsystems>
      <subsystem name="jaxrs"/>
      <subsystem name="webservices"/>
      <subsystem name="weld" />
    </exclude-subsystems>
    <!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
    <exclusions>
      <module name="org.apache.log4j" />
      <module name="org.slf4j" />
    </exclusions>
  </deployment>
</jboss-deployment-structure>

Optional: Create a specifc deployment context

Because I want Magnolia to load my specific development profile (see WAR configurations) I configure JBoss to be started under the /dev context path of my local WildFly server.

MAGNOLIA_WEBAPP_DIRECTORY/WEB-INF/jboss-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
  <context-root>/dev</context-root>
</jboss-web>

IDEA runtime configuration

As usual, create your runtime configuration in IDEA (Utlimate). From the "Run" menu, choose "Edit configurations..." to open the configuration dialog.

Click the plus sign for adding a new JBoss server configuration, then Local for a WIldFly installation located on the hard disk of your development machine.

If you don't have a JBoss configuration yet, you just have to select the directory where JBoss resides on your disk.

IDEA automatically offers you to create the needed deployment for your new server configuration - choose the "exploded" option.

Then add fill in the other options for your new runtime configuration:

After that, you should be able to start up your Magnolia project on JBoss WildFly with your IDEA IDE.

Further notes

In this guide, I only describe my development setup. The configuration of a standalone deployment JBoss webserver will involve different steps. There was also no need to configure the Bouncy Castle libraries as described in the offcial guide, because entering a license worked for me and in this setup I don't care about other instances for publication - I even turn them off in my /dev context because I want to be able to delete configuration.