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

Tiles-Plugin unable to load tiles definition XML

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.2
    • Fix Version/s: 2.5.5
    • Component/s: Plugin - Tiles
    • Labels:
      None
    • Environment:

      Microsoft Windows 7
      Oracle JDK 1.8.0_101
      Apache Tomcat 8.0.20

      Description

      We recently upgraded to struts 2.5.2. Now we have the problem that tiles is trying to load any tiles*.xml resource on the classpath for definitions, which is actually great.

      The problem occurs when the absolute path to the definitions contains spaces. For example C:/Program Files/.../webapps/context/WEB-INF/classes/tiles.xml.

      This causes:

      java.net.URISyntaxException: Illegal character in path at index 18: file:///C:/Program Files/.../webapps/context/WEB-INF/classes/tiles.xml
              at java.net.URI$Parser.fail(URI.java:2848)
              at java.net.URI$Parser.checkChars(URI.java:3021)
              at java.net.URI$Parser.parseHierarchical(URI.java:3105)
              at java.net.URI$Parser.parse(URI.java:3053)
              at java.net.URI.<init>(URI.java:588)
              at java.net.URI.create(URI.java:850)
              ... 84 more
      

      This exception is thrown at

      at java.net.URI.create(URI.java:852)
              at org.apache.struts2.tiles.StrutsWildcardServletApplicationContext.getResource(StrutsWildcardServletApplicationContext.java:105)
              at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadRawDefinitionsFromResources(CachingLocaleUrlDefinitionDAO.java:232)
              at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadRawDefinitionsFromResources(CachingLocaleUrlDefinitionDAO.java:225)
              at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadRawDefinitionsFromResources(CachingLocaleUrlDefinitionDAO.java:225)
              at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadDefinitionsFromResources(CachingLocaleUrlDefinitionDAO.java:203)
              at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadDefinitions(CachingLocaleUrlDefinitionDAO.java:192)
              at org.apache.tiles.definition.dao.ResolvingLocaleUrlDefinitionDAO.loadDefinitions(ResolvingLocaleUrlDefinitionDAO.java:68)
              at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.checkAndloadDefinitions(CachingLocaleUrlDefinitionDAO.java:174)
              at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinitions(CachingLocaleUrlDefinitionDAO.java:131)
              at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinition(CachingLocaleUrlDefinitionDAO.java:105)
              at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinition(CachingLocaleUrlDefinitionDAO.java:49)
              at org.apache.tiles.definition.UnresolvingLocaleDefinitionsFactory.getDefinition(UnresolvingLocaleDefinitionsFactory.java:89)
              at org.apache.tiles.impl.BasicTilesContainer.getDefinition(BasicTilesContainer.java:286)
              at org.apache.tiles.impl.BasicTilesContainer.isValidDefinition(BasicTilesContainer.java:273)
              at org.apache.tiles.TilesContainerWrapper.isValidDefinition(TilesContainerWrapper.java:88)
              at org.apache.tiles.impl.mgmt.CachingTilesContainer.isValidDefinition(CachingTilesContainer.java:100)
              at org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:139)
              at org.apache.struts2.result.StrutsResultSupport.execute(StrutsResultSupport.java:208)
              at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:366)
              at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:270)
      

      Looks like the spaces should be escaped with %20 maybe.

        Activity

        Hide
        lukaszlenart Lukasz Lenart added a comment -

        You can always use org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG to avoid scanning and specify definitions explicitly.

        Show
        lukaszlenart Lukasz Lenart added a comment - You can always use org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG to avoid scanning and specify definitions explicitly.
        Hide
        s.goetz Sebastian Götz added a comment - - edited

        Thanks Lukasz,

        we actually use this parameter but this does not work around the problem with the spaces in path.

        EDIT:
        Sorry that was wrong. We previously used org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG to set the path explicitly. With org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG it's loading the definitions like you told.

        Show
        s.goetz Sebastian Götz added a comment - - edited Thanks Lukasz, we actually use this parameter but this does not work around the problem with the spaces in path. EDIT: Sorry that was wrong. We previously used org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG to set the path explicitly. With org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG it's loading the definitions like you told.
        Hide
        lukaszlenart Lukasz Lenart added a comment -

        org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG is deprecated and not supported in Struts 2.5.x

        Show
        lukaszlenart Lukasz Lenart added a comment - org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG is deprecated and not supported in Struts 2.5.x
        Hide
        s.goetz Sebastian Götz added a comment -

        Understood. But for people relying on the classpath scan the problem persists.

        Show
        s.goetz Sebastian Götz added a comment - Understood. But for people relying on the classpath scan the problem persists.
        Hide
        jira-bot ASF subversion and git services added a comment -

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

        WW-4679 Handles empty space in path

        Show
        jira-bot ASF subversion and git services added a comment - Commit c570a2b2bda34632760f69e84c3877a6004c855b in struts's branch refs/heads/master from Lukasz Lenart [ https://git-wip-us.apache.org/repos/asf?p=struts.git;h=c570a2b ] WW-4679 Handles empty space in path
        Hide
        lukaszlenart Lukasz Lenart added a comment -

        Now it should be ok

        Show
        lukaszlenart Lukasz Lenart added a comment - Now it should be ok
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Jenkins build Struts-JDK7-master #526 (See https://builds.apache.org/job/Struts-JDK7-master/526/)
        WW-4679 Handles empty space in path (lukaszlenart: rev c570a2b2bda34632760f69e84c3877a6004c855b)

        • (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 #526 (See https://builds.apache.org/job/Struts-JDK7-master/526/ ) WW-4679 Handles empty space in path (lukaszlenart: rev c570a2b2bda34632760f69e84c3877a6004c855b) (edit) plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsWildcardServletApplicationContext.java

          People

          • Assignee:
            Unassigned
            Reporter:
            s.goetz Sebastian Götz
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development