While migrating from WebLogic to JBoss EAP6 what all changes required in weblogic.xml

Solution Unverified - Updated -

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 6.0

Issue

  • While trying to migrate the war files of WebLogic to JBoss EAP6 what all changes are required in weblogic.xml
  • What are the equivalent tags in JBoss related to the following tags of "weblogic.xml"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 7.0//EN" "http://www.bea.com/servers/wls700/dtd/weblogic700-web-jar.dtd">
<weblogic-web-app>
  <context-root>someContextRoot</context-root>
  <security-role-assignment>
    <role-name>TestRole1</role-name>
    <principal-name>TestRole1</principal-name>
  </security-role-assignment>

  <security-role-assignment>
    <role-name>TestRole2</role-name>
    <principal-name>TestRole2</principal-name>
  </security-role-assignment>

  <security-role-assignment>
    <role-name>TestRole3</role-name>
    <principal-name>TestRole3</principal-name>
  </security-role-assignment>

  <security-role-assignment>
    <role-name>users</role-name>
    <principal-name>users</principal-name>
  </security-role-assignment>


  <session-descriptor>
      <session-param>
        <param-name>PersistentStoreType</param-name>
        <param-value>replicated_if_clustered</param-value>
      </session-param>
      <session-param>
        <param-name>TimeoutSecs</param-name>
        <param-value>3650</param-value>
      </session-param>
      <session-param>
        <param-name>InvalidationIntervalSecs</param-name>
        <param-value>60</param-value>
      </session-param>
   </session-descriptor>

   <container-descriptor>
    <save-sessions-enabled>true</save-sessions-enabled>
    <prefer-web-inf-classes>true</prefer-web-inf-classes>
   </container-descriptor>

  <jsp-descriptor>
    <jsp-param>
      <param-name>keepgenerated</param-name>
      <param-value>true</param-value>
    </jsp-param>
    <jsp-param>
      <param-name>encoding</param-name>
      <param-value>ISO8859_1</param-value>
    </jsp-param>
  </jsp-descriptor>

  <charset-params>
      <input-charset>
      <resource-path>/*</resource-path>
      <java-charset-name>ISO8859_1</java-charset-name>
      </input-charset>
  </charset-params>
</weblogic-web-app>

Resolution

  • In order to change the context root of your Web Application you can use the tag inside your WEB-INF/jboss-web.xml as following:

Regarding Context root Tag of weblogic.xml:

       <jboss-web>
            <context-root>someContextRoot1</context-root>
       </jboss-web>

Regarding Tag of weblogic.xml:

  • In JBoss we need not to define the following kind of Role Mapping which is done in Weblogic (weblogic.xml):
       <security-role-assignment>
        <role-name>TestRole1</role-name>
        <principal-name>TestRole1</principal-name>
       </security-role-assignment>
  • As in JBoss EAP6 we use the "RoleMappingLoginModule" in the EAP6 configuration like "standalone-full.xml", "domain.xml"...etc.
        <security-domain name="FormBasedAuthWebAppPolicy">
            <authentication>
                <login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag="required">
                    <module-option name="dsJndiName" value="java:/MySQLDS"/>
                    <module-option name="principalsQuery" value="select password from  PRINCIPLES where principal_id=?"/>
                    <module-option name="rolesQuery" value="select user_role, 'Roles' from  ROLES where  principal_id=?"/>
                </login-module>

                <!-- Following is the RoleMappingLoginModule -->    
                <login-module code="org.jboss.security.auth.spi.RoleMappingLoginModule" flag="optional">
                    <module-option name="rolesProperties" value="/home/userone/jboss-eap-6.0-GA/standalone/configuration/test-roles.properties"/>
                    <module-option name="replaceRole" value="false"/>
                </login-module>
            </authentication>
        </security-domain>
  • In your "WEB-INF/jboss-web.xml" you will need to map your Security-domain as following:
       <jboss-web>
          <security-domain>java:/jaas/FormBasedAuthWebAppPolicy</security-domain>
       </jboss-web>

Regarding Tag of weblogic.xml:

    <container-descriptor>
        <save-sessions-enabled>true</save-sessions-enabled>
        <prefer-web-inf-classes>true</prefer-web-inf-classes>
    </container-descriptor>
  • In JBoss the Classes present inside the "WEB-INF/lib" Jars and inside the "WEB-INF/classes" will always be loaded from inside the Web Application only as WAR has it's own scoped class loader. I do not see any alternative/relative configuration in JBoss EAP6 for tag

Regarding Tag of weblogic.xml:

  <jsp-descriptor>
    <jsp-param>
      <param-name>keepgenerated</param-name>
      <param-value>true</param-value>
    </jsp-param>
    <jsp-param>
      <param-name>encoding</param-name>
      <param-value>ISO8859_1</param-value>
    </jsp-param>
  </jsp-descriptor>
  • In JBoss EAP6 configuration like "standalone-full.xml", "domain.xml"...etc we can add the JSP configuration inside the "web" subsystem as following:
        <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
            <configuration>
                <jsp-configuration development="true" java-encoding="ISO8859_1" keep-generated="true"/>
            </configuration>
            <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
            <virtual-server name="default-host" enable-welcome-root="true">
                <alias name="localhost"/>
                <alias name="example.com"/>
            </virtual-server>
        </subsystem>

Regarding Tag of weblogic.xml:

    <session-param>
      <param-name>TimeoutSecs</param-name>
      <param-value>3650</param-value>
    </session-param>
    <session-param>
      <param-name>InvalidationIntervalSecs</param-name>
      <param-value>60</param-value>
    </session-param>
  • In JBoss you can use "WEB-INF/web.xml", Here we can add the following in order to set Session timeout. However i do not see any exact replacement of WebLogic's
    InvalidationIntervalSecs parameter.
    <session-config>
        <session-timeout>3650</session-timeout>
    </session-config>

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments