我正在使用struts2框架开发一个网站。我试图运行代码,但后来遇到了如下错误
SEVERE: Exception sending context initialized event to listener instance of class org.apache.struts2.tiles.StrutsTilesListener
java.lang.NoClassDefFoundError: org/apache/tiles/context/TilesRequestContextFactory
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2944)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1208)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
at org.apache.tiles.jsp.context.JspTilesContextFactory.<init>(JspTilesContextFactory.java:51)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.apache.tiles.context.ChainedTilesContextFactory.init(ChainedTilesContextFactory.java:84)
at org.apache.struts2.tiles.StrutsTilesContainerFactory$StrutsTilesContextFactory.init(StrutsTilesContainerFactory.java:79)
at org.apache.struts2.tiles.StrutsTilesContainerFactory.storeContainerDependencies(StrutsTilesContainerFactory.java:55)
at org.apache.tiles.factory.TilesContainerFactory.initializeContainer(TilesContainerFactory.java:231)
at org.apache.tiles.factory.TilesContainerFactory.createTilesContainer(TilesContainerFactory.java:198)
at org.apache.tiles.factory.TilesContainerFactory.createContainer(TilesContainerFactory.java:163)
at org.apache.tiles.web.startup.TilesListener.createContainer(TilesListener.java:90)
at org.apache.struts2.tiles.StrutsTilesListener.createContainer(StrutsTilesListener.java:70)
at org.apache.tiles.web.startup.TilesListener.contextInitialized(TilesListener.java:57)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.tiles.context.TilesRequestContextFactory
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1718)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
... 31 more
这是一个404错误,但我不知道为什么,因为我包含了所有的磁贴库。具体来说,我使用struts2-core-2.1.6.jar和tiles-core-2.0.6.jar,包含构建路径并配置了tiles侦听器
<listener>
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>
更多细节:我正在使用struts-2.3.16.1库并包含
tiles-api-2.1.2.jar
tiles-compat-3.0.1.jar
tiles-core-2.0.6.jar
tiles-jsp-2.1.2.jar
tiles-servlet-3.0.1.jar
commons-beanutils-1.8.0.jar
commons-digester-2.0.jar
struts2-tiles-plugin-2.3.16.1.jar
在WEB-INF / lib
中