Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-749

ClassCastException when using ReloadingWicketFilter

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.3.0-beta2
    • 1.3.0-beta3
    • wicket
    • None
    • OS: Ubuntu Linux
      JDK: 1.5.0_11
      COntainer: Jetty via Maven (mvn jetty:run)

    Description

      Reference Threads:
      http://www.nabble.com/Has-something-changed-in-markup-inheritance--tf3963374.html
      http://www.nabble.com/Classcastexception-and-getSession-tf3979399.html

      In summary, in certain situations, classes that should be loaded by the ReloadingClassLoader are being loaded by the container's normal classloader. While this happens in several situations, the most obvious and repeatable is when using the browser's back button. I will attach a small app that demonstrates this issue after submitting this bug.

      The steps needed to recreate this issue int he demo app are actually quite odd, so this may seem like a fringe issue, however in our real app, the situations comes up much easier and with much more frequency.

      Steps:
      1) Unzip the attached file.

      2) Assuming Maven is installed, run "mvn jetty:run" inside the project directory.

      3) Use your browser to go to http://127.0.0.1:8080/app

      4) Click "Second Link"

      5) Use your browser back functionality and then click "Second Link" again. Everything should work fine.

      6) You should now be be on a page with the words "Second changed10". If not, click "Second Link" to get there. Use the browser to refresh that page.

      7) Refreshing should have caused a "Page Expired" error. That's ok, that isn't the issue. Click the browser back button to go back to the first page.

      8) Click "Second Link" again. This should generate the ClassCastException.

      If you disable the Reloading filter or if you comment out the include/exclude lines in the included FusionReloadingWicketFilters you can go through the same steps and not generate a ClassCastError.

      As I mentioned above. This may seem like a very fringe case with all the the refreshing and back buttons, but that just because that's the first and most reliable way I found to recreate this issue in this tiny demo app. The issue occurs under all kinds of situations in my real app including almost always after I modify a java file and recompile it which is the primary use case for the ReloadingClassloader.

      Attachments

        1. reloading.zip
          7 kB
          Matt Welch

        Activity

          People

            jbq Jean-Baptiste Quenot
            watter Matt Welch
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: