Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-6183

Error when web app has mount point /

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Trunk, 14.12.01, 12.04.06, 13.07.02
    • Fix Version/s: 14.12.01, 12.04.06, 13.07.02, 16.11.01
    • Component/s: ecommerce
    • Labels:
      None

      Description

      Context path values of "/" are now logged as invalid since tomcat-7.0.58, so if you want to mount webapp on "/" than you need to use “” instead “/“.
      Here is the ticket for the same: https://bz.apache.org/bugzilla/show_bug.cgi?id=57216

        Activity

        Hide
        deepak.dixit Deepak Dixit added a comment -

        Fixed string index out of range exception at r#1667733 in trunk and back ported changes to 14.12 as well.
        An warning related to "/" will display on console

             [java] 2015-03-19 18:18:48,139 |catalina-startup-1   |StandardContext               |W| A context path must either be an empty string or start with a '/' and do not end with a '/'. The path [/] does not meet these criteria and has been changed to []
        

        To fix this warning we have two options:
        Option 1: In this case we need to use mount-point=“” if we want to mount application on "/" (preferable same as tomcat contextPath behavior)

        Index: framework/base/src/org/ofbiz/base/component/ComponentConfig.java
        ===================================================================
        --- framework/base/src/org/ofbiz/base/component/ComponentConfig.java	(revision 1667731)
        +++ framework/base/src/org/ofbiz/base/component/ComponentConfig.java	(working copy)
        @@ -847,12 +847,8 @@
                     this.description = description;
                     this.server = element.getAttribute("server");
                     String mountPoint = element.getAttribute("mount-point");
        -            if (mountPoint.isEmpty()) {
        -                // default mount point is name if none specified
        -                mountPoint = this.name;
        -            }
                     // check the mount point and make sure it is properly formatted
        -            if (!"/".equals(mountPoint)) {
        +            if (!mountPoint.isEmpty()) {
                         if (!mountPoint.startsWith("/")) {
                             mountPoint = "/" + mountPoint;
        

        Options2: In this case we don’t need to make any changes in webapp definition

        Index: framework/base/src/org/ofbiz/base/component/ComponentConfig.java
        ===================================================================
        --- framework/base/src/org/ofbiz/base/component/ComponentConfig.java(revision 1667692)
        +++ framework/base/src/org/ofbiz/base/component/ComponentConfig.java(working copy)
        @@ -862,6 +862,8 @@
                             }
                             mountPoint = mountPoint + "*";
                         }
        +            } else {
        +                mountPoint = "";
                     }
                     this.mountPoint = mountPoint;
                     if (this.mountPoint.endsWith("/*")) {
        
        Show
        deepak.dixit Deepak Dixit added a comment - Fixed string index out of range exception at r#1667733 in trunk and back ported changes to 14.12 as well. An warning related to "/" will display on console [java] 2015-03-19 18:18:48,139 |catalina-startup-1 |StandardContext |W| A context path must either be an empty string or start with a '/' and do not end with a '/'. The path [/] does not meet these criteria and has been changed to [] To fix this warning we have two options: Option 1: In this case we need to use mount-point=“” if we want to mount application on "/" (preferable same as tomcat contextPath behavior) Index: framework/base/src/org/ofbiz/base/component/ComponentConfig.java =================================================================== --- framework/base/src/org/ofbiz/base/component/ComponentConfig.java (revision 1667731) +++ framework/base/src/org/ofbiz/base/component/ComponentConfig.java (working copy) @@ -847,12 +847,8 @@ this .description = description; this .server = element.getAttribute( "server" ); String mountPoint = element.getAttribute( "mount-point" ); - if (mountPoint.isEmpty()) { - // default mount point is name if none specified - mountPoint = this .name; - } // check the mount point and make sure it is properly formatted - if (! "/" .equals(mountPoint)) { + if (!mountPoint.isEmpty()) { if (!mountPoint.startsWith( "/" )) { mountPoint = "/" + mountPoint; Options2: In this case we don’t need to make any changes in webapp definition Index: framework/base/src/org/ofbiz/base/component/ComponentConfig.java =================================================================== --- framework/base/src/org/ofbiz/base/component/ComponentConfig.java(revision 1667692) +++ framework/base/src/org/ofbiz/base/component/ComponentConfig.java(working copy) @@ -862,6 +862,8 @@ } mountPoint = mountPoint + "*" ; } + } else { + mountPoint = ""; } this .mountPoint = mountPoint; if ( this .mountPoint.endsWith( "/*" )) {
        Hide
        deepak.dixit Deepak Dixit added a comment -

        Backported changes to 13.07 and 12.04 as well.

        Show
        deepak.dixit Deepak Dixit added a comment - Backported changes to 13.07 and 12.04 as well.
        Hide
        jacques.le.roux Jacques Le Roux added a comment - - edited

        I have set the fixed versions. Should we not close now?

        A wait I did not read Deepak's 1st comment. It seems to me the 2nd solution is better but since I only read the comment and not reviewed the code, what changes are expectd in webapps definitions, <url-pattern> in web.xml files?

        Show
        jacques.le.roux Jacques Le Roux added a comment - - edited I have set the fixed versions. Should we not close now? A wait I did not read Deepak's 1st comment. It seems to me the 2nd solution is better but since I only read the comment and not reviewed the code, what changes are expectd in webapps definitions, <url-pattern> in web.xml files?
        Hide
        deepak.dixit Deepak Dixit added a comment - - edited

        You need to only change the ecommerce mount point,

        <webapp name="ecommerce"
                title="eCommerce"
                server="default-server"
                location="webapp/ecommerce"
                mount-point="/"
                app-bar-display="false"/>
        
        Show
        deepak.dixit Deepak Dixit added a comment - - edited You need to only change the ecommerce mount point, <webapp name= "ecommerce" title= "eCommerce" server= " default -server" location= "webapp/ecommerce" mount-point= "/" app-bar-display= " false " />
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        OK clear, using an empty mount-point is confusing at the moment (people are used to use "/"). But it seems using an empty mount-point will become a standard in the future. So I finally think we should go with the 1st solution and make that clear in our ofbiz-component files by adding a comment before the 1st webapp definition and update the wiki.

        If nobody disagree, would you take care of that Deepak? Would be good also if you could put the commits revision number for each branch and trunk in a comment in this Jira issue So would be 2 sets of commits for each... Thanks!

        Show
        jacques.le.roux Jacques Le Roux added a comment - OK clear, using an empty mount-point is confusing at the moment (people are used to use "/"). But it seems using an empty mount-point will become a standard in the future. So I finally think we should go with the 1st solution and make that clear in our ofbiz-component files by adding a comment before the 1st webapp definition and update the wiki . If nobody disagree, would you take care of that Deepak? Would be good also if you could put the commits revision number for each branch and trunk in a comment in this Jira issue So would be 2 sets of commits for each... Thanks!
        Hide
        deepak.dixit Deepak Dixit added a comment -

        Sure Jacques, I'll take care of this. I would like to wait if nobody has any objection then I'll commit (option1) tomorrow.

        Show
        deepak.dixit Deepak Dixit added a comment - Sure Jacques, I'll take care of this. I would like to wait if nobody has any objection then I'll commit (option1) tomorrow.
        Hide
        deepak.dixit Deepak Dixit added a comment -

        Option1 has been committed.

        Here are the revision details:
        Trunk at r#1667733, 1668236
        R14.12 at r#1667736, 1668237
        R13.07 at r#1667743, 1668240
        R12.04 at r#1667745, 1668239

        Show
        deepak.dixit Deepak Dixit added a comment - Option1 has been committed. Here are the revision details: Trunk at r#1667733, 1668236 R14.12 at r#1667736, 1668237 R13.07 at r#1667743, 1668240 R12.04 at r#1667745, 1668239
        Hide
        deepak.dixit Deepak Dixit added a comment -

        Hi Jacques Le Roux,

        I tried to edit the wiki, but it seems that I don't have permission to edit the page.

        Show
        deepak.dixit Deepak Dixit added a comment - Hi Jacques Le Roux , I tried to edit the wiki , but it seems that I don't have permission to edit the page.
        Hide
        deepak.dixit Deepak Dixit added a comment -

        Thanks Jacques Le Roux now I can edit the page, wiki has been updated

        Show
        deepak.dixit Deepak Dixit added a comment - Thanks Jacques Le Roux now I can edit the page, wiki has been updated

          People

          • Assignee:
            deepak.dixit Deepak Dixit
            Reporter:
            deepak.dixit Deepak Dixit
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development