Re: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping

2018-03-06 Thread Prasanth Pasala
The filter is just for struts2. Struts1 is handled by servlet mapping.

  
    action
    *.do
  

On 03/05/2018 11:52 PM, Lukasz Lenart wrote:
> 2018-03-05 16:19 GMT+01:00 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



Re: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping

2018-03-05 Thread Lukasz Lenart
2018-03-05 16:19 GMT+01:00 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-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping

2018-03-05 Thread Prasanth Pasala
Yeah, my url pattern is *.action as I do have some struts1 actions.

  
    struts2
    *.action
    REQUEST
    FORWARD
  

On 03/05/2018 12:27 AM, Lukasz Lenart wrote:
> 2018-03-02 17:33 GMT+01:00 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?
>
> 
> struts
> /*
> REQUEST
> FORWARD
> 
>
>
> Regards



Re: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping

2018-03-04 Thread Lukasz Lenart
2018-03-02 17:33 GMT+01:00 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?


struts
/*
REQUEST
FORWARD



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

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping

2018-03-03 Thread Yasser Zamani


On 3/1/2018 10:12 PM, Prasanth wrote:
> 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 

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



Re: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping

2018-03-02 Thread 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);

Thanks,
Prasanth

On 03/02/2018 09:31 AM, Lukasz Lenart wrote:
> 2018-03-02 15:16 GMT+01:00 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



Re: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping

2018-03-02 Thread Lukasz Lenart
2018-03-02 15:16 GMT+01:00 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-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping

2018-03-02 Thread 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.

Thanks,
Prasanth

On 03/02/2018 01:13 AM, Lukasz Lenart wrote:
> 2018-03-01 20:20 GMT+01:00 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



Re: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping

2018-03-01 Thread Lukasz Lenart
2018-03-01 20:20 GMT+01:00 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-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping

2018-03-01 Thread Prasanth

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.xxx.xx.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

On 03/01/2018 12:42 PM, Prasanth wrote:
> 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!
>
>
> On 12/18/2017 11:03 AM, Prasanth Pasala wrote:
>> 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.
>>
>>
>> On 12/15/2017 04:54 PM, Prasanth Pasala wrote:
>>> 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,

Re: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping

2018-03-01 Thread 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!



On 12/18/2017 11:03 AM, Prasanth Pasala wrote:
> 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.
>
>
> On 12/15/2017 04:54 PM, Prasanth Pasala wrote:
>> 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
>>
>> On 12/15/2017 04:10 PM, Prasanth Pasala wrote:
>>> 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 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}
>>>
>>>
>>> On 12/15/2017 02:28 PM, Prasanth Pasala wrote:
 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.

 

Re: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping

2017-12-18 Thread Yasser Zamani


On 12/18/2017 8:33 PM, Prasanth Pasala wrote:
> Added it to Struts JIRA (WW-4904)

Thank you very much for your time and report!

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


Re: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping

2017-12-18 Thread 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.



On 12/15/2017 04:54 PM, Prasanth Pasala wrote:
> 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
>
> On 12/15/2017 04:10 PM, Prasanth Pasala wrote:
>> 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 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}
>>
>>
>> On 12/15/2017 02:28 PM, Prasanth Pasala wrote:
>>> 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-unsubscr...@struts.apache.org
>>> For additional commands, e-mail: user-h...@struts.apache.org    
>>
>



Re: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping

2017-12-15 Thread Yasser Zamani

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!

On 12/16/2017 2:24 AM, Prasanth Pasala wrote:
> 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 :(

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

It's better to set null instead : 
request.setAttribute("struts.actionMapping", null);

works?

>          request.setAttribute("struts.valueStack", null);

[1] https://issues.apache.org/jira/projects/WW


Re: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping

2017-12-15 Thread 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

On 12/15/2017 04:10 PM, Prasanth Pasala wrote:
> 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 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}
>
>
> On 12/15/2017 02:28 PM, Prasanth Pasala wrote:
>> 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-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org    
>



Re: Re: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping

2017-12-15 Thread 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 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}


On 12/15/2017 02:28 PM, Prasanth Pasala wrote:
> 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-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org    



Re: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping

2017-12-15 Thread 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.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org    



Re: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping

2017-12-15 Thread Yasser Zamani


On 12/15/2017 9:47 PM, Prasanth wrote:
> 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-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


re: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping

2017-12-15 Thread Prasanth Pasala

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.



re: java.lang.ClassCastException:, org.apache.struts2.dispatcher.mapper.ActionMapping

2017-12-15 Thread Prasanth
We have the struts jars in the individual wars. I was actually thinking of 
putting it in server lib to see if that would solve the problem.

Thanks,
Prasanth
*
From: *<c...@bmw.de>
*Subject: *re: java.lang.ClassCastException: 
org.apache.struts2.dispatcher.mapper.ActionMapping
*Date: *2017-12-15 02:20
*List: *user@struts.apache.org 
<https://lists.apache.org/list.html?user@struts.apache.org>

[show/hide original text]

This usually happens when struts jar is included in application server's lib 
directory.

Regards,
Christoph



re: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping

2017-12-15 Thread Prasanth

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.



Re: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping

2017-12-15 Thread Yasser Zamani


On 12/15/2017 11:45 AM, Yasser Zamani wrote:
> 
> 
> On 12/15/2017 2:16 AM, Prasanth Pasala wrote:
>> 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
> 
> 
> I found [1]:
>> 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.


re: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping

2017-12-15 Thread Christoph.Nenning


> > 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
> 
> 
> I found [1]:
> > 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-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


Re: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping

2017-12-15 Thread Yasser Zamani


On 12/15/2017 2:16 AM, Prasanth Pasala wrote:
> 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


I found [1]:
> 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