Can not find the tag library descriptor for tiles when using Maven
Asked Answered
C

3

6

Here is my config in web.xml file

<listener>
    <listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>

<filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>

<filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

Here is the config in pom.xml

    <dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts2-core</artifactId>
        <version>2.2.1</version>
    </dependency>

    <dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts2-spring-plugin</artifactId>
        <version>2.2.1</version>
    </dependency>

    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-jsp</artifactId>
        <version>2.2.2</version>
        <type>pom</type>
        <scope>compile</scope>
    </dependency>

It keeps saying this: Can not find the tag library descriptor for "http://struts.apache.org/tags-tiles" when I add taglib into layout:

<%@ taglib prefix="tiles" uri="http://struts.apache.org/tags-tiles"%>

And when I run on server:

SEVERE: Error configuring application listener of class org.apache.struts2.tiles.StrutsTilesListener

Did I miss something here?

Comus answered 13/5, 2011 at 8:3 Comment(1)
Perhaps you have the same problem listed in struts.1045723.n5.nabble.com/…Gratuitous
C
4

Thanks to Kenny Lee I found out the solution for this one after weeks :(( You’ll need to configure your eclipse project settings by:

  1. Right click on the project in eclipse on the left panel under the package explorer view.
  2. Click Java EE Module Dependencies.
  3. Check (make sure the checkbox is ticked) the Maven Dependencies option (the last option).

For Eclipse 3.6 Click Here for more information

Sometimes after configuration you have to refresh the project or use mvn clean and mvn install and it will do the tricks

Comus answered 29/6, 2011 at 12:0 Comment(0)
A
0

your web.xml is missing the taglib declaration:

<taglib>
  <taglib-uri>
    http://struts.apache.org/tags-tiles
  </taglib-uri>
  <taglib-location>
    /WEB-INF/tags-tiles.tld
  </taglib-location>
</taglib>
Anacrusis answered 15/5, 2011 at 5:50 Comment(1)
Thanks, but I use Tiles definitions defined in a centralized file. :(Comus
T
0

How about using the dependency versions as specified in this example to see if it works?

As answered in your related question, it looks like struts2-tiles dependency is required and maybe you do not need struts2-spring-plugin.

Tucky answered 19/5, 2011 at 3:2 Comment(1)
Thanks for your reply, as you can see in my related question, after I added struts2-tiles-plugin, I still got java.lang.ClassNotFoundException: org.apache.struts2.tiles.StrutsTilesListener :(Comus

© 2022 - 2024 — McMap. All rights reserved.