Friday, March 07, 2008

Path does not start with a "/" character

Problem:
I get this error when using the tiles plugin when building out some tiles:

java.lang.IllegalArgumentException: Path .some.tiles.path does not start with a "/" character

first, lets pretend that the tile in question looks like this:
<definition name=".some.tiles.path" extends=".some.other.tiles.path"> ..some stuff.. </definition>

Solution:
ive noticed that the reason for this error can be one of the following:

1. if you look at the tile that this tile extends, and what that tile extends, until you find the tile that extends nothing, that tile should have a definition like this:
<definition name=".some.base.tile" path="/a/real/path/to/some/jsp/somejsp.jsp"> ..some stuff.. </definition>
the key thing, is that the path of the parent tile starts with a "/" character

2. if #1 is not your problem, then you might have a duplicate definition of the tile name which the error talks about.

3. Another thing that can happen is that your tiles path that you are referencing in struts-config.xml does not exist at all, because maybe you misspelled it, in which case that same error is thrown.

18 comments:

  1. You can also get this error by forgetting to include the chainConfig init-param. In the action servlet definition in web.xml, you should have:

    <init-param>
    <param-name>chainConfig</param-name>
    <param-value>org/apache/struts/tiles/chain-config.xml</param-value>
    </init-param>

    More info:
    http://struts.apache.org/1.3.8/struts-tiles/installation.html

    ReplyDelete
    Replies
    1. it worked really,thanks

      Delete
  2. This also can happen when you include files into the tile layout.

    File which has compilation error! I know this is dumb but took me 2 ours to get it...

    C:out

    ReplyDelete
  3. Jonathan you are right, I correct my problem using the information of your post. Thanks!!!

    ReplyDelete
  4. This can also happen if you misspell the name in the put tag.

    REGARDS.

    ReplyDelete
  5. can also happen if the following value param in the tiles plug-in node in web.xml is misconfigured:

    <plug-in className="org.apache.struts.tiles.TilesPlugin">
    <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" />
    </plug-in>

    ReplyDelete
  6. That error may append if you migrate from struts 1.2 to struts 1.3.
    See this URL for the solution:
    http://rajeshpg.com/2007/01/23/javaxservletservletexception-path-loginlayout-does-not-start-with-a-character/

    ReplyDelete
  7. problem solved by adding
    tiles plug-in node in web.xml.

    ReplyDelete
  8. +1 ; problem solved by adding
    tiles plug-in node in web.xml.

    ReplyDelete
  9. Hi.
    I tried all the solution that are provided in this thread for this error.... but i am still getting the same error.... i am stuck in this problem since 3 days now....deadline is near and the problem is still there..... please please help/guide/suggest..... i am using tiles...everything seems to be configgured corectly.... but still the problems is same

    ReplyDelete
  10. @Anon with deadline:
    Try stackoverflow, that website usually helps better then asking random bloggers for help

    ReplyDelete
  11. Thanks a lot for this helpful resource

    ReplyDelete
  12. Thanks a lot for this helpful resource dude....

    ReplyDelete
  13. 3rd solution works!!!!

    ReplyDelete
  14. +2
    even I was getting the same error and problem gt solved by adding

    < param name> chainConfig ...

    in Web.xml for action ..

    Thanks to Jonathan & others

    ReplyDelete
  15. Even if you have space in front of definition name also then this error will occur.
    like this

    ReplyDelete