Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.0
    • Fix Version/s: 1.2.0
    • Component/s: Web
    • Labels:
      None

      Description

      I have web application that uses Shiro version 1.2.0-SNAPSHOT with Shiro.ini file on classpath. The application stopped to load ini file and returns an error:

      There is no servlet context resource corresponding to configPath '/classpath:Shiro.ini' If the resource is located elsewhere (not immediately resolveable in the servlet context), specify an appropriate classpath:, url:, or file: resource prefix accordingly.

      Extract of my Web.xml:
      <filter>
      <filter-name>ShiroFilter</filter-name>
      <filter-class>org.apache.shiro.web.servlet.IniShiroFilter</filter-class>
      <init-param>
      <param-name>configPath</param-name>
      <param-value>classpath:Shiro.ini</param-value>
      </init-param>
      </filter>

        Activity

        Hide
        Les Hazlewood added a comment -

        I removed the call to WebUtils.normalize. The path value is specified by a developer configuring Shiro, not an application end user; if the url the dev specifies is invalid, startup will fail fast showing what went wrong - no need to 'sanitize' developer configuration input in this case.

        Show
        Les Hazlewood added a comment - I removed the call to WebUtils.normalize. The path value is specified by a developer configuring Shiro, not an application end user; if the url the dev specifies is invalid, startup will fail fast showing what went wrong - no need to 'sanitize' developer configuration input in this case.
        Hide
        Les Hazlewood added a comment -

        Great catch Maria - thanks again. I'll have to add this to the test cases before resolving the issue.

        Show
        Les Hazlewood added a comment - Great catch Maria - thanks again. I'll have to add this to the test cases before resolving the issue.
        Hide
        Maria Jurcovicova added a comment -

        The reason seems to be following code in IniShiroFilter:

        public void setConfigPath(String configPath) {
        String path = StringUtils.clean(configPath);
        if (path != null)

        { path = WebUtils.normalize(path); }

        this.configPath = path;
        }

        the line path = WebUtils.normalize(path); converts 'classpath:Shiro.ini' into '/classpath:Shiro.ini'. Prefix '/' cause problem later in Ini convertPathToIni(String path) method on line 337.

        Show
        Maria Jurcovicova added a comment - The reason seems to be following code in IniShiroFilter: public void setConfigPath(String configPath) { String path = StringUtils.clean(configPath); if (path != null) { path = WebUtils.normalize(path); } this.configPath = path; } the line path = WebUtils.normalize(path); converts 'classpath:Shiro.ini' into '/classpath:Shiro.ini'. Prefix '/' cause problem later in Ini convertPathToIni(String path) method on line 337.

          People

          • Assignee:
            Les Hazlewood
            Reporter:
            Maria Jurcovicova
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development