5 Replies Latest reply on Oct 14, 2002 6:52 PM by jules

    War inside of ear doesn't seem to redeploy correctly

    jstrohm

      Currently running JBoss-3.0.1 (using jetty).

      I have a simple app that let's a user login. Stores a user object in the session and retrieves information for the user to see.

      This is what happens:

      *Start Jboss
      *Deploy ear (with included war), everything deploys fine.
      *Hit website and login.
      *Try to view user information and it works fine.
      *Redeploy ear file (no change to code). Deploys fine.
      *Hit website and login
      *Try to view user information and it dies.

      It get's the user object from the session and when casting it to User from Object it gives me an exception (see below for stack trace).

      *Stop Jboss
      *Restart Jboss
      *Hit website and login.
      *Try to view user information and it works fine.


      ---------------------------------------------

      Any ideas on what may be causing this?


      Stack Trace:

      17:09:38,779 INFO [jbossweb] successfully deployed file:/usr/java/jboss/server/default/tmp/deploy/server/default/deploy/noxl.ear/64.noxl.ear-contents/noxl.war to
      17:09:38,780 INFO [MainDeployer] Deployed package: file:/usr/java/jboss/server/default/deploy/noxl.ear
      17:09:49,970 INFO [jbossweb] action: Processing a POST for /logon
      17:09:49,972 INFO [jbossweb] action: Looking for ActionForm bean under attribute 'logonForm'
      17:09:49,974 INFO [jbossweb] action: Creating new ActionForm instance of class 'noxl.webapp.LogonForm'
      17:09:49,975 INFO [jbossweb] action: Storing instance under attribute 'logonForm' in scope 'request'
      17:09:49,977 INFO [jbossweb] action: Populating bean properties from this request
      17:09:49,980 INFO [jbossweb] action: Validating input form properties
      17:09:49,981 INFO [jbossweb] action: No errors detected, accepting input
      17:09:49,983 INFO [jbossweb] action: Looking for Action instance for class noxl.webapp.LogonAction
      17:09:49,984 INFO [jbossweb] action: Double checking for Action instance already there
      17:09:49,986 INFO [jbossweb] action: Creating new Action instance
      17:09:49,988 INFO [jbossweb] action: LogonAction: User 'Jack Strohm' logged on in session 4o1rcnvlq3hp
      17:09:57,537 WARN [jbossweb] WARNING: Exception for /viewReport.jsp
      java.lang.ClassCastException: noxl.webapp.User
      at org.apache.jsp.viewReport$jsp._jspService(viewReport$jsp.java:136)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:344)
      at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:313)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:554)
      at org.mortbay.jetty.servlet.WebApplicationHandler.handle(WebApplicationHandler.java:199)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1572)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1522)
      at org.mortbay.http.HttpServer.service(HttpServer.java:795)
      at org.jboss.jetty.Jetty.service(Jetty.java:531)
      at org.mortbay.http.HttpConnection.service(HttpConnection.java:784)
      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:941)
      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:799)
      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:186)
      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:322)
      at org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:713)
      at java.lang.Thread.run(Thread.java:536)

        • 1. Re: War inside of ear doesn't seem to redeploy correctly

          try upgrading to 3.0.3.

          If the problem still occurs, distil it into a testcase and I will look at it.

          Jules

          • 2. Re: War inside of ear doesn't seem to redeploy correctly
            jstrohm

            Upgraded to 3.0.3 and the same problem persists. I'll try to get it down to a simple case that bombs.

            This is one thing I noticed:

            Create a user that when it is created it prints out "Hello World".
            Deploy war file.
            Login, "Hello World" is printed to the log.
            Remove the printing of "Hello World" from the class.
            Redeploy.
            Login, "Hello World" was still printed

            Grep for "Hello World" on entire machine and no file contains it.

            From this it seems that the webserver has loaded the class (that is in the war file) but when the war was redeployed it did not reload the class since it was already loaded in memory. Shouldn't this be occuring?

            Anyway, I'm trying to make a simple test case.

            • 3. Re: War inside of ear doesn't seem to redeploy correctly

              make sure that you let me know your OS, JVM etc...

              Cheers,


              Jules

              • 4. Re: War inside of ear doesn't seem to redeploy correctly
                jstrohm

                Thanks, but I have solved the problem. Not exactly sure of why it occured, but I did fix it.

                I had a class file in both my .WAR and .EAR file that only needed ot be in one of them (was only used by the web app). I removed it from the EAR and now when I redeploy everything works fine. Not sure why this was causing a problem because the class file in both of these jars was always identical. It was as if it wouldn't unload the old class file from memory for some reason.

                • 5. Re: War inside of ear doesn't seem to redeploy correctly

                  Having duplicate classes within your ear is asking for trouble.

                  Cheers,


                  Jules