Could someone point me to a possible solution? We're migrating a really old Struts2.3/Spring4/Hibernate4 application to Struts 2.5.30 / Hibernate 5.2.1 / Spring 5.2.21. Also, the legacy app had Tiles 2.2.2 which we haven't changed. We're keeping Tiles 2.2.2 as is.

<properties>
    <log4j.version>2.17.2</log4j.version>
    <java.version>11</java.version>
    <finalName>oar</finalName>
    <spring.version>5.2.21.RELEASE</spring.version>
    <hibernate.version>5.2.1.Final</hibernate.version>
    <struts.version>2.5.30</struts.version>
    <tiles.version>2.2.2</tiles.version>
</properties>

With these Maven dependencies, when the app launches, I get the following error:

java.lang.AbstractMethodError: Receiver class org.apache.struts2.tiles.StrutsTilesInitializer
   does not define or inherit an implementation of the resolved method 'abstract
   org.apache.tiles.factory.AbstractTilesContainerFactory 
   createContainerFactory(org.apache.tiles.TilesApplicationContext)' 
   of abstract class org.apache.tiles.startup.AbstractTilesInitializer.

Full stack trace:

java.lang.AbstractMethodError: Receiver class org.apache.struts2.tiles.StrutsTilesInitializer does not define or inherit an implementation of the resolved method 'abstract org.apache.tiles.factory.AbstractTilesContainerFactory createContainerFactory(org.apache.tiles.TilesApplicationContext)' of abstract class org.apache.tiles.startup.AbstractTilesInitializer.
    at org.apache.tiles.startup.AbstractTilesInitializer.createContainer(AbstractTilesInitializer.java:123)
    at org.apache.tiles.startup.AbstractTilesInitializer.initialize(AbstractTilesInitializer.java:70)
    at org.apache.tiles.web.startup.AbstractTilesListener.contextInitialized(AbstractTilesListener.java:62)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4753)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5215)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)

Per the Version Properties above, the relevant Struts & Tiles dependencies are below. Note that struts2-tiles-plugin is included, with the version as per the property, 2.5.30. (My understanding is that there's also a newer struts2-tiles3-plugin but I'm not using that, since our Tiles is kept at 2.2.2.) Could the problem actually be that we're keeping Tiles 2.2.2 which is incompatible with Struts 2.5.30? We don't want to switch to Tiles 3, because there are a lot of differences (e.g., useAttribute has changed).

    <dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts2-core</artifactId>
        <version>${struts.version}</version>
    </dependency>

    <dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts2-json-plugin</artifactId>
        <version>${struts.version}</version>
    </dependency>

    <dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts2-spring-plugin</artifactId>
        <version>${struts.version}</version>
    </dependency>
    
    <dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts2-tiles-plugin</artifactId>
        <version>${struts.version}</version>
    </dependency>
            
    <dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts2-convention-plugin</artifactId>
        <version>${struts.version}</version>
    </dependency>
    
    <dependency>
        <groupId>com.jgeppert.struts2.jquery</groupId>
        <artifactId>struts2-jquery-plugin</artifactId>
        <version>4.0.3</version>
    </dependency>
            
    <dependency>
        <groupId>com.jgeppert.struts2.bootstrap</groupId>
        <artifactId>struts2-bootstrap-plugin</artifactId>
        <version>2.5.2</version>
    </dependency>
    
    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-api</artifactId>
        <version>${tiles.version}</version>
    </dependency>
    
    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-core</artifactId>
        <version>${tiles.version}</version>
    </dependency>
    
    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-el</artifactId>
        <version>${tiles.version}</version>
    </dependency>
    
    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-freemarker</artifactId>
        <version>${tiles.version}</version>
    </dependency>
    
    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-jsp</artifactId>
        <version>${tiles.version}</version>
    </dependency>
    
    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-ognl</artifactId>
        <version>${tiles.version}</version>
    </dependency>
    
    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-servlet</artifactId>
        <version>${tiles.version}</version>
    </dependency>
            
    <dependency>
        <groupId>org.apache.tiles</groupId>
        <artifactId>tiles-template</artifactId>
        <version>${tiles.version}</version>
    </dependency>
1

There are 1 best solutions below

0
On

The Struts 2 framework used a plugin for integration with Tiles framework. The plugin for Tiles 2 is struts2-tiles-plugin and for Tiles 3 is struts2-tiles3-plugin. You should not define the version of Tiles in your pom.xml because it is incurred from the transitive dependencies for each plugin. Look at this answer which has links to examples with the Tiles integration. Note how the version is defined

<struts2.version>6.0.0-RC3</struts2.version>

and

<dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-tiles-plugin</artifactId>
            <version>${struts2.version}</version>
        </dependency>

If you specify Tiles version separately in your configuration, it can be incompatible with one from the plugin dependencies and you have probably exlude it to resolve the error.