Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8307837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:37:37+00:00 2026-06-08T18:37:37+00:00

EDIT : I made changes since I think my question may be missing some

  • 0

EDIT : I made changes since I think my question may be missing some technical details

The problem occurs in Struts 1.3.x and is described by the following :

When modify classes related to Struts (e.g ActionForm, Action, and/or any class I use with them) then I get ClassCastException when I test my modifications (Without restarting my webapp).

If I restart my webapp after making the same modifications then there is no exception and changes made are visible when testing.

This behaviour is said to be NORMAL because of the following reasons :

My web container (weblogic) is configured to reload servlet and classes if changes are made

I assume that a different ClassLoader is used when modifications are made to my classes. Which may causes ClassCastException.

Thus I have to restart webapp everytime I want to test my source modifications…

What I wanna know is what can I do (programming pattern ? best practice ?) to avoid this kind of ClassCastException or to avoid restarting webapp to view my changes ?

Here is the stack trace :

java.lang.ClassCastException: my.package.here.MyActionClassNameHere
    at org.apache.struts.chain.commands.servlet.CreateAction.getAction(CreateAction.java:65)
    at org.apache.struts.chain.commands.AbstractCreateAction.execute(AbstractCreateAction.java:91)
    at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
    at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
    at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
    at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
    at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1914)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:463)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:821)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

I have seen JRebel about page. It may be a solution but I am not ready to use it for my purpose (which is some very simple test using struts 1.3.x).

I’ll continue to do some parallel tests to understand a little more about this exception…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:37:38+00:00Added an answer on June 8, 2026 at 6:37 pm

    By default Struts 1.3 (latest 1.3.x) put action classes in cache to optimize performance (restarting deployment purge the cache). That was the cause of the exception because my modified classes are loaded by a different classloader from the previous one which was in cache.

    This exception occurs during the step of retrieving the action instance (which starts here in the stacktrace).

    at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
    

    By default this version of Struts implements the chain of responsability pattern (using an xml configuration file chain-config.xml). Thus the request processor mentioned above delegates action instance retrieving (or instantiation) to a CreationAction implementation (which is showed here in the stactrace) :

    at org.apache.struts.chain.commands.servlet.CreateAction.getAction(CreateAction.java:65)
    

    Following are solutions to avoid ClassCastException when making changes and donnot want to restart deployment.

    Solution 1 :

    • Extend CreateAction with a custom class and redefine its getAction() method

    • In getAction() : If the super.getAction().getClass() has not the same classloader than the new one then make it return a new instance by calling super.createAction()
      (That means that I should know the qualified class name of my Action class when comparing using the == operator otherwise I should not compare and always load a new action class with createAction)

    • Use a custom chain-config.xml to specify to use the custom CreationAction instead of the default one

    Solution 2 : Extend RequestProcessor with a custom class and use it instead of the default one (i.e update parameters in struts-config.xml)

    I think doing these should only be done when in development stage (to save some testing time) and should be avoid when in production stage for performance (and security) reasons.

    I couldn’t have free time to add more detailled example code, config files, etc… I’ll try to do it one day (somewhere else). But for sure I test these and it worked for my purpose 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made some modifications to SVG Edit which contains a make file. When I
I made a small project where i try to change the name from edit
EDIT: I had made a mistake during the debugging session that lead me to
EDIT Taking COST 100 out made the command go through, however, I'm still unable
-edit- nevermind, i made a mistake in my select statement. Update was working correctly.
IMPORTANT EDIT: Sorry everyone, i made a big mistake in the structure. char *name;
EDIT 07/14 As Bill Burgess mentionned in a comment of his answer, this question
Edit (updated question) I have a simple C program: // it is not important
I'm using a text file to save the changes made by a user on
Some time ago I made a script that takes some text and returns it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.