0 Replies Latest reply on Aug 15, 2006 2:32 PM by ihunter1

    JBoss/Thread [WebappClassLoader] Illegal access issue, PLEAS

    ihunter1

      Ok, I'm so fried on this issue. First off, I get little to no debugging info from JBoss on this, so I can't track it to a single line.

      Quick info:
      Release ID: JBoss [Zion] 4.0.1sp1 (build: CVSTag=JBoss_4_0_1_SP1 date=200502160314)
      Apache Tomcat/5.0.28

      First off, here's the JBoss error I get:

      2006-08-15 13:50:08,971 INFO [WebappClassLoader] Illegal access: this web application instance has been stopped already (the eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact)
      Filter trigger matched. Restarting JVM.
      2006-08-15 13:50:09,818 INFO [Server] JBoss SHUTDOWN: Undeploying all packages
      2006-08-15 13:50:09,819 INFO [TomcatDeployer] undeploy, ctxPath=/, warUrl=file:/web/deploy/tomato.war/
      ...
      <yada yada yada, normal JBoss resource undeploy restart stuff>

      It seems David has already put in a filter for this with JSW, so it does the restart. (BTW: Is this something you see on your production machines as well?)

      Consider the situation where we have ONE Servlet for the deployed webapp. This servlet spawns an instance of PagePropertiesEngine which in turn will spawn the PagePropertiesEngineUpdater thread.

      PagePropertiesEngine.init() is called during Servlet.init() and PagePropertiesEngine.destroy() is called during Servlet.destroy().

      The problem arises when the webapp is undeployed and redeployed. Both System.out.println() are reached:

      2006-08-15 13:49:48,736 INFO [TomcatDeployer] undeploy, ctxPath=/, warUrl=file:/web/deploy/tomato.war/
      2006-08-15 13:49:48,760 INFO [STDOUT] PageEngine.destroy()
      2006-08-15 13:49:57,968 INFO [STDOUT] FINISHED PagePropertiesEngineUpdater.run()
      2006-08-15 13:49:57,969 INFO [STDOUT] FINISHED PagePropertiesEngine.destroy()
      2006-08-15 13:49:59,464 INFO [TomcatDeployer] deploy, ctxPath=/, warUrl=file:/web/deploy/tomato.war/

      Wait about 10 seconds, then I get the error up above. I can't seem to fathom what's happening because it seems like the Thread is kaput.

      Here is the code for the two classes, they really couldn't be simpler:

      public class PagePropertiesEngineUpdater extends Thread
      {
      private long updateSeconds = 10;
      boolean stop = false;

      public PagePropertiesEngineUpdater()
      {
      super();
      }

      public void run()
      {
      super.run();

      while (!stop)
      {
      if (stop) return;

      try
      {
      sleep(updateSeconds * 1000);
      }
      catch (InterruptedException ie)
      {
      }
      }
      System.out.println("FINISHED PagePropertiesEngineUpdater.run()");
      }
      }

      public class PagePropertiesEngine
      {
      private PagePropertiesEngineUpdater updater = new PagePropertiesEngineUpdater();

      public PagePropertiesEngine()
      {
      super();
      }

      public void init()
      {
      updater.start();
      }

      public void destroy()
      {
      updater.stop = true;
      try
      {
      updater.join();
      }
      catch (InterruptedException ie)
      {
      ie.printStackTrace();
      }
      System.out.println("FINISHED PagePropertiesEngine.destroy()");
      }
      }

      Any wisdom or ideas are appreciated. I'm totally shot.