3 Replies Latest reply on Aug 3, 2006 1:02 PM by peterj

    Redeploying Servlet

    kalun

      Hi everyone,

      I am new the whole J2EE and JBoss-Tomcat technology. I am currently trying to deploy my first application (just a simple HttpServlet) to JBoss and it works. But then when I try to change the HttpServlet, redeploy it, the changes does not show up. Could anyone please give me advise as for what I need to do for redeploying servlet?

      Thanks in advance.
      kalun

        • 1. Re: Redeploying Servlet
          peterj

          How are you deploying the servlet? What is the structure of your war file?

          See http://pdf.moreservlets.com/ for a chapter on a simple servlet and how it is packaged in a war file. This chapter is based on an older version of the servlet spec but should be sufficient to get you going. To deploy to JBoss, copy the war file to the server/default/deploy directory. To redeploy, just copy over the file.

          • 2. Re: Redeploying Servlet
            kalun

            Thank you for your reply, I guess I should be more clear.

            The Structure of the EAR file I deployed follows the J2EE specification:

            -Sample2.WAR File
             -META-INF
             -application.xml File
            


            Inside the WAR File, the structure is

            -index.jsp File
            -WEB-INF
             -web.xml File
             -classes
             -src
             -HelloWorld.class File
             -HelloWorld.class File
            


            When I redeploy (by coming the ear file to server/default/deploy diectory), I gets the following message:

            09:58:04,744 INFO [TomcatDeployer] undeploy, ctxPath=/Sample2, warUrl=.../tmp/deploy/tmp61625Sample2.ear-contents/Sample2-exp.war/
            09:58:30,285 INFO [EARDeployer] Undeploying J2EE application, destroy step: file:/C:/Program Files/jboss-4.0.4.GA/server/default/deploy/Sample2.ear
            09:58:30,395 INFO [EARDeployer] Undeployed J2EE application: file:/C:/Program Files/jboss-4.0.4.GA/server/default/deploy/Sample2.ear
            09:58:32,919 INFO [EARDeployer] Init J2EE application: file:/C:/Program Files/jboss-4.0.4.GA/server/default/deploy/Sample2.ear
            


            But when I access the site, the OLD contents will show up instead of the updated once.

            Once again, thank you for your help

            • 3. Re: Redeploying Servlet
              peterj

              I notice that the war file contains the HelloWorld.class file twice. Should there be only one? Are you sure that web.xml file references the correct class file? Also, have you tired deploying the war file by itself (not embedded wihtin the ear file). (If you try deploying the war file, remove the ear file first.)