Search code examples
struts2tileswebsphere-7

Upgrading to Struts 2.3.32. Getting null pointer exception with getBaseTilesDefinitionURLs


I am upgrading an existing App to Struts 2.3.32 and when I add the App to a WebSphere 7.0 server I get the following error.

 [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)

The jar files I have added (or updated) to the app are:

New or replacement Jars

All of the jar files in the lib of the WEB-INF folder are:

enter image description here


Solution

  • Per my understanding of Aleksandr M's comment I removed the following lines from my web.xml file.

    <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>
    

    I no longer get the null pointer exception. I have other issues which I am working through but this appears to have fixed the issue I originally asked about.

    EDIT: Based on the link provided by Aleksandr in the comment on this answer, I figured out the issue was the file WEB-INF/tiles/gis-tiles.xml did not exist so I removed it from the <param-value> element.