struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yasser Zamani <yasserzam...@apache.org>
Subject Re: java.lang.ClassCastException: org.apache.struts2.dispatcher.mapper.ActionMapping
Date Fri, 15 Dec 2017 09:52:10 GMT


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.
Mime
View raw message