[ https://issues.apache.org/jira/browse/WW-4904?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lukasz Lenart updated WW-4904: ------------------------------ Fix Version/s: 6.8.0 (was: 6.7.1) > Support for cross context request processing > --------------------------------------------- > > Key: WW-4904 > URL: https://issues.apache.org/jira/browse/WW-4904 > Project: Struts 2 > Issue Type: Improvement > Components: Dispatch Filter > Affects Versions: 2.3.34 > Environment: Wildlfy 10.1.0 > Struts 2.3.34 > JDK 1.8.0_151 > Reporter: Prasanth > Priority: Minor > Fix For: 6.8.0 > > > When a request is forwarded from one context to another (both using struts2) > {code:java} > ServletContext sContext = context.getContext("/context2"); > RequestDispatcher rd = sContext.getRequestDispatcher(resource); > rd.forward(request, response); > {code} > you get a {{ClassCastException}}. Both the projects has their own struts jars > (in WEB-INF/lib folder). > {noformat} > Caused by: java.lang.ClassCastException: > org.apache.struts2.dispatcher.mapper.ActionMapping cannot be cast to > org.apache.struts2.dispatcher.mapper.ActionMapping > at > org.apache.struts2.dispatcher.ng.PrepareOperations.findActionMapping(PrepareOperations.java:163) > at > org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:92) > at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) > at > io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) > at > io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84) > at > io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) > at > io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) > at > io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) > at > io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) > at > io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) > at > io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:274) > at > io.undertow.servlet.handlers.ServletInitialHandler.dispatchToPath(ServletInitialHandler.java:209) > at > io.undertow.servlet.spec.RequestDispatcherImpl.forwardImpl(RequestDispatcherImpl.java:221) > ... 128 more > {noformat} > To make it work you have to have a filter (before struts2 filter) in the > application that is receiving the request and have the below two lines. > {code:java} > request.setAttribute("struts.actionMapping", new ActionMapping()); > request.setAttribute("struts.valueStack", null); > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)