[ https://issues.apache.org/struts/browse/WW-2897?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45064#action_45064 ]
careprad commented on WW-2897: ------------------------------ we have resolved this problem,the root cause is the StrutsTilesListener,we have retrotranslate all the relevant library files,but the StrutsTilesListener did not work,so we change the code by ourself,this is the class: public class MyStrutsTilesListener implements ServletContextListener { /** * Log instance. */ protected static final Log LOG = LogFactory.getLog(MyStrutsTilesListener.class); private static final Map INIT; static { INIT = new HashMap(); INIT.put(TilesContainerFactory.CONTAINER_FACTORY_INIT_PARAM, StrutsTilesContainerFactory.class.getName()); } /** * Initialize the TilesContainer and place it * into service. * * @param event The intercepted event. */ public void contextInitialized(ServletContextEvent event) { ServletContext servletContext = event.getServletContext(); try { TilesContainer container = createContainer(servletContext); TilesAccess.setContainer(servletContext, container); } catch (TilesException e) { throw new IllegalStateException("Unable to instantiate container."); } } /** * Remove the tiles container from service. * * @param event The intercepted event. */ public void contextDestroyed(ServletContextEvent event) { ServletContext servletContext = event.getServletContext(); try { TilesAccess.setContainer(servletContext, null); } catch (TilesException e) { LOG.warn("Unable to remove tiles container from service."); } } /** * Creates a Tiles container. * * @param context The servlet context to use. * @return The created container * @throws TilesException If something goes wrong during creation. */ protected TilesContainer createContainer(ServletContext context) throws TilesException { if(context.getInitParameter(TilesContainerFactory.CONTEXT_FACTORY_INIT_PARAM) == null) { context = decorate(context); } else { LOG.warn("Tiles container factory is explicitly set. Not injecting struts configuration."); } TilesContainerFactory factory = TilesContainerFactory.getFactory(context); return factory.createContainer(context); } protected ServletContext decorate(ServletContext context) { return new ConfiguredServletContext(context, INIT); } } as you see,there is no other code,but it just work,we still did not know how it can do it!! I must to point out our environment is wsad5,so its jdk is 14 implemented by ibm,we retrotranslate the jar file with classpath=%wasruntime%/core.jar.I think this is the right way. But this problem cost our 2 days to resolve it.I am disappointed to the struts2(this problem is one of the reason but not the only!). > org.apache.struts2.tiles.StrutsTilesListener do not work > -------------------------------------------------------- > > Key: WW-2897 > URL: https://issues.apache.org/struts/browse/WW-2897 > Project: Struts 2 > Issue Type: Bug > Components: Plugin - Tiles > Affects Versions: 2.0.11.2 > Environment: websphere6.0 (jdk1.42),all the referenced jar is in the > struts-2.0.11.2-all.zip downloaded from the official site. > Reporter: careprad > Priority: Blocker > > first of all,the reason is the exception on ServletDispatcherResult.doExecute: > setLocation(location); > javax.servlet.ServletContext servletContext = > ServletActionContext.getServletContext(); > TilesContainer container = > TilesAccess.getContainer(servletContext); //here get null > container > javax.servlet.http.HttpServletRequest request = > ServletActionContext.getRequest(); > javax.servlet.http.HttpServletResponse response = > ServletActionContext.getResponse(); > container.render(location, new Object[] {request, response}); > //here will throw the null pointer exception > I traced the exception in the StrutsTilesListener ,it do not work at all,I > suppose it is the static initialize method work in error: > INIT.put( > "org.apache.tiles.factory.TilesContainerFactory", > > (class$org$apache$struts2$tiles$StrutsTilesContainerFactory == null > && > (class$org$apache$struts2$tiles$StrutsTilesContainerFactory = > (new > StrutsTilesContainerFactory[0]).getClass().getComponentType()) > == null > ? > class$org$apache$struts2$tiles$StrutsTilesContainerFactory > : > class$org$apache$struts2$tiles$StrutsTilesContainerFactory) > .getName()); > this code is what I can't understand!and How can I get the source code of the > pluggin? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.