Version 6

    Some of the issues encountered when porting from Weblogic 7 to JBoss 4 are documented here, also discussed in MigrationToolsProject:

     

    weblogic.jndi.WLInitialContextFactory

    Classes cannot use this weblogic-specific class for the INITIAL_CONTEXT_FACTORY.  Not specifing an INITIAL_CONTEXT_FACTORY generally works, as the app server will default to it's own factory.

     

    Deployment Descriptors

    Read documentation to learn about the general differences between Weblogic and JBoss.

     

    The XML is not validated by JBoss, you should do this yourself if you have problems.

     

    jboss.xml (equivalent to weblogic-ejb-jar.xml) has a <resource-managers> section which is another layer of name mapping which doesn't exist in weblogic and must be used in JBoss.  See an example.

     

    jboss-web.xml corresponds to weblogic.xml (in WEB-INF)

     

    web.xml

     

    Remove duplicate servlet entries.

     

    fix <url-pattern>s that don't begin with /

     

    Remove invalid servlet mappings.

     

    JSPs

     

    change taglib uri to start with /WEB-INF or put entries in web.xml

     

    Container roles

     

    weblogic.xml maps the roles used in web.xml to the LDAP names.  In JBoss, a similar role-mapping can be achieved using the RoleMappingLoginModule added as additional/optional configuration to complement the login configuration. In conf/login-config.xml add a per-application security realm, specify login, role-mapping configuration and provide role-mapping in a properties file.  E.g.:

         <application-policy name="myApp">
         <authentication>
              <login-module code="org.jboss.security.auth.spi.LdapLoginModule" flag="required">
                   <module-option name="java.naming.factory.initial">com.sun.jndi.ldap.LdapCtxFactory</module-option>
                   <module-option name="java.naming.provider.url">ldap://myldap:389/</module-option>
                   <module-option name="java.naming.security.authentication">simple</module-option>
                   <module-option name="principalDNPrefix">uid=</module-option>
                   <module-option name="roleAttributeID">cn</module-option>
                   <!-- module-option name="roleAttributeIsDN">true</module-option -->
                   <module-option name="principalDNSuffix">,ou=XXX,ou=XXX,o=XXX</module-option>
                   <module-option name="rolesCtxDN">ou=foo,ou=bar,ou=baz,o=bap</module-option>
                   <!-- module-option name="roleNameAttributeID">cn</module-option -->
                   <module-option name="uidAttributeID">uniquemember</module-option>
                   <module-option name="matchOnUserDN">true</module-option>
              </login-module>
              <login-module code="org.jboss.security.auth.spi.RoleMappingLoginModule" flag="optional" >
                          <module-option name="rolesProperties">roleMapping.properties</module-option>
                          <module-option name="replaceRole">false</module-option>
              </login-module>
         </authentication>
         </application-policy>
    

     

    One key point here is that in the properties file, the mapping is from ldap role to logical role (not vice-versa as with weblogic).

     

    T3 services

     

    See this note if you are using t3 services and want to convert to JBoss: http://www.jboss.org/index.html?module=bb&op=viewtopic&t=57689

     

     

    jboss-web.xslt: XSLT stylesheet to convert weblogic.xml

     

    Note: XSLT 2.0

     

    <?xml version="1.0" encoding="UTF-8"?>
    <!--====================================================================================================-->
    <!-- jboss-web.xslt                                                                                -->
    <!--                                                                                -->
    <!-- Transforms weblogic.xml (v.7) into jboss-web.xml (v.4.2)                                           -->
    <!--                                                                                -->
    <!-- Victor Klimov, 26.05.2008                                                                          -->
    <!-- Inspired by public domain XSLT file: jboss.xslt                                                    -->
    <!-- (C) 2008, Logica Deutschland GmbH & Co. KG                                                         -->
    <!--====================================================================================================-->
    <xsl:stylesheet 
         version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output  method="xml" doctype-public="-//JBoss//DTD Web Application 4.2//EN"  doctype-system="http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd"></xsl:output>
    
    <xsl:variable name="input-uri" select="document-uri(/)"></xsl:variable>
    
    <xsl:template match="/weblogic-web-app">
    <xsl:text>
    </xsl:text>
    <xsl:comment><xsl:value-of select="concat('Generated from ', $input-uri, ' on ', current-date(), ' at ', current-time())"></xsl:value-of>
    </xsl:comment>
    <xsl:text>
    </xsl:text>
    <jboss-web><xsl:text>
    &#9;</xsl:text>
    <xsl:apply-templates select="reference-descriptor/resource-description"></xsl:apply-templates><xsl:text>
    </xsl:text>
    
    <xsl:apply-templates select="security-role-assignment"></xsl:apply-templates><xsl:text>
    </xsl:text>
    
    <xsl:apply-templates select="reference-descriptor/ejb-reference-description"></xsl:apply-templates><xsl:text>
    </xsl:text>
    
    </jboss-web>
    </xsl:template> <!-- end of template match="/weblogic-web-app" -->
    
    <xsl:template match="security-role-assignment">
         <security-role><xsl:text>
    &#9;&#9;</xsl:text>
              <xsl:copy-of select="role-name"></xsl:copy-of><xsl:text>
    &#9;&#9;</xsl:text>
              <xsl:apply-templates select="principal-name"></xsl:apply-templates><xsl:text>
    &#9;</xsl:text>
    
         </security-role><xsl:text>
    </xsl:text>
    
    </xsl:template> <!-- end of template match="security-role-assignment" -->
    
    <xsl:template match="principal-name">
    <xsl:text>
    &#9;&#9;</xsl:text>
              <xsl:copy-of select="."></xsl:copy-of>
    </xsl:template> <!-- end of template match="principal-name" -->
    
    <xsl:template match="reference-descriptor/ejb-reference-description">
    <xsl:text>
    &#9;</xsl:text>
    <ejb-ref><xsl:text>
    &#9;&#9;</xsl:text>
    <xsl:copy-of select="ejb-ref-name"></xsl:copy-of><xsl:text>
    &#9;&#9;</xsl:text>
    <xsl:copy-of select="jndi-name"></xsl:copy-of><xsl:text>
    &#9;</xsl:text>
    </ejb-ref>
    </xsl:template> <!-- end of template match="reference-descriptor/ejb-reference-description" -->
    
    <xsl:template match="reference-descriptor/resource-description">
    <xsl:text>
    &#9;</xsl:text>
    <resource-ref><xsl:text>
    &#9;&#9;</xsl:text>
    <xsl:copy-of select="res-ref-name"></xsl:copy-of><xsl:text>
    &#9;&#9;</xsl:text>
    <xsl:copy-of select="jndi-name"></xsl:copy-of><xsl:text>
    &#9;</xsl:text>
    </resource-ref>
    </xsl:template> <!-- end of template match="reference-descriptor/resource-description" -->
    
    </xsl:stylesheet>