6 Replies Latest reply on May 30, 2007 7:57 PM by bmist

    How do i deploy servlet using JBoss4.2.0.GA, pls help ???

    bmist

      Hi all,

      I have written a test servlet and now i am trying to deploy it on the JBoss server. how do i do it, can anybody pls tell me the steps ? i tried to google it but its making me more confused and the thing is not working.

      i also have to deploy the descriptor web.xml.

      i am using the JBoss version JBoss-4.2.0.GA.

      moreover i have set the following env variables viz. JAVA_HOME, JBOSS_HOME, CLASSPATH and when i run the run.bat file it does not throw any errors but again i guess the server is not listening coz the port 8080 is not opened on my machine.

      Also when i run shutdown.bat it says path is not specified.

      Thanks for your help.

        • 1. Re: How do i deploy servlet using JBoss4.2.0.GA, pls help ??
          peterj

          If your servlet is named foo.bar.Servet, package it in a war file, named foobar.war, as follows:

          WEB-INF/
          + web.xml
          + classes/
          + foo/
          + bar/
          + Servlet.class

          Copy foobar.war to the server/default/deploy directory.

          If you have a welcome file set up in web.xml to access the servlet, you can access it as http://localhost:8080/foobar.

          • 2. Re: How do i deploy servlet using JBoss4.2.0.GA, pls help ??
            peterj

            Rats, should have previewed the war file contents:

            WEB-INF/
            + web.xml
            + classes/
             + foo/
             + bar/
             + Servlet.class


            • 3. Re: How do i deploy servlet using JBoss4.2.0.GA, pls help ??
              bmist

              Ohh ok let me try converting it to .WAR file but before doing that my JBoss server is not starting up. i tried running the "run.bat" file but it does not display anythign on the command prompt.

              i have set the env variables as follows.

              CLASSPATH : C:\Program Files\jboss-4.0.5.GA\bin\run.jar:\lib\tools.jar
              JAVA_HOME : C:\Program Files\Java\j2re1.4.2_04\bin\client\jvm.dll
              JBOSS_HOME : C:\Program Files\jboss-4.0.5.GA

              Thanks for your help.

              • 4. Re: How do i deploy servlet using JBoss4.2.0.GA, pls help ??
                peterj

                1) I recommend against placing any Java applications within Program Files. Various Java libraries have problems with spaces in the directory name, and unless you enjoy chasing down weird problems, you should put JBoss elsewhere. On my PC, JBoss is at f:\jboss\jboss-4.0.5.GA.

                2) You do not need a classpath, the run.bat will set it up for you. I recommend that you never set a global CLASSPATH, it will only cause problems.

                3) Your JAVA_HOME is incorrect. First, it references a JRE, your really should have a JDK. And your JRE is really old. You should download and use the latest 1.4 or 1.5 JDK from Sun and install it (do not use JDK 6, JBoss is not yet qualified to run with that and it can cause problems). Do not install the JDK in Program Files. Mine is at d:\apps\jdk1.5.0_11. (Yeah, I have a lot of disk drives, but on my laptop at home I use the same naming convention but everything is on the c: drive). Second, set JAVA_HOME to the installation directory, not to the jvm.dll. For example, on my PC I have:

                JAVA_HOME=d:\apps\jdk1.5.0_11

                4) It is not necessary to set JBOSS_HOME.

                • 5. Re: How do i deploy servlet using JBoss4.2.0.GA, pls help ??
                  bmist

                  Thanks for the information Peter, let me do it as you have instructed and will get back to you.

                  Thanks.
                  B

                  • 6. Re: How do i deploy servlet using JBoss4.2.0.GA, pls help ??
                    bmist

                    Hi,

                    i downloaded the latest JDK and changed the env variables and was able to start the server successfully.

                    Thanks for your help Peter and everybody who replied.

                    Thanks.
                    B