我正在将现有应用升级到Struts 2.3.32
,当我将应用添加到WebSphere 7.0
服务器时,我收到以下错误。
[3/14/17 10:43:28:135 CDT] 00000032 WASSessionCor I SessionContextRegistry getSessionContext SESN0176I: Will create a new session context for application key default_hostllr
[3/14/17 10:43:28:198 CDT] 00000032 StrutsTilesLi I com.opensymphony.xwork2.util.logging.commons.CommonsLogger info Starting Struts Tiles 2 integration ...
[3/14/17 10:43:28:276 CDT] 00000032 webapp E com.ibm.ws.webcontainer.webapp.WebApp notifyServletContextCreated SRVE0283E: Exception caught while initializing context: {0}
java.lang.NullPointerException
at org.apache.tiles.util.URLUtil.getBaseTilesDefinitionURLs(URLUtil.java:54)
at org.apache.struts2.tiles.StrutsTilesContainerFactory.getSourceURLs(StrutsTilesContainerFactory.java:229)
at org.apache.tiles.factory.BasicTilesContainerFactory.createLocaleDefinitionDao(BasicTilesContainerFactory.java:298)
at org.apache.tiles.factory.BasicTilesContainerFactory.createDefinitionsFactory(BasicTilesContainerFactory.java:242)
at org.apache.tiles.factory.BasicTilesContainerFactory.createContainer(BasicTilesContainerFactory.java:104)
at org.apache.tiles.startup.AbstractTilesInitializer.createContainer(AbstractTilesInitializer.java:124)
at org.apache.tiles.startup.AbstractTilesInitializer.initialize(AbstractTilesInitializer.java:70)
at org.apache.tiles.web.startup.AbstractTilesListener.contextInitialized(AbstractTilesListener.java:62)
我已添加(或更新)到应用程序的jar文件是:
WEB-INF文件夹的lib中的所有jar文件都是:
答案 0 :(得分:0)
根据我对Aleksandr M评论的理解,我从web.xml
文件中删除了以下几行。
<context-param>
<param-name> org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
<param-value>/WEB-INF/tiles/tiles.xml,/WEB-INF/tiles/gis-tiles.xml </param-value>
</context-param>
我不再获得空指针异常。我还有其他问题正在解决,但这似乎解决了我最初提出的问题。
编辑:根据Aleksandr在此答案评论中提供的链接,我发现问题是文件WEB-INF/tiles/gis-tiles.xml
不存在,所以我将其从<param-value>
元素中删除。