12 Replies Latest reply on Oct 25, 2003 12:23 AM by anis79

    how to update deployed servlet

    anis79 Newbie

      Hi all,

      does anyone knows how to update a deployed servlet in the Jboss-Tomcat bundle ? Or Jboss-jetty ?

      I've been trying all the proposals posted in the forum but i am still unable to get the newest servlet version.

      I am deploying a WAR file in the default/deploy directory. Before each deploy, i change the date of the web.xml file, delete all class files in the tmp/work directory but the problem is still there even if i delete completely the tmp directory and restart jboss...

      Please help me ! this is a very urgent request !

      thanks in advance

      Anis

        • 1. Re: how to update deployed servlet
          Jon Barnett Master

          I would check your WAR and ensure that the new servlet is actually stored in the new WAR. I would also check the server.log to see that your WAR is redeploying. If the second is happening without any errors, then it would be safe to assume that the servlet classes in Jetty or Tomcat are getting reloaded. This would then indicate that the servlet code itself must not be changing.

          Since you are restarting JBoss and code execution is not changing, and JBoss does not cache classloading in any fashion, one would assume that the code included in the WAR is not changing.

          • 2. Re: how to update deployed servlet
            anis79 Newbie

            Well, i am using Eclipse with the Lomboz plugin to develop/build my classes. I removed completely the builded classes from my bin directory and rebuilded all the project.

            The WAR i got contains contains classes with the correct build date. When i deploy the war i still get the same problem...
            It seems to me that i really tried all the possibilities.

            There is only one way for me to get the correct servlet version and it's by unzipping jboss to another directory and deploying my WAR on it.

            I am really stucked... Do you have any clue ?

            Thanks in advance !

            Anis

            • 3. Re: how to update deployed servlet
              anis79 Newbie

              Hi all,

              I am sorry if i am boring you with this shit but i need to resolve this problem very quickly cause my due date is approaching :(

              Please help me, any clue will be appreciated !!

              Thanks in advance.

              Anis

              • 4. Re: how to update deployed servlet
                Jon Barnett Master

                Have you checked the server.log to verify undeploy and deploy of the new WAR? Have you tried putting some debug statements in your servlet to verify that your new code is executing and that things have changed since last deployment? Some system.out.println should generate some output to the console.

                • 5. Re: how to update deployed servlet
                  anis79 Newbie

                  Yep i did all that. println's are the way i'am using to know whether my servlet's are updates or not...
                  And the debug informations in the server log appears to be ok.. I got no errors at deployment...

                  • 6. Re: how to update deployed servlet
                    eraser Newbie

                    Unfortunately I don't have the answer to the problem, but I would like to point out that I have the same problem. I am using Lomboz on Eclipse as well.

                    I extracted the servlet from the war file and decompiled it, saw my changes in it, but the output I see on the browser/logs when I invoke the servlet do not reflect my changes.

                    Stumped,
                    Eraser

                    • 7. Re: how to update deployed servlet
                      Jon Barnett Master

                      OK. It sounds to me like Lomboz and Eclipse are getting tangled in this. Have you tried this with a standalone JBoss? Uncouple it from your development environment, try manually deploying your WAR and see what happens with running the code.

                      • 8. Re: how to update deployed servlet
                        anis79 Newbie

                        I've tryed that but the problem is still there... It seems to that JBoss does cache files but i don't know where... I explain :
                        - I am sure the deployed WAR contains the lastest servlet versions and the web.xml have a new modification date, so the AS should update the servlets.
                        - when deploying this war file (manually) the servlets are not updated.
                        - when i unzip a new copy of Jboss environment and deploy the war on it, i get the new servlets version.
                        - when i change my servlets and re-save my web.xml file once again and deploy the new generated war on the new JBoss copy, my servlets are not updated. Notice that each time i say that my servlets are not updates, i've been restrating JBoss, destroying the context and removing completely the tmp directory...

                        Since i recently moved to linux and creting a new JBoss environment takes me only 10 secs (i made a script for that to generate a new JBoss and copy the Hypersonic DB data...) i am not so bored with this problem... But i think it's still a issue we should find a solution for...

                        Anis

                        • 9. Re: how to update deployed servlet
                          anis79 Newbie

                          I just wanted to add a precision, i have the same problem on win2k and linux, so this is not related to the platform.

                          Anis

                          • 10. Re: how to update deployed servlet
                            anis79 Newbie

                            You were right jonlee !! The problem is coming from Lomboz !
                            It's not related to the war which is correctly geneated...
                            Since i got an EJB module and a Web module in the same project, my servlets were deployed inside both the ejb's jar file and war file. So JBoss get 2 copies of the same servlet and it seems to be using the oldest version.
                            So the problem is solved by deploying the jar file AND the war file (i deploy the war if i changed my war.xml or jsp files...)
                            Now i can really start working! I don't even need to restart JBoss or destroy the context using JBoss/Jetty distribution !

                            Thanks jonlee for your help and thanks to all of you who have tried to help :)

                            Anis

                            • 11. Re: how to update deployed servlet
                              eraser Newbie

                              That did the trick for me too. It didn't occur to me that Lomboz was adding the servlet to the ejb jar file as well. It shouldn't, should it?

                              In any case, by redeploying the ejb jar file the problem went away.

                              Thanks,
                              Eraser

                              • 12. Re: how to update deployed servlet
                                anis79 Newbie

                                well, it is not really included in the ejb-jar.xml, but all the project classes are included in the jar package AND the war file (even bean classes, funny isn't it ?).
                                It should not but this the way loboz is made... When you add a servlet to the web (even with the lomboz servlet wizard) it does not keep track of that and doesn't include the class informations for the web module... The only thing it does is including the servlet in the web.xml file once (it is never regenerated... )
                                The easy way was choosen by ObjectLearn and made me loose 2 weeks... Damn !

                                Anis