JBoss minimal configuration with Tomcat (Servlet Contrainer)

For proof of concept I needed to deploy large number of servlet containers. Because I’m lazy and most of the code for main application has already been written for JBoss AS (including Login modules and set of custom services) I really didn’t want to use standalone Jetty or Tomcat. To use different solution for one part of deployment would create significant duplication of some functionality and unnecessary increased administration.Instead of cleaning-up default configuration, I decided to use for first time minimal configuration and add JBossWeb (manually). This is an overview of what has been required to achieve it.

First copy the configuration and create new profile.

    cd server/
    cp -R minimal webserver

Obviously you need to copy original JBoss Web deployer.

    cp -R ./default/deploy/jboss-web.deployer ./webserver/deploy/

And that’s where fun begins. By default JBoss Web relies on several JEE service that needs to be disabled. Edit file

    webserver/deploy/jboss-web.deployer/META-INF/jboss-service.xml

and comment out (delete) following dependencies on unnecessary services:

    <depends>jboss:service=TransactionManager</depends>
    <depends>jboss.jca:service=CachedConnectionManager</depends>

This is based on assumption you don’t need them. Once CachedConnectionManager is gone, you need to delete CachedConnectionValve from

    webserver/deploy/jboss-web.deployer/server.xml

Right now, your new webserver profile is stripped to it’s minimum and you have to add something. First necessary addsecurity related services into jboss-service.xml.

<!-- ==================================================================== -->
<!-- Security                                                             -->
<!-- ==================================================================== -->

<mbean code="org.jboss.security.plugins.SecurityConfig"
   name="jboss.security:service=SecurityConfig">
   <attribute name="LoginConfig">jboss.security:service=XMLLoginConfig</attribute>
</mbean>
<mbean code="org.jboss.security.auth.login.XMLLoginConfig"
   name="jboss.security:service=XMLLoginConfig">
   <attribute name="ConfigResource">login-config.xml</attribute>
</mbean>

<!-- JAAS security manager and realm mapping -->
<mbean code="org.jboss.security.plugins.JaasSecurityManagerService"
   name="jboss.security:service=JaasSecurityManager">
   <attribute name="ServerMode">true</attribute>
   <attribute name="SecurityManagerClassName">org.jboss.security.plugins.JaasSecurityManager</attribute>
   <attribute name="DefaultUnauthenticatedPrincipal">anonymous</attribute>
   <attribute name="DefaultCacheTimeout">1800</attribute>
   <attribute name="DefaultCacheResolution">60</attribute>
   <attribute name="DeepCopySubjectMode">false</attribute>
</mbean>

Last remaining task is to copy additional JAR files and that’s it!

    cd default/lib/
    cp jboss.jar jboss-j2ee.jar jbosssx.jar servlet-api.jar jsp-api.jar jbossws* el-api.jar jboss-ejb3x.jar ../../webserver/lib

Back in bin folder you can test new configuration profile

    run -c webserver

Don’t expect miracles, you’ll get only what you configure. In this case is basic application server, with full support for customer services and webserver. To perform more tests you need to deploy some WAR file to deploy/ folder in order to get any output, as there are no context by default.This guide has been tested on JBoss AS 4.2.2

UPDATED. New post about details of JBoss Minimal is available.

3 Comments

  1. christian
    Posted November 20, 2008 at 9:16 pm | Permalink

    What should I add on top to enable the jmx-console.war as well? How can I track the jmx-console dependencies on other libraries?

  2. Posted November 21, 2008 at 2:03 pm | Permalink

    Hi Christian,

    I’ve just tried it and I can deploy jmx-console.war, without new dependencies.

    Radim

  3. yuap
    Posted March 5, 2009 at 5:01 pm | Permalink

    Used this recipe to add Tomcat to jboss-4.2.3.GA ‘minimal’

    I did a couple of things differently:

    Added security mbean to

    jboss-4.2.3.GA\server\sdt-proto20090305m1\conf\jboss-service.xml

    AND

    added (forced to add)

    jboss-4.2.3.GA\server\sdt-proto20090305m1\conf\login-config.xml


2 Trackbacks

  1. By Pages tagged "minimal" on June 5, 2008 at 2:02 am

    [...] tagged minimalOwn a WordPress blog? Make monetization easier with the WP Affiliate Pro plugin. JBoss minimal configuration with Servlet Contraine… saved by 6 others     stephiliz bookmarked on 06/04/08 | [...]

  2. [...] the last three years and especially after publishing my post JBoss minimal configuration with Tomcat I’ve been asked many times what is actually the idea behind JBoss AS Minimal Configuration [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*