JBoss minimal configuration with Tomcat (Servlet Contrainer)

June 3rd, 2008 Radim Marek Posted in Administration, jboss |

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

<!– ==================================================================== –>
<!– 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

One Response to “JBoss minimal configuration with Tomcat (Servlet Contrainer)”

  1. [...] 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 | [...]

Leave a Reply