8 Replies Latest reply on Sep 21, 2009 9:54 AM by Rob Stryker

    in tomcat, redeployment of webapp on class file changes?

    null null Novice

      How do I debug the following problem further?....

      I change a class file and wait a few seconds and my webapp redeploys. I don't want it to. I just want the hot swap which did happen through the debugger. How do I figure out why it is redeploying? All I am seeing is...

      Sep 17, 2009 8:35:40 PM org.apache.catalina.core.StandardContext reload
      INFO: Reloading this Context has started
      Sep 17, 2009 8:35:40 PM org.hibernate.impl.SessionFactoryImpl close
      INFO: closing
      


      I tried changing logging levels...

      org.apache.level=FINER
      org.apache.tomcat.util.digester.level=INFO #was spewing stuff
      


      but the second thing kept spewing stuff because the logger must be named different then the class spitting out the logs. I am not sure why every code change, my webapp is redeployed. It is really really annoying. Any ideas on how to debug this issue further?

      thanks,
      Dean

        • 1. Re: in tomcat, redeployment of webapp on class file changes?
          Max Rydahl Andersen Master

          This is on what version of tomcat ?

          Which server type are you using from Eclipse ?

          btw. normal redeployment only happen if you touch the descriptors ...

          • 2. Re: in tomcat, redeployment of webapp on class file changes?
            null null Novice

            I am using tomcat 6.0.16. Server type through WTP tools is Apache Tomcat v6.

            I am not touching the descriptors but hmmmm, how do I monitor that to find out which plugin might be doing that. I did uncheck the setting "Update Context Paths" thinking maybe that would help but it didn't".

            oh, and this is jboss tools 3.1.0 M3 ;).

            I will go ahead and try out adding a server through jboss tools jboss server view today and deploying to that server instead to see if that helps (though we do have another project that does seem to be working ok and does not redeploy when I touch class files so I am confused as to what is different between the two projects).

            thanks,
            Dean

            • 3. Re: in tomcat, redeployment of webapp on class file changes?
              null null Novice

              so, I tried jboss tools server view(by adding my tomcat server) and I still get redeploy on every class change. Some interesting things to note though are below....

              I configure the tomcat instance to be in a new tomcatInst directory and change wtpwebapps to webapps. I think start it up, change my class file and the redeploy happens(I mean I see hibernate re-init, seam, everything). I then check the timestamp on my web.xml file. It has NOT changed. It is still yesterday's timestamp. Any ideas why something would hot deploy in tomcat when the web.xml file has not change in webapps/mainapp/WEB-INF/web.xml....is this the wrong file to look at? Not sure why this is happening at all now. Could it be a jboss config or a WTP config problem?

              • 4. k..it is a bug and the workaround I found....
                null null Novice

                Well, it turns out, on my one project, I had the "Server Modules without Publishing" checked. Once I unchecked that, that project also gets redeployed every time I touch any class file. the class files timestamp changes but the web.xml timestamp never changes and is never touched and this causes a redeploy.

                I am very confused. I distinctly recall, you had ot touch the web.xml file to cause a redeploy in tomcat but that is not what I am seeing at this instant.

                I don't like how JBoss tools or WTP modifies my tomcat config files!!! Somehow the MyEclipse developers figured out a way to pass stuff in on the command line and re-use the same tomcat instance I use. That rocked because then I could go run ./catalina.sh run after I deployed with eclipse and debug eclipse deployment problems where eclipse was not deploying a file I needed or something. It was very nice feature. Should I add a feature request there?

                Well, the work around is to check "Server Modules without Publishing" but I don't like doing that.

                OH, another feature I LOVE in myeclipse is checking the "Merge all dependent projects into the WEB-INF/classes folder" as this allows me to publish everything and still do hot swap on the dependent projects. I loved that feature....can I request that one as well?

                Are you not seeing constant redeployment in tomcat when you change a java file???

                thanks,
                Dean

                • 5. Re: in tomcat, redeployment of webapp on class file changes?
                  Snjezana Peco Master

                  You need to configure Tomcat to not redeploy the application when changing WEB-INF/classes.
                  Create <your_application>/WebContent/META-INF/context.xml:

                  <Context debug="0" reloadable="false">
                  </Context>
                  


                  or add the attribute reloadable="false" if you already have context.xml.
                  You also can change Tomcat's global context.xml (TOMCAT_HOME/conf/context.xml).

                  As to "Merge all dependent projects into the WEB-INF/classes folder", I think that the Tomcat adapter doesn't support it. The Tomcat adapter is a WTP adapter and isn't related to JBoss Tools. JBoss Tools adapters support this feature for Web and EJB projects (they are deployed in an exploded form and are hot swappable).

                  • 6. Re: in tomcat, redeployment of webapp on class file changes?
                    null null Novice

                    thanks, that seemed to work great!!!

                    • 7. Re: in tomcat, redeployment of webapp on class file changes?
                      Max Rydahl Andersen Master

                      "I don't like how JBoss tools or WTP modifies my tomcat config files!!!"

                      We don't modify any of your tomcat config files, neither do WTP afaik.

                      Snjezana's answer should be enough ;)

                      "Merge all dependent projects into the WEB-INF/classes folder"

                      That sounds like a tomcat specific request - JBoss supports exploded deployment outofthebox so not sure such option is needed ?


                      • 8. Re: in tomcat, redeployment of webapp on class file changes?
                        Rob Stryker Master

                        Just to chime in, what Sjnezana said is correct. The Tomcat adapter is not ours and we cannot control any of its behaviour really. Larry Isaacs is the guy in charge of that and you can either file a bug / feature request on eclipse bugzilla or WTP forums / mailing lists for any suggestions you have on Tomcat.