how do i configure tomcat5.5

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mak1084
    New Member
    • Jul 2007
    • 44

    how do i configure tomcat5.5

    hi folks,
    i installed tomcat 5.5... and there was already jdk 1.5.0.02 was installed. i cofigure the path JAVA_HOME and CLASSPATH corectly but i'm not able to compile servlet. do i need to add ne file in jdk folder... please help me configuring the tomcat ....please dont tell me to read the documentation coz frm last one week i'm just reading that and googling but i'm fail. i can run html and jsp file but servlet is not compiling.
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by mak1084
    hi folks,
    i installed tomcat 5.5... and there was already jdk 1.5.0.02 was installed. i cofigure the path JAVA_HOME and CLASSPATH corectly but i'm not able to compile servlet. do i need to add ne file in jdk folder... please help me configuring the tomcat ....please dont tell me to read the documentation coz frm last one week i'm just reading that and googling but i'm fail. i can run html and jsp file but servlet is not compiling.
    What kind of erorrs are you getting when compiling the servlet?

    Comment

    • Nepomuk
      Recognized Expert Specialist
      • Aug 2007
      • 3111

      #3
      Originally posted by mak1084
      hi folks,
      i installed tomcat 5.5... and there was already jdk 1.5.0.02 was installed. i cofigure the path JAVA_HOME and CLASSPATH corectly but i'm not able to compile servlet. do i need to add ne file in jdk folder... please help me configuring the tomcat ....please dont tell me to read the documentation coz frm last one week i'm just reading that and googling but i'm fail. i can run html and jsp file but servlet is not compiling.
      You can call the page http://localhost:8080/ correctly, can't you? If you can, there's something wrong with how you connect your Servlet to Tomcat. If not, there's something wrong in the configuration of Tomcat itself.

      As r035198x asked, what error messages does Tomcat give?

      Greetings,
      Nepomuk

      Comment

      • misaw
        New Member
        • Aug 2007
        • 17

        #4
        Originally posted by mak1084
        hi folks,
        i installed tomcat 5.5... and there was already jdk 1.5.0.02 was installed. i cofigure the path JAVA_HOME and CLASSPATH corectly but i'm not able to compile servlet. do i need to add ne file in jdk folder... please help me configuring the tomcat ....please dont tell me to read the documentation coz frm last one week i'm just reading that and googling but i'm fail. i can run html and jsp file but servlet is not compiling.
        A servlet entry is required in web.xml file of your web application folder
        For example i have an application deployed on tomcat as MyApp
        /MyApp
        /WEB-INF
        web.xml


        OR you have to uncomment the invoker servlet entry and its mapping from web.xml file found in
        <YOUR TAOMCAT FOLDER>/ conf/ web.xml

        i think its solved ur problem

        Comment

        • mak1084
          New Member
          • Jul 2007
          • 44

          #5
          Originally posted by misaw
          A servlet entry is required in web.xml file of your web application folder
          For example i have an application deployed on tomcat as MyApp
          /MyApp
          /WEB-INF
          web.xml


          OR you have to uncomment the invoker servlet entry and its mapping from web.xml file found in
          <YOUR TAOMCAT FOLDER>/ conf/ web.xml

          i think its solved ur problem
          can you please elaborate i dint get wht you want to say.
          in which statement or exactly where i have to uncomment the invoker?

          Comment

          • shaileshkumar
            New Member
            • Aug 2007
            • 36

            #6
            first make sure you have this

            JAVA_HOME=java installation directory path
            CATALINA_HOME=t omcat installation directory path.

            while compiling servlets you have to set the path
            for example ,if your tomcat is installed in c:\program files\tomcat 5.5 then

            set the path as

            set path=c:\tomcat 5.5\common\lib\ servlet-api.jar;%classp ath%
            then compile the servlet.

            make sure you are following the directory structure of servlets.


            with regards,
            shailesh

            Comment

            • misaw
              New Member
              • Aug 2007
              • 17

              #7
              Originally posted by mak1084
              can you please elaborate i dint get wht you want to say.
              in which statement or exactly where i have to uncomment the invoker?
              There are two ways to use a servlet in Tomcat

              1) Entry in your application web.xml file see this
              http://www.onjava.com/pub/a/onjava/2001/04/19/tomcat.html?pag e=4

              2) Uncomment the invoker servlet, see this
              http://weblog.dangertr ee.net/category/servlets/

              make sure you correctly compile and place the servlet before doing all this.

              Comment

              • mak1084
                New Member
                • Jul 2007
                • 44

                #8
                i changed the codes now other codes are commented (except one which is very big)

                Code:
                    <servlet>
                        <servlet-name>default</servlet-name>
                        <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
                        <init-param>
                            <param-name>debug</param-name>
                            <param-value>0</param-value>
                        </init-param>
                        <init-param>
                            <param-name>listings</param-name>
                            <param-value>true</param-value>
                        </init-param>
                        <load-on-startup>1</load-on-startup>
                    </servlet>
                
                    <servlet>
                        <servlet-name>invoker</servlet-name>
                        <servlet-class>
                          org.apache.catalina.servlets.InvokerServlet
                        </servlet-class>
                        <init-param>
                            <param-name>debug</param-name>
                            <param-value>0</param-value>
                        </init-param>
                        <load-on-startup>2</load-on-startup>
                    </servlet>
                
                    <servlet>
                        <servlet-name>jsp</servlet-name>
                        <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
                        <init-param>
                            <param-name>fork</param-name>
                            <param-value>false</param-value>
                        </init-param>
                        <init-param>
                            <param-name>xpoweredBy</param-name>
                            <param-value>false</param-value>
                        </init-param>
                        <load-on-startup>3</load-on-startup>
                    </servlet>
                
                 
                
                    <!-- The mapping for the default servlet -->
                    <servlet-mapping>
                        <servlet-name>default</servlet-name>
                        <url-pattern>/</url-pattern>
                    </servlet-mapping>
                
                    <!-- The mapping for the invoker servlet -->
                
                    <servlet-mapping>
                        <servlet-name>invoker</servlet-name>
                        <url-pattern>/servlet/*</url-pattern>
                    </servlet-mapping>
                
                
                    <!-- The mapping for the JSP servlet -->
                    <servlet-mapping>
                        <servlet-name>jsp</servlet-name>
                        <url-pattern>*.jsp</url-pattern>
                    </servlet-mapping>
                
                    <servlet-mapping>
                        <servlet-name>jsp</servlet-name>
                        <url-pattern>*.jspx</url-pattern>
                    </servlet-mapping>
                
                   
                  <!-- ==================== Default Session Configuration ================= -->
                  <!-- You can set the default session timeout (in minutes) for all newly   -->
                  <!-- created sessions by modifying the value below.                       -->
                
                    <session-config>
                        <session-timeout>30</session-timeout>
                    </session-config>
                
                
                    <welcome-file-list>
                        <welcome-file>index.html</welcome-file>
                        <welcome-file>index.htm</welcome-file>
                        <welcome-file>index.jsp</welcome-file>
                    </welcome-file-list>
                
                </web-app>
                after these i'm able to get my .class file but i'm not able to run servlet in browser html and jsp are running fine.
                in this folder i have kept my jsp and html file
                Code:
                G:\Tomcat 5.5\webapps\ROOT\Hjsp
                and here servlet .class file
                Code:
                G:\Tomcat 5.5\webapps\ROOT\WEB-INF\classes
                do i need to do ne thing else???? please help.

                Comment

                • mak1084
                  New Member
                  • Jul 2007
                  • 44

                  #9
                  please post the solution.

                  Comment

                  • misaw
                    New Member
                    • Aug 2007
                    • 17

                    #10
                    Originally posted by mak1084
                    please post the solution.
                    Correct solution will not be post until and unless we correctly identify the root cause or error detail as asked by r035198x

                    the suggestion are made only on experiences we have

                    how u r accessing ur servlet thru browser ?????

                    http://localhost:8080/servlet/com.mypackage.H elloWorldExampl e

                    breaking URL as:
                    localhost = use ur server name if other than localhost
                    8080 = use ur port number if other than 8080
                    servlet as is since you have no web app name using ROOT
                    com.mypackage.H elloWorldExampl e = servlet name with packagename if any for example com.mypackage

                    Comment

                    Working...