接收者类org.apache.struts2.tiles.strutstilesinitializer不能定义或继承已解决方法的实现
有人可以将我指向可能的解决方案吗?我们正在将非常旧的Struts2.3/Spring4/Hibernate4应用于 Struts 2.5.30/Hibernate 5.2.1/Spring 5.2.21 。另外,传统应用具有瓷砖 2.2.2 我们没有更改。我们将保持瓷砖2.2.2。
<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>
使用这些Maven依赖关系,应用程序启动时,我会收到以下错误:
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.
完整堆栈跟踪:
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)
根据上面的版本属性,相关的支撑杆&amp;瓷砖依赖性在下面。请注意, struts2-tiles-plugin包括,根据属性为2.5.30。 (我的理解是,还有一个更新的 struts2-tiles3-plugin ,但我不是使用它,因为我们的瓷砖保持在2.2.2。)瓷砖2.2.2哪个与支柱2.5.30不兼容?我们不想切换到图块3,因为存在很多差异(例如,UseatTribute
已更改)。
<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>
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Struts 2 Framework使用插件与Tiles Framework集成。图块2的插件是struts2 tiles-plugin,瓷砖3的插件是struts2 tiles3-plugin。您不应在
pom.xml
中定义图块的版本,因为它是从每个插件的传递依赖项中产生的。查看 this 答案具有与图块集成的示例的链接。请注意如何定义版本,
如果您在配置中分别指定图块版本,则它可能与插件依赖项中的一个版本不兼容,并且您可能已经将其忽略了以解决错误。
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 definedand
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.