Deploy/container/JBoss

From Omar Wiki

Jump to: navigation, search

This page describes how to use JBoss application server for deploying freebXML Registry server code.

Contents

Overview and Concepts

JBoss is a commonly used open source application server.

Known Versions Supported

  • JBoss 4.0.1sp1 with Tomcat 5.5
  • JBoss 4.0.2 with Tomcat 5.5
  • JBoss 4.0.3sp1 with Tomcat 5.5
  • JBoss 4.0.5.GA with Tomcat 5.5

Deploying OMAR

(set catalina.home to /tmp if it doesn't exist in local.build.properties)

  • Install jwsdp 1.6
  • Copy jaxp-api.jar from jswdp.home\jaxp\lib to jboss.home\lib\endorsed
  • Create JBoss datasource for Omar in jboss.home\server\default\deploy called omar-ds.xml
  (example for PostgreSQL which is configured in local.build.properties)

  <?xml version="1.0" encoding="UTF-8"?>
  <datasources>
    <local-tx-datasource>
      <jndi-name>omar</jndi-name>
      <connection-url>jdbc:postgresql://127.0.0.1:5432/omar</connection-url>
      <driver-class>org.postgresql.Driver</driver-class>
      <user-name>username</user-name>
      <password>password</password>
      <metadata>
        <type-mapping>PostgreSQL 8.1</type-mapping>
      </metadata>
    </local-tx-datasource>
   </datasources>

Copy jdbc drivers to jboss.home\server\default\lib


  • Edit jboss.home\server\default\deploy\jbossweb-tomcat55.sar\conf\web.xml and enable

     <init-param>
        <param-name>compilerSourceVM</param-name>
        <param-value>1.5</param-value>
     </init-param>

  • Execute the build script as per a tomcat build
       build compile
       build genKeys
       build jars
       build war
       build createDemoDB
       
  • Create a jboss-web.xml that will go in omar.war/WEB-INF to reference the datasource above

       <jboss-web>
           <resource-ref>
              <res-ref-name>jdbc/omar-registry</res-ref-name>
              <res-type>javax.sql.DataSource</res-type>
              <jndi-name>java:/omar</jndi-name>
           </resource-ref>
       </jboss-web>

  • Remove omar.war/WEB-INF/classes/log4j.properties, and omar.war/WEB-INF/lib/log4jxxx.jar as these conflict with JBoss
  • Move the jboss.home\server\default\deploy\jbossweb-tomcat55.sar\jsf-libs directory to somewhere safe (myfaces conflicts with jsf-impl)
    • delete the cached jboss.home\server\default\tmp and jboss.home\server\default\work directories.
  • SSL
    • copy omar.home\data\security\appserver-truststore.jks omar.home\data\security\keystore.jks to jboss.home\server\default\conf
    • Edit jboss.home\server\default\deploy\jbossweb-tomcat55.sar\server.xml as follows

       <Connector port="8443" address="${jboss.bind.address}"
          maxThreads="100" strategy="ms" maxHttpHeaderSize="8192"
          emptySessionPath="true"
          scheme="https" secure="true" clientAuth="want" 
         truststorePass="changeit" truststoreType="jks"
         truststoreFile="${jboss.server.home.dir}/conf/appserver-truststore.jks"
         keystoreFile="${jboss.server.home.dir}/conf/chap8.keystore"
         keystorePass="rmi+ssl" sslProtocol="TLS"/>

chap8.key store is a default keystore (from chapter 8 in the JBoss tutorials!) required to get a ssl connection in jboss, create it as follows;

keytool -genkey -keystore chap8.keystore -storepass rmi+ssl -keypass rmi+ssl -keyalg RSA -alias chapter8 -validity 3650 -dname "cn=chapter8 example,ou=admin book,dc=jboss,dc=org"

(see http://docs.jboss.org/jbossas/jboss4guide/r2/html/ch8.chapter.html)

Note the certificate presented will now belong to chapter8 so you may wish to change this!

Links