Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4786

Upgrade from struts2-tiles3-plugin to struts2-tiles-plugin gives a NoSuchDefinitionException

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.5.10
    • Fix Version/s: 2.5.12
    • Component/s: Plugin - Tiles
    • Labels:
      None
    • Environment:
      • Java 8
      • Tested with Tomcat Versions 6.0.47, 7.0.72 and 9.0.0.M13
      • Windows 10

      Description

      When upgrading from struts2-tiles3-plugin to struts2-tiles-plugin
      (corresponding to https://struts.apache.org/docs/tiles-plugin.html)
      tiles3 is not working anymore. It provides a NoSuchDefinitionException.
      This behaviour only appears on Windows-Systems. On Linux the same Application (same sourcecode, same Java, same Tomcat) is just working fine.

      Workaround:
      There is an easy workaround. On Windows 10 the struts2-tiles-plugin is working fine when defining the config by hand.

      <context-param>
      <param-bame>org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG</param-name>
      <param-value>
      /WEB-INF/tiles-1.xml,
      /WEB-INF/tiles-2.xml,
      /WEB-INF/tiles-3.xml,
      /WEB-INF/tiles-4.xml
      </param-value>
      </context-param>
      

        Activity

        Hide
        raw Ralph Wetter added a comment -

        Log-Files with Log-Level Trace on org-apache.struts2.tiles
        One Log shows the error, the other Log shows the workaround (defining tiles.xml by hand).

        Show
        raw Ralph Wetter added a comment - Log-Files with Log-Level Trace on org-apache.struts2.tiles One Log shows the error, the other Log shows the workaround (defining tiles.xml by hand).
        Hide
        lukaszlenart Lukasz Lenart added a comment -

        This is strange as the definition file was found

        2017-04-17 14:38:04,078 TRACE [RMI TCP Connection(4)-127.0.0.1] tiles.StrutsWildcardServletApplicationContext (StrutsWildcardServletApplicationContext.java:131) - Found resources [Resource /C:/Users/Ralph Wetter/mySources/pvs2/target/pvs-2.4/WEB-INF/tiles.xml at file:/C:/Users/Ralph Wetter/mySources/pvs2/target/pvs-2.4/WEB-INF/tiles.xml] for path tiles*.xml
        [RMI TCP Connection(4)-127.0.0.1] INFO org.apache.tiles.access.TilesAccess - Publishing TilesContext for context: org.apache.struts2.tiles.StrutsWildcardServletApplicationContext
        

        I wonder if it's an issue with a space, " ", in the path, could you check if the same happens when you try to start the project from a directory without a " "?

        Show
        lukaszlenart Lukasz Lenart added a comment - This is strange as the definition file was found 2017-04-17 14:38:04,078 TRACE [RMI TCP Connection(4)-127.0.0.1] tiles.StrutsWildcardServletApplicationContext (StrutsWildcardServletApplicationContext.java:131) - Found resources [Resource /C:/Users/Ralph Wetter/mySources/pvs2/target/pvs-2.4/WEB-INF/tiles.xml at file:/C:/Users/Ralph Wetter/mySources/pvs2/target/pvs-2.4/WEB-INF/tiles.xml] for path tiles*.xml [RMI TCP Connection(4)-127.0.0.1] INFO org.apache.tiles.access.TilesAccess - Publishing TilesContext for context: org.apache.struts2.tiles.StrutsWildcardServletApplicationContext I wonder if it's an issue with a space, " ", in the path, could you check if the same happens when you try to start the project from a directory without a " "?
        Hide
        raw Ralph Wetter added a comment - - edited

        Bingo! That's the issue. The test without a space in the path is successfull (see log). So the "wildcard-feature" is only working when there is no space in the path. If you have a space in the path, defining the config by hand is needed.
        I also checked that behaviour on linux. And I'm happy to say that also on linux the NoSuchDefinitionException is thrown when there is a space in the path.

        Show
        raw Ralph Wetter added a comment - - edited Bingo! That's the issue. The test without a space in the path is successfull (see log). So the "wildcard-feature" is only working when there is no space in the path. If you have a space in the path, defining the config by hand is needed. I also checked that behaviour on linux. And I'm happy to say that also on linux the NoSuchDefinitionException is thrown when there is a space in the path.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 9d4aac0589306e677c36a732c1c34c1da75304be in struts's branch refs/heads/master from Lukasz Lenart
        [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=9d4aac0 ]

        WW-4786 Properly handles empty spaces in path

        Show
        jira-bot ASF subversion and git services added a comment - Commit 9d4aac0589306e677c36a732c1c34c1da75304be in struts's branch refs/heads/master from Lukasz Lenart [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=9d4aac0 ] WW-4786 Properly handles empty spaces in path
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Jenkins build Struts-JDK7-master #617 (See https://builds.apache.org/job/Struts-JDK7-master/617/)
        WW-4786 Properly handles empty spaces in path (lukaszlenart: rev 9d4aac0589306e677c36a732c1c34c1da75304be)

        • (edit) plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsApplicationResource.java
        • (edit) plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsWildcardServletApplicationContext.java
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build Struts-JDK7-master #617 (See https://builds.apache.org/job/Struts-JDK7-master/617/ ) WW-4786 Properly handles empty spaces in path (lukaszlenart: rev 9d4aac0589306e677c36a732c1c34c1da75304be) (edit) plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsApplicationResource.java (edit) plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsWildcardServletApplicationContext.java

          People

          • Assignee:
            lukaszlenart Lukasz Lenart
            Reporter:
            raw Ralph Wetter
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development