Search code examples
javaspring-mvcstruts2apache-tilesspring-framework-beans

java.lang.NoSuchMethodError: 'void org.apache.tiles.evaluator.el.ELAttributeEvaluator.setApplicationContext(org.apache.tiles.TilesApplicationContext)'


We have a project where we are using tilesConfigurer to create the pages.

servlet.xml

<bean id="tilesViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
      <property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView"/>
    </bean>

    <bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer" >
        <property name="definitions">
            <list>
                <value>/WEB-INF/tiles-defs.xml</value>
            </list>
        </property>
    </bean>

We are using spring-webmvc-3.2.18.Release and org.springframework.web.struts-3.1.0.Release jars

While updating the Struts to 6.3.0.2, we are getting this error

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tilesConfigurer' defined in ServletContext resource [/WEB-INF/esextn-dispatcherservlet.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: 'void org.apache.tiles.evaluator.el.ELAttributeEvaluator.setApplicationContext(org.apache.tiles.TilesApplicationContext)'

Please help on what libraries to be used here


Solution

  • Since Struts 6.3.0 the Tiles project is integrated to Struts 2 tiles plugin. If you have old tiles jar dependencies then it should e removed from the classpath. Because you are using a deprecated API for Tiles 2.2.

    Tiles reintroduced into Struts

    The history has come full circle, as the Struts team decided to reintegrate the Tiles source code into the Struts Tiles plugin. This effort took place in Struts version 6.3.0, and now you can fully enjoy having Tiles up to date and supported.