You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by Ali Ok <al...@gmail.com> on 2007/07/31 18:14:00 UTC

Tiles configuration problem, NoSuchDefinitionException

Hi,
I tried the example from tutorials. But it didnt work.

Here is my web.xml
...

<servlet-name>tiles</servlet-name>
      <servlet-class>org.apache.tiles.web.startup.TilesServlet
</servlet-class>
        <init-param>
            <param-name>
org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
            <param-value>/WEB-INF/tiles-defs.xml
,/org/apache/tiles/classpath-defs.xml</param-value>
        </init-param>
        <load-on-startup>2</load-on-startup>
    </servlet>

    <filter>
        <filter-name>Tiles Filter</filter-name>
        <filter-class>
            org.apache.tiles.web.startup.TilesFilter
        </filter-class>
        <init-param>
            <param-name>
org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
            </param-name>
            <param-value>
                /WEB-INF/tiles-defs.xml,/org/apache/tiles/classpath-defs.xml
            </param-value>
        </init-param>
    </filter>


    <filter-mapping>
        <filter-name>Tiles Filter</filter-name>
        <url-pattern>*</url-pattern>
   <!-- <url-pattern>/*</url-pattern>
------------------------------------line 1------------  -->
        <!-- <servlet-name>tiles</servlet-name>
------------------------------------line 2------------  -->
        <dispatcher>REQUEST</dispatcher>
    </filter-mapping

    <context-param>
        <param-name>
            org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
        </param-name>
        <param-value>
            /WEB-INF/tiles-defs.xml,/org/apache/tiles/classpath-defs.xml
        </param-value>
    </context-param>

    <listener>
        <listener-class>
            org.apache.tiles.web.startup.TilesListener
        </listener-class>
    </listener>
...
...

I created tiles-defs.xml exactly same with tutorial.

...
<definition name="myapp.homepage" template="/layouts/classic.jsp">
...

And my jsp file,

...
<tiles:insertDefinition name="myapp.homepage" flush="false"/>
<!--<tiles:insertDefinition name="myapp.homepage"/>
-----------------------------line 3--------------  -->
...

This configuration and code throws java.lang.IllegalArgumentException:
Filter mapping must specify either a <url-pattern> or a <servlet-name>

I think configuration given in the tutorial is wrong, filter mapping's
url-pattern cannot be *, it can be /* (line 1).
When I change it to /* , this time
org.apache.tiles.definition.NoSuchDefinitionException: myapp.homepage is
thrown.

I also tried writing <servlet-name> attribute of filtermapping(line 2),
again the same exception is thrown.

line 3 is also tried, same exception again...

So, what do you think the problem is?
I use JSF 1.2, MyFaces Tomahawk 1.1.6, RichFaces 3.0.1, Tiles 2.0.4 on
Tomcat 6.0 server. But the problem is not caused by these, everything was
working fine before Tiles.

Any suggestions???

Re: Tiles configuration problem, NoSuchDefinitionException

Posted by Antonio Petrelli <an...@gmail.com>.
2007/8/1, Ali Ok <al...@gmail.com>:
>
> Sorry for repetition.
>
> But I couldnt understand where is the problem.



What exactly don't you understand? I can't understand you :-)

Antonio

Re: Tiles configuration problem, NoSuchDefinitionException

Posted by Ali Ok <al...@gmail.com>.
I will try it, thank you very much... ^^

2007/8/1, Antonio Petrelli <an...@gmail.com>:
>
> 2007/8/1, Ali Ok <al...@gmail.com>:
> >
> > I dont have /org/apache/tiles/classpath-defs.xml .
> >
> > Is it necessary?
>
>
>
> No, so remove it...
>

Re: Tiles configuration problem, NoSuchDefinitionException

Posted by Antonio Petrelli <an...@gmail.com>.
2007/8/1, Ali Ok <al...@gmail.com>:
>
> I dont have /org/apache/tiles/classpath-defs.xml .
>
> Is it necessary?



No, so remove it...

Re: Tiles configuration problem, NoSuchDefinitionException

Posted by Ali Ok <al...@gmail.com>.
I dont have /org/apache/tiles/classpath-defs.xml .

Is it necessary?

2007/8/1, Antonio Petrelli <an...@gmail.com>:
>
> 2007/8/1, Ali Ok <al...@gmail.com>:
> >
> > Thanks for your help first of all...
> >
> > NoSuchDefinitionException is thrown when I try to insert.
> > You saw my web.xml and tiles-defs.xml.
> >
> > I cant understand why exception is thrown?
>
>
>
> Ok, what I suppose is that the Tiles definitions loading did not happen,
> or
> it happened with errors.
> One problem in your web.xml is the use of both TilesFilter and
> TilesListener, when, in fact, you need either one or the other.
> Moreover, your problem could be the presence of both:
> /WEB-INF/tiles-defs.xml
> and
> /org/apache/tiles/classpath-defs.xml
> Have you got both of these files?
>
> Antonio
>

Re: Tiles configuration problem, NoSuchDefinitionException

Posted by Antonio Petrelli <an...@gmail.com>.
2007/8/1, Ali Ok <al...@gmail.com>:
>
> Thanks for your help first of all...
>
> NoSuchDefinitionException is thrown when I try to insert.
> You saw my web.xml and tiles-defs.xml.
>
> I cant understand why exception is thrown?



Ok, what I suppose is that the Tiles definitions loading did not happen, or
it happened with errors.
One problem in your web.xml is the use of both TilesFilter and
TilesListener, when, in fact, you need either one or the other.
Moreover, your problem could be the presence of both:
/WEB-INF/tiles-defs.xml
and
/org/apache/tiles/classpath-defs.xml
Have you got both of these files?

Antonio

Re: Tiles configuration problem, NoSuchDefinitionException

Posted by Ali Ok <al...@gmail.com>.
Thanks for your help first of all...

NoSuchDefinitionException is thrown when I try to insert.
You saw my web.xml and tiles-defs.xml.

I cant understand why exception is thrown?

2007/8/1, Ali Ok <al...@gmail.com>:
>
> Sorry for repetition.
>
> But I couldnt understand where is the problem.
>
> 2007/8/1, Antonio Petrelli <an...@gmail.com>:
> >
> > 2007/7/31, Ali Ok <al...@gmail.com>:
> > >
> > > No.
> > >
> > > If mapping url-pattern is *, then throws
> > > java.lang.IllegalArgumentException:
> > > Filter mapping must specify either a <url-pattern> or a <servlet-name>
> > is
> > > thrown.
> >
> >
> >
> > As I wrote before, this is a mistake I made, and I already thanked you.
> > The problem is that "NoSuchDefinitionException" that you got when you
> > used
> > <tiles:insertDefinition>.
> > Anyway, I saw that you used TilesFilter and TilesListener at the same
> > time:
> > you should use one or the other, though I don't think this is the
> > problem.
> >
> > Antonio
> >
>
>

Re: Tiles configuration problem, NoSuchDefinitionException

Posted by Ali Ok <al...@gmail.com>.
Sorry for repetition.

But I couldnt understand where is the problem.

2007/8/1, Antonio Petrelli <an...@gmail.com>:
>
> 2007/7/31, Ali Ok <al...@gmail.com>:
> >
> > No.
> >
> > If mapping url-pattern is *, then throws
> > java.lang.IllegalArgumentException:
> > Filter mapping must specify either a <url-pattern> or a <servlet-name>
> is
> > thrown.
>
>
>
> As I wrote before, this is a mistake I made, and I already thanked you.
> The problem is that "NoSuchDefinitionException" that you got when you used
> <tiles:insertDefinition>.
> Anyway, I saw that you used TilesFilter and TilesListener at the same
> time:
> you should use one or the other, though I don't think this is the problem.
>
> Antonio
>

Re: Tiles configuration problem, NoSuchDefinitionException

Posted by Antonio Petrelli <an...@gmail.com>.
2007/7/31, Ali Ok <al...@gmail.com>:
>
> No.
>
> If mapping url-pattern is *, then throws
> java.lang.IllegalArgumentException:
> Filter mapping must specify either a <url-pattern> or a <servlet-name> is
> thrown.



As I wrote before, this is a mistake I made, and I already thanked you.
The problem is that "NoSuchDefinitionException" that you got when you used
<tiles:insertDefinition>.
Anyway, I saw that you used TilesFilter and TilesListener at the same time:
you should use one or the other, though I don't think this is the problem.

Antonio

Re: Tiles configuration problem, NoSuchDefinitionException

Posted by Ali Ok <al...@gmail.com>.
No.

If mapping url-pattern is *, then throws java.lang.IllegalArgumentException:
Filter mapping must specify either a <url-pattern> or a <servlet-name> is
thrown.

Did anybody tried the example from tutorial? Or can you send me your web.xml,
tiles-defs.xml files and some sample code using <tiles:insertDefinition>
tag?

2007/7/31, Antonio Petrelli <an...@gmail.com>:
>
> 2007/7/31, Ali Ok <al...@gmail.com>:
> > I think configuration given in the tutorial is wrong, filter mapping's
> > url-pattern cannot be *, it can be /* (line 1).
>
> Well thanks a lot! It will be fixed ASAP.
>
> > When I change it to /* , this time
> > org.apache.tiles.definition.NoSuchDefinitionException: myapp.homepage is
> > thrown.
>
> This is strange: do you see any Tiles error at startup of your
> application?
>
> Antonio
>

Re: Tiles configuration problem, NoSuchDefinitionException

Posted by Antonio Petrelli <an...@gmail.com>.
2007/7/31, Ali Ok <al...@gmail.com>:
> I think configuration given in the tutorial is wrong, filter mapping's
> url-pattern cannot be *, it can be /* (line 1).

Well thanks a lot! It will be fixed ASAP.

> When I change it to /* , this time
> org.apache.tiles.definition.NoSuchDefinitionException: myapp.homepage is
> thrown.

This is strange: do you see any Tiles error at startup of your application?

Antonio