Discussion:
java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping
Prasanth Pasala
2017-12-14 22:46:47 UTC
Permalink
Hi,

I am trying to forward the request to another action that is present in a different context. It works in struts1 but when trying in struts 2.3.34 I am getting a class cast exception. Both the projects
(contexts) have the same version of struts2.

ServletContext sContext = context.getContext("/context2");
RequestDispatcher rd = sContext.getRequestDispatcher(resource);
rd.forward(request, response);

Thanks,
Prasanth

Exception: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping cannot be cast to org.apache.struts2.dispatcher.mapper.ActionMapping
at io.undertow.servlet.spec.ServletContextImpl.invokeAction(ServletContextImpl.java:888
at io.undertow.servlet.spec.RequestDispatcherImpl.forwardImplSetup(RequestDispatcherImpl.java:134
at io.undertow.servlet.spec.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:111
at com.mypackage.LoginAction.execute(LoginAction.java:139
at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43
at java.lang.reflect.Method.invoke(Method.java:498
at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:897
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1299
at ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68
at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo(XWorkMethodAccessor.java:117
at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethod(XWorkMethodAccessor.java:108
at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:1375
at ognl.ASTMethod.getValueBody(ASTMethod.java:91
at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212
at ognl.SimpleNode.getValue(SimpleNode.java:258
at ognl.Ognl.getValue(Ognl.java:470
at ognl.Ognl.getValue(Ognl.java:434
at com.opensymphony.xwork2.ognl.OgnlUtil$3.execute(OgnlUtil.java:362
at com.opensymphony.xwork2.ognl.OgnlUtil.compileAndExecuteMethod(OgnlUtil.java:414
at com.opensymphony.xwork2.ognl.OgnlUtil.callMethod(OgnlUtil.java:360
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:430
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:290
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:251
at org.apache.struts2.interceptor.DeprecationInterceptor.intercept(DeprecationInterceptor.java:41
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245
at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:168
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:76
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:229
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:229
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245
at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245
at org.apache.struts2.interceptor.DateTextFieldInterceptor.intercept(DateTextFieldInterceptor.java:125
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:253
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245
at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245
at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:140
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245
at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:245
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:575
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99
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 org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43
at io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:53
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64
at io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:59
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77
at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43
at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61
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.handleFirstRequest(ServletInitialHandler.java:292
at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:805
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624
at java.lang.Thread.run(Thread.java:748

Caused by: java.lang.RuntimeException: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping cannot be cast to org.apache.struts2.dispatcher.mapper.ActionMapping
    at io.undertow.servlet.spec.RequestDispatcherImpl.forwardImpl(RequestDispatcherImpl.java:245)
    at io.undertow.servlet.spec.RequestDispatcherImpl.access$100(RequestDispatcherImpl.java:54)
    at io.undertow.servlet.spec.RequestDispatcherImpl$2.call(RequestDispatcherImpl.java:137)
    at io.undertow.servlet.spec.RequestDispatcherImpl$2.call(RequestDispatcherImpl.java:134)
    at io.undertow.servlet.spec.ServletContextImpl$5.call(ServletContextImpl.java:175)
    at io.undertow.servlet.spec.ServletContextImpl$5.call(ServletContextImpl.java:172)
    at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
    at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
    at io.undertow.servlet.spec.ServletContextImpl.invokeAction(ServletContextImpl.java:886)
    ... 115 more
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
Yasser Zamani
2017-12-15 08:15:36 UTC
Permalink
Post by Prasanth Pasala
ServletContext sContext = context.getContext("/context2");
RequestDispatcher rd = sContext.getRequestDispatcher(resource);
rd.forward(request, response);
Thanks,
Prasanth
Exception: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping cannot be cast to org.apache.struts2.dispatcher.mapper.ActionMapping
usually when you get ClassCastExceptions you cannot explain you have loaded the class with one classloader then try to cast it to the same class loaded by another classloader. This will not work - they are represented by two different Class objects inside the JVM and the cast will fail.
[1] https://stackoverflow.com/a/826345/1362623
Т���������������������������������������������������������������������ХF�V�7V'67&�&R�R���âW6W"�V�7V'67&�&T7G'WG2�6�R��&pФf�"FF�F����6����G2�R��
Yasser Zamani
2017-12-15 09:52:10 UTC
Permalink
Post by Yasser Zamani
Post by Prasanth Pasala
ServletContext sContext = context.getContext("/context2");
RequestDispatcher rd = sContext.getRequestDispatcher(resource);
rd.forward(request, response);
Thanks,
Prasanth
Exception: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping cannot be cast to org.apache.struts2.dispatcher.mapper.ActionMapping
usually when you get ClassCastExceptions you cannot explain you have loaded the class with one classloader then try to cast it to the same class loaded by another classloader. This will not work - they are represented by two different Class objects inside the JVM and the cast will fail.
[1] https://stackoverflow.com/a/826345/1362623
... do you try to dispatch request to another Struts application? I
remember e.g. for Tomcat, it uses different classloaders for each app.

I think you can ask and continue with your container (e.g. Tomcat,
Jetty, WebSphere, etc) for a solution.

Regards.
Т���������������������������������������������������������������������ХF�V�7V'67&�&R�R���âW6W"�V�7V'67&�&T7G'WG2�6�R��&pФf�"FF�F����6����G2�R��
C***@bmw.de
2017-12-15 08:20:01 UTC
Permalink
Post by Prasanth Pasala
Post by Prasanth Pasala
ServletContext sContext = context.getContext("/context2");
RequestDispatcher rd = sContext.getRequestDispatcher(resource);
rd.forward(request, response);
Thanks,
Prasanth
org.apache.struts2.dispatcher.mapper.ActionMapping cannot be cast to
org.apache.struts2.dispatcher.mapper.ActionMapping
Post by Prasanth Pasala
usually when you get ClassCastExceptions you cannot explain you have
loaded the class with one classloader then try to cast it to the same class
loaded by another classloader. This will not work - they are represented by
two different Class objects inside the JVM and the cast will fail.
[1] https://stackoverflow.com/a/826345/1362623
This usually happens when struts jar is included in application server's lib directory.

Regards,
Christoph


---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@struts.apache.org
For additional commands, e-ma
Prasanth
2017-12-15 18:17:50 UTC
Permalink
Yes, dispatching request to another struts application. I am using Wildfly which does use different class loaders. Is this issue just with Struts2, as it works with Struts1.

Thanks,
Prasanth

--------------------------------------------------------------------------

... do you try to dispatch request to another Struts application? I
remember e.g. for Tomcat, it uses different classloaders for each app.

I think you can ask and continue with your container (e.g. Tomcat,
Jetty, WebSphere, etc) for a solution.

Regards.
Yasser Zamani
2017-12-15 20:12:50 UTC
Permalink
Post by Prasanth
Is this issue just with Struts2, as it works with Struts1.
No it's not a Struts issue. You don't see this in Struts1 because maybe
it doesn't use any object bounded to dispatched request. But Struts2
wants to

ActionMapping mapping =
(ActionMapping)request.getAttribute("struts.actionMapping");

A workaround would be removing object with key "struts.actionMapping"
from request before dispatching.

I hope this helps.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@struts.apache.org
For additional commands, e-ma
Prasanth Pasala
2017-12-15 18:13:30 UTC
Permalink
Yes, dispatching request to another struts application. I am using Wildfly which does use different class loaders. Is this issue just with Struts2, as it works with Struts1.

Thanks,
Prasanth

--------------------------------------------------------------------------

... do you try to dispatch request to another Struts application? I
remember e.g. for Tomcat, it uses different classloaders for each app.

I think you can ask and continue with your container (e.g. Tomcat,
Jetty, WebSphere, etc) for a solution.

Regards.
Prasanth Pasala
2017-12-15 20:28:45 UTC
Permalink
Thanks for the prompt response. Tried removing the attribute from the request, but still getting the class cast exception. Is it possible it is being set after I have called the forward?    
request.removeAttribute("struts.actionMapping");     // FORWARD THE REQUEST     ServletContext sContext = context.getContext("/context2");     RequestDispatcher rd =
sContext.getRequestDispatcher("/Login.action");    rd.forward(request, response);    [show/hide original text]
No it's not a Struts issue. You don't see this in Struts1 because maybe
it doesn't use any object bounded to dispatched request. But Struts2
wants to

ActionMapping mapping =
(ActionMapping)request.getAttribute("struts.actionMapping");

A workaround would be removing object with key "struts.actionMapping"
from request before dispatching.

I hope this helps.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@struts.apache.org
For additional commands, e-mail: user-***@struts.apache.org   
Prasanth Pasala
2017-12-15 22:10:53 UTC
Permalink
It seems like removeAttribute or setAttribute is not getting rid of the attribute from request. See below. If I set the value to a random string then I get a String can't be cast to ActionMapping
exception.

       Enumeration<String> attrs = request.getAttributeNames();
        while(attrs.hasMoreElements()) {
            System.out.println(attrs.nextElement());
        }
        System.out.println(request.getAttribute("struts.actionMapping"));
        request.setAttribute("struts.actionMapping", null);
        System.out.println(request.getAttribute("struts.actionMapping"));

Output:
16:05:05,300 INFO  [stdout] (default task-13) javax.servlet.forward.context_path
16:05:05,302 INFO  [stdout] (default task-13) javax.servlet.forward.servlet_path
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.forward.request_uri
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.forward.path_info
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.forward.query_string
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.request.key_size
16:05:05,303 INFO  [stdout] (default task-13) __cleanup_recursion_counter
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.request.cipher_suite
16:05:05,304 INFO  [stdout] (default task-13) struts.valueStack
16:05:05,308 INFO  [stdout] (default task-13) javax.servlet.request.ssl_session_id
16:05:09,121 INFO  [stdout] (default task-13) ActionMapping{name='Login', namespace='/', method='null', extension='action', params=null, result=null}
16:05:10,960 INFO  [stdout] (default task-13) ActionMapping{name='Login', namespace='/', method='null', extension='action', params=null, result=null}
Post by Prasanth Pasala
Thanks for the prompt response. Tried removing the attribute from the request, but still getting the class cast exception. Is it possible it is being set after I have called the forward?    
request.removeAttribute("struts.actionMapping");     // FORWARD THE REQUEST     ServletContext sContext = context.getContext("/context2");     RequestDispatcher rd =
sContext.getRequestDispatcher("/Login.action");    rd.forward(request, response);    [show/hide original text]
No it's not a Struts issue. You don't see this in Struts1 because maybe
it doesn't use any object bounded to dispatched request. But Struts2
wants to
ActionMapping mapping =
(ActionMapping)request.getAttribute("struts.actionMapping");
A workaround would be removing object with key "struts.actionMapping"
from request before dispatching.
I hope this helps.
---------------------------------------------------------------------
Prasanth Pasala
2017-12-15 22:54:17 UTC
Permalink
Added the below two lines to my filter (before the struts2 filter) in context2 app. That seems to do the trick. Thought it might create a problem as I am setting a new ActionMapping in the request,
but seems to work fine. Do you see any side effects of this?

        request.setAttribute("struts.actionMapping", new ActionMapping());
        request.setAttribute("struts.valueStack", null);

Thanks,
Prasanth
Post by Prasanth Pasala
It seems like removeAttribute or setAttribute is not getting rid of the attribute from request. See below. If I set the value to a random string then I get a String can't be cast to ActionMapping
exception.
       Enumeration<String> attrs = request.getAttributeNames();
        while(attrs.hasMoreElements()) {
            System.out.println(attrs.nextElement());
        }
        System.out.println(request.getAttribute("struts.actionMapping"));
        request.setAttribute("struts.actionMapping", null);
        System.out.println(request.getAttribute("struts.actionMapping"));
16:05:05,300 INFO  [stdout] (default task-13) javax.servlet.forward.context_path
16:05:05,302 INFO  [stdout] (default task-13) javax.servlet.forward.servlet_path
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.forward.request_uri
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.forward.path_info
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.forward.query_string
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.request.key_size
16:05:05,303 INFO  [stdout] (default task-13) __cleanup_recursion_counter
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.request.cipher_suite
16:05:05,304 INFO  [stdout] (default task-13) struts.valueStack
16:05:05,308 INFO  [stdout] (default task-13) javax.servlet.request.ssl_session_id
16:05:09,121 INFO  [stdout] (default task-13) ActionMapping{name='Login', namespace='/', method='null', extension='action', params=null, result=null}
16:05:10,960 INFO  [stdout] (default task-13) ActionMapping{name='Login', namespace='/', method='null', extension='action', params=null, result=null}
Post by Prasanth Pasala
Thanks for the prompt response. Tried removing the attribute from the request, but still getting the class cast exception. Is it possible it is being set after I have called the forward?    
request.removeAttribute("struts.actionMapping");     // FORWARD THE REQUEST     ServletContext sContext = context.getContext("/context2");     RequestDispatcher rd =
sContext.getRequestDispatcher("/Login.action");    rd.forward(request, response);    [show/hide original text]
No it's not a Struts issue. You don't see this in Struts1 because maybe
it doesn't use any object bounded to dispatched request. But Struts2
wants to
ActionMapping mapping =
(ActionMapping)request.getAttribute("struts.actionMapping");
A workaround would be removing object with key "struts.actionMapping"
from request before dispatching.
I hope this helps.
---------------------------------------------------------------------
Yasser Zamani
2017-12-16 05:12:07 UTC
Permalink
Could you please register this issue at [1] with title "Support for
cross context request processing" then we will keep it in monitor and
you can track resolution there, thanks for your report!
Post by Prasanth Pasala
Do you see any side effects of this?
I'm not sure. But unfortunately I did not know better solution for now
as Struts seems is not ready for cross context request processing :(
Post by Prasanth Pasala
        request.setAttribute("struts.actionMapping", new ActionMapping());
It's better to set null instead :
request.setAttribute("struts.actionMapping", null);

works?
Post by Prasanth Pasala
        request.setAttribute("struts.valueStack", null);
[1] https://issues.apache.org/jira/projects/WW
B�KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB��[��X��ܚX�KK[XZ[�\�\�][��X��ܚX�P��]˘\X�K�ܙ�B��܈Y][ۘ[��[X[��K[X
Prasanth Pasala
2017-12-18 17:03:05 UTC
Permalink
Added it to Struts JIRA (WW-4904) If I set the struts.actionMapping attribute to null it still causes the class cast exception. What I have seen is that after setting it to null if you call
getAttribute you would still get the old ActionMapping object, not sure how that is possible. Thanks, Prasanth --------------------------------------------------------------------------- [show/hide
original text]
No it's not a Struts issue. You don't see this in Struts1 because maybe
it doesn't use any object bounded to dispatched request. But Struts2
wants to

ActionMapping mapping =
(ActionMapping)request.getAttribute("struts.actionMapping");

A workaround would be removing object with key "struts.actionMapping"
from request before dispatching.

I hope this helps.
Post by Prasanth Pasala
Added the below two lines to my filter (before the struts2 filter) in context2 app. That seems to do the trick. Thought it might create a problem as I am setting a new ActionMapping in the request,
but seems to work fine. Do you see any side effects of this?
        request.setAttribute("struts.actionMapping", new ActionMapping());
        request.setAttribute("struts.valueStack", null);
Thanks,
Prasanth
Post by Prasanth Pasala
It seems like removeAttribute or setAttribute is not getting rid of the attribute from request. See below. If I set the value to a random string then I get a String can't be cast to ActionMapping
exception.
       Enumeration<String> attrs = request.getAttributeNames();
        while(attrs.hasMoreElements()) {
            System.out.println(attrs.nextElement());
        }
        System.out.println(request.getAttribute("struts.actionMapping"));
        request.setAttribute("struts.actionMapping", null);
        System.out.println(request.getAttribute("struts.actionMapping"));
16:05:05,300 INFO  [stdout] (default task-13) javax.servlet.forward.context_path
16:05:05,302 INFO  [stdout] (default task-13) javax.servlet.forward.servlet_path
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.forward.request_uri
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.forward.path_info
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.forward.query_string
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.request.key_size
16:05:05,303 INFO  [stdout] (default task-13) __cleanup_recursion_counter
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.request.cipher_suite
16:05:05,304 INFO  [stdout] (default task-13) struts.valueStack
16:05:05,308 INFO  [stdout] (default task-13) javax.servlet.request.ssl_session_id
16:05:09,121 INFO  [stdout] (default task-13) ActionMapping{name='Login', namespace='/', method='null', extension='action', params=null, result=null}
16:05:10,960 INFO  [stdout] (default task-13) ActionMapping{name='Login', namespace='/', method='null', extension='action', params=null, result=null}
Post by Prasanth Pasala
Thanks for the prompt response. Tried removing the attribute from the request, but still getting the class cast exception. Is it possible it is being set after I have called the forward?    
request.removeAttribute("struts.actionMapping");     // FORWARD THE REQUEST     ServletContext sContext = context.getContext("/context2");     RequestDispatcher rd =
sContext.getRequestDispatcher("/Login.action");    rd.forward(request, response);    [show/hide original text]
No it's not a Struts issue. You don't see this in Struts1 because maybe
it doesn't use any object bounded to dispatched request. But Struts2
wants to
ActionMapping mapping =
(ActionMapping)request.getAttribute("struts.actionMapping");
A workaround would be removing object with key "struts.actionMapping"
from request before dispatching.
I hope this helps.
---------------------------------------------------------------------
Yasser Zamani
2017-12-18 20:55:33 UTC
Permalink
Post by Prasanth Pasala
Added it to Struts JIRA (WW-4904)
Thank you very much for your time and report!
Post by Prasanth Pasala
If I set the struts.actionMapping attribute to null it still causes the class cast exception. What I have seen is that after setting it to null if you call
getAttribute you would still get the old ActionMapping object, not sure how that is possible.
Hmm... so how and why `request.setAttribute("struts.valueStack", null)`
works.

That's weird and so very important to me :)

Could you please see what is the type of request when you receive it in
your second context filter? e.g. println(request.getType()) before those
your two lines (I could see myself but maybe it will be different from
your one!)

Thanks in advance!
B�KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB��[��X��ܚX�KK[XZ[�\�\�][��X��ܚX�P��]˘\X�K�ܙ�B��܈Y][ۘ[��[X[��K[X
Prasanth
2018-03-01 18:42:06 UTC
Permalink
Sorry didn't check the website, I am not getting the emails to my inbox, will try to subscribe again.  I will get back to you with the exception I was getting if you don't set the valueStack to null.
Thanks, Prasanth ------------------------------------------------------------------ [show/hide original text]

Thank you very much for your time and report!
[show/hide original text]

Hmm... so how and why `request.setAttribute("struts.valueStack", null)`
works.

That's weird and so very important to me :)

Could you please see what is the type of request when you receive it in
your second context filter? e.g. println(request.getType()) before those
your two lines (I could see myself but maybe it will be different from
your one!)

Thanks in advance!
Post by Prasanth Pasala
Added it to Struts JIRA (WW-4904) If I set the struts.actionMapping attribute to null it still causes the class cast exception. What I have seen is that after setting it to null if you call
getAttribute you would still get the old ActionMapping object, not sure how that is possible. Thanks, Prasanth --------------------------------------------------------------------------- [show/hide
original text]
No it's not a Struts issue. You don't see this in Struts1 because maybe
it doesn't use any object bounded to dispatched request. But Struts2
wants to
ActionMapping mapping =
(ActionMapping)request.getAttribute("struts.actionMapping");
A workaround would be removing object with key "struts.actionMapping"
from request before dispatching.
I hope this helps.
Post by Prasanth Pasala
Added the below two lines to my filter (before the struts2 filter) in context2 app. That seems to do the trick. Thought it might create a problem as I am setting a new ActionMapping in the request,
but seems to work fine. Do you see any side effects of this?
        request.setAttribute("struts.actionMapping", new ActionMapping());
        request.setAttribute("struts.valueStack", null);
Thanks,
Prasanth
Post by Prasanth Pasala
It seems like removeAttribute or setAttribute is not getting rid of the attribute from request. See below. If I set the value to a random string then I get a String can't be cast to ActionMapping
exception.
       Enumeration<String> attrs = request.getAttributeNames();
        while(attrs.hasMoreElements()) {
            System.out.println(attrs.nextElement());
        }
        System.out.println(request.getAttribute("struts.actionMapping"));
        request.setAttribute("struts.actionMapping", null);
        System.out.println(request.getAttribute("struts.actionMapping"));
16:05:05,300 INFO  [stdout] (default task-13) javax.servlet.forward.context_path
16:05:05,302 INFO  [stdout] (default task-13) javax.servlet.forward.servlet_path
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.forward.request_uri
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.forward.path_info
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.forward.query_string
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.request.key_size
16:05:05,303 INFO  [stdout] (default task-13) __cleanup_recursion_counter
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.request.cipher_suite
16:05:05,304 INFO  [stdout] (default task-13) struts.valueStack
16:05:05,308 INFO  [stdout] (default task-13) javax.servlet.request.ssl_session_id
16:05:09,121 INFO  [stdout] (default task-13) ActionMapping{name='Login', namespace='/', method='null', extension='action', params=null, result=null}
16:05:10,960 INFO  [stdout] (default task-13) ActionMapping{name='Login', namespace='/', method='null', extension='action', params=null, result=null}
Post by Prasanth Pasala
Thanks for the prompt response. Tried removing the attribute from the request, but still getting the class cast exception. Is it possible it is being set after I have called the forward?    
request.removeAttribute("struts.actionMapping");     // FORWARD THE REQUEST     ServletContext sContext = context.getContext("/context2");     RequestDispatcher rd =
sContext.getRequestDispatcher("/Login.action");    rd.forward(request, response);    [show/hide original text]
No it's not a Struts issue. You don't see this in Struts1 because maybe
it doesn't use any object bounded to dispatched request. But Struts2
wants to
ActionMapping mapping =
(ActionMapping)request.getAttribute("struts.actionMapping");
A workaround would be removing object with key "struts.actionMapping"
from request before dispatching.
I hope this helps.
---------------------------------------------------------------------
Prasanth
2018-03-01 19:20:16 UTC
Permalink
Below is the exception you would get if the valueStack is not set to null.

Thanks,
Prasanth

13:17:52,070 ERROR [stderr] (default task-59) Caused by: java.lang.ClassCastException: com.opensymphony.xwork2.ognl.OgnlValueStack cannot be cast to com.opensymphony.xwork2.util.ValueStack
13:17:52,070 ERROR [stderr] (default task-59)     at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:546)
13:17:52,070 ERROR [stderr] (default task-59)     at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81)
13:17:52,070 ERROR [stderr] (default task-59)     at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
13:17:52,070 ERROR [stderr] (default task-59)     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
13:17:52,071 ERROR [stderr] (default task-59)     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
13:17:52,071 ERROR [stderr] (default task-59)     at com.xxxxxxx.xxxxxx.LoginFilter.doFilter(LoginFilter.java:46)
13:17:52,071 ERROR [stderr] (default task-59)     at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
13:17:52,071 ERROR [stderr] (default task-59)     at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
13:17:52,071 ERROR [stderr] (default task-59)     at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
13:17:52,071 ERROR [stderr] (default task-59)     at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
13:17:52,071 ERROR [stderr] (default task-59)     at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
13:17:52,071 ERROR [stderr] (default task-59)     at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
13:17:52,071 ERROR [stderr] (default task-59)     at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
13:17:52,071 ERROR [stderr] (default task-59)     at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
13:17:52,071 ERROR [stderr] (default task-59)     at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:274)
13:17:52,071 ERROR [stderr] (default task-59)     at io.undertow.servlet.handlers.ServletInitialHandler.dispatchToPath(ServletInitialHandler.java:209)
13:17:52,071 ERROR [stderr] (default task-59)     at io.undertow.servlet.spec.RequestDispatcherImpl.forwardImpl(RequestDispatcherImpl.java:221)
13:17:52,071 ERROR [stderr] (default task-59)     ... 128 more
Post by Prasanth
Sorry didn't check the website, I am not getting the emails to my inbox, will try to subscribe again.  I will get back to you with the exception I was getting if you don't set the valueStack to
null. Thanks, Prasanth ------------------------------------------------------------------ [show/hide original text]
Thank you very much for your time and report!
[show/hide original text]
Hmm... so how and why `request.setAttribute("struts.valueStack", null)`
works.
That's weird and so very important to me :)
Could you please see what is the type of request when you receive it in
your second context filter? e.g. println(request.getType()) before those
your two lines (I could see myself but maybe it will be different from
your one!)
Thanks in advance!
Post by Prasanth Pasala
Added it to Struts JIRA (WW-4904) If I set the struts.actionMapping attribute to null it still causes the class cast exception. What I have seen is that after setting it to null if you call
getAttribute you would still get the old ActionMapping object, not sure how that is possible. Thanks, Prasanth --------------------------------------------------------------------------- [show/hide
original text]
No it's not a Struts issue. You don't see this in Struts1 because maybe
it doesn't use any object bounded to dispatched request. But Struts2
wants to
ActionMapping mapping =
(ActionMapping)request.getAttribute("struts.actionMapping");
A workaround would be removing object with key "struts.actionMapping"
from request before dispatching.
I hope this helps.
Post by Prasanth Pasala
Added the below two lines to my filter (before the struts2 filter) in context2 app. That seems to do the trick. Thought it might create a problem as I am setting a new ActionMapping in the
request, but seems to work fine. Do you see any side effects of this?
        request.setAttribute("struts.actionMapping", new ActionMapping());
        request.setAttribute("struts.valueStack", null);
Thanks,
Prasanth
Post by Prasanth Pasala
It seems like removeAttribute or setAttribute is not getting rid of the attribute from request. See below. If I set the value to a random string then I get a String can't be cast to ActionMapping
exception.
       Enumeration<String> attrs = request.getAttributeNames();
        while(attrs.hasMoreElements()) {
            System.out.println(attrs.nextElement());
        }
        System.out.println(request.getAttribute("struts.actionMapping"));
        request.setAttribute("struts.actionMapping", null);
        System.out.println(request.getAttribute("struts.actionMapping"));
16:05:05,300 INFO  [stdout] (default task-13) javax.servlet.forward.context_path
16:05:05,302 INFO  [stdout] (default task-13) javax.servlet.forward.servlet_path
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.forward.request_uri
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.forward.path_info
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.forward.query_string
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.request.key_size
16:05:05,303 INFO  [stdout] (default task-13) __cleanup_recursion_counter
16:05:05,303 INFO  [stdout] (default task-13) javax.servlet.request.cipher_suite
16:05:05,304 INFO  [stdout] (default task-13) struts.valueStack
16:05:05,308 INFO  [stdout] (default task-13) javax.servlet.request.ssl_session_id
16:05:09,121 INFO  [stdout] (default task-13) ActionMapping{name='Login', namespace='/', method='null', extension='action', params=null, result=null}
16:05:10,960 INFO  [stdout] (default task-13) ActionMapping{name='Login', namespace='/', method='null', extension='action', params=null, result=null}
Post by Prasanth Pasala
Thanks for the prompt response. Tried removing the attribute from the request, but still getting the class cast exception. Is it possible it is being set after I have called the forward?    
request.removeAttribute("struts.actionMapping");     // FORWARD THE REQUEST     ServletContext sContext = context.getContext("/context2");     RequestDispatcher rd =
sContext.getRequestDispatcher("/Login.action");    rd.forward(request, response);    [show/hide original text]
No it's not a Struts issue. You don't see this in Struts1 because maybe
it doesn't use any object bounded to dispatched request. But Struts2
wants to
ActionMapping mapping =
(ActionMapping)request.getAttribute("struts.actionMapping");
A workaround would be removing object with key "struts.actionMapping"
from request before dispatching.
I hope this helps.
---------------------------------------------------------------------
Lukasz Lenart
2018-03-02 07:13:27 UTC
Permalink
Post by Prasanth
13:17:52,070 ERROR [stderr] (default task-59) Caused by: java.lang.ClassCastException: com.opensymphony.xwork2.ognl.OgnlValueStack cannot be cast to com.opensymphony.xwork2.util.ValueStack
You have two the same JARs on a class path but in different versions
(probably xwork-core-*.jar) or JARs were loaded by different
classloaders which means some framework's JARs were included inside
Wildfly


Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@struts.apache.org
For additional commands, e-mail: user-***@struts.apache.org
Prasanth
2018-03-02 14:16:38 UTC
Permalink
There are two applications on different contexts. Each have their own struts jars. The exception happens when a request to one context is forwarded to another context.

Thanks,
Prasanth
Post by Lukasz Lenart
Post by Prasanth
13:17:52,070 ERROR [stderr] (default task-59) Caused by: java.lang.ClassCastException: com.opensymphony.xwork2.ognl.OgnlValueStack cannot be cast to com.opensymphony.xwork2.util.ValueStack
You have two the same JARs on a class path but in different versions
(probably xwork-core-*.jar) or JARs were loaded by different
classloaders which means some framework's JARs were included inside
Wildfly
Regards
Lukasz Lenart
2018-03-02 15:31:19 UTC
Permalink
Post by Prasanth
There are two applications on different contexts. Each have their own struts jars. The exception happens when a request to one context is forwarded to another context.
What do you mean by "forwarded"?


Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@struts.apache.org
For additional commands, e-mail: user-***@struts.apache.org
Prasanth
2018-03-02 16:33:19 UTC
Permalink
https://issues.apache.org/jira/projects/WW/issues/WW-4904

Forwarded using request dispatcher.

ServletContext sContext = context.getContext("/context2");
RequestDispatcher rd = sContext.getRequestDispatcher(resource);
rd.forward(request, response);

Thanks,
Prasanth
Post by Lukasz Lenart
Post by Prasanth
There are two applications on different contexts. Each have their own struts jars. The exception happens when a request to one context is forwarded to another context.
What do you mean by "forwarded"?
Regards
Lukasz Lenart
2018-03-05 06:27:37 UTC
Permalink
Post by Prasanth
https://issues.apache.org/jira/projects/WW/issues/WW-4904
Forwarded using request dispatcher.
ServletContext sContext = context.getContext("/context2");
RequestDispatcher rd = sContext.getRequestDispatcher(resource);
rd.forward(request, response);
Did you add FORWARD as below when configuring the Struts filter?

<filter-mapping>
<filter-name>struts</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>


Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@struts.apache.org
For additional commands, e-mail: user-***@struts.apache.org
Prasanth Pasala
2018-03-05 15:19:22 UTC
Permalink
Yeah, my url pattern is *.action as I do have some struts1 actions.

  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>*.action</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>
Post by Lukasz Lenart
Post by Prasanth
https://issues.apache.org/jira/projects/WW/issues/WW-4904
Forwarded using request dispatcher.
ServletContext sContext = context.getContext("/context2");
RequestDispatcher rd = sContext.getRequestDispatcher(resource);
rd.forward(request, response);
Did you add FORWARD as below when configuring the Struts filter?
<filter-mapping>
<filter-name>struts</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
Regards
Lukasz Lenart
2018-03-06 05:52:06 UTC
Permalink
Post by Prasanth Pasala
Yeah, my url pattern is *.action as I do have some struts1 actions.
Does it mean you use the same filter to handle Struts 1 and Strut 2?


Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@struts.apache.org
For additional commands, e-mail: user-***@struts.apache.org
Prasanth Pasala
2018-03-06 15:10:17 UTC
Permalink
The filter is just for struts2. Struts1 is handled by servlet mapping.

  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>
Post by Lukasz Lenart
Post by Prasanth Pasala
Yeah, my url pattern is *.action as I do have some struts1 actions.
Does it mean you use the same filter to handle Struts 1 and Strut 2?
Regards
Yasser Zamani
2018-03-03 09:12:03 UTC
Permalink
Post by Prasanth
I will get back to you with the exception I was getting if you don't set the valueStack to null.
No, I meant why request.setAttribute("struts.actionMapping", null) not
work there (like your request.setAttribute("struts.valueStack", null))?
Why request.removeAttribute not work there?

So I asked below ....
Post by Prasanth
Could you please see what is the type of request when you receive it in
your second context filter? e.g. println(request.getType()) before those
your two lines (I could see myself but maybe it will be different from
your one!)
Thanks in advance!
to find out these whys :)

Thanks in advance for your reply and time.

B�KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB��[��X��ܚX�KK[XZ[�\�\�][��X��ܚX�P��]˘\X�K�ܙ�B��܈Y][ۘ[��[X[��K[X
Loading...