由于Struts1.x中存在安全问题,我们正在将一个旧应用程序迁移到Struts2.5.26。在测试时,我注意到tiles在服务器启动时抛出了一个异常。
SEVERE: Exception sending context initialized event to listener instance of class org.apache.struts2.tiles.StrutsTilesListener
java.lang.AbstractMethodError: org.apache.tiles.startup.AbstractTilesInitializer.createContainerFactory(Lorg/apache/tiles/TilesApplicationContext;)Lorg/apache/tiles/factory/AbstractTilesContainerFactory;
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:4992)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5490)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1083)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1880)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Apr 21, 2021 8:21:29 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
我们在web.xml中有以下内容
<context-param>
<param-name>tilesDefinitions</param-name>
<param-value>/WEB-INF/tiles-defs.xml</param-value>
</context-param>
<listener>
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>
在web inf/lib文件夹中有以下jar
-rw-r--r-- 1 ryk6mkj 1049089 21175 Apr 20 15:21 tiles-el-2.2.2.jar
-rw-r--r-- 1 ryk6mkj 1049089 161001 Apr 20 15:22 tiles-core-2.2.2.jar
-rw-r--r-- 1 ryk6mkj 1049089 50740 Apr 20 15:22 tiles-jsp-2.2.2.jar
-rw-r--r-- 1 ryk6mkj 1049089 59739 Apr 20 15:22 tiles-servlet-2.2.2.jar
-rw-r--r-- 1 ryk6mkj 1049089 24466 Apr 20 15:22 tiles-template-2.2.2.jar
-rw-r--r-- 1 ryk6mkj 1049089 35898 Apr 20 15:22 tiles-api-2.2.2.jar
-rw-r--r-- 1 ryk6mkj 1049089 71270 Apr 20 15:36 tiles-request-api-1.0.0.jar
-rw-r--r-- 1 ryk6mkj 1049089 32629 Apr 20 15:54 tiles-portlet-2.2.2.jar
我在AbstractTileInitializer.java类中看到createcontainerfactory()方法是抽象的。不确定它为什么不使用StrutsTileInitializer.java或其他实现?
有什么线索说明为什么会这样吗?
暂无答案!
目前还没有任何答案,快来回答吧!