Tomcat 5.5.6 : How to deploy and run JSP and Servlets

Discussion in 'Java' started by Martin, Jan 3, 2005.

  1. Martin

    Martin Guest

    Hi,
    I am having difficulties in deploying any servlet that I copy inside any
    context that I define.

    mycontext\
    mycontext\WEB-INF\
    mycontext\WEB-INF\web.xml
    mycontext\WEB-INF\classes\myServlet.class

    I keep getting a 404 error.

    I am running java version "1.5.0" and Tomcat 5.5.6

    I installed it in D:\Tomcat 5.5
    and did not make any change to conf\server.xml and conf\web.xml

    Can anyone come up with a concrete webapp with a servlet that successfuly
    deploys ?

    Thanks in advance
    Martin, Jan 3, 2005
    #1
    1. Advertising

  2. Martin

    Guest

    Most probably there is a configuration error on your web.xml.
    Find a working *.jsp file at: www.fgerlach.com/testapp.tar.
    Just untar this file in webapps/ and then browse
    http://localhost:8080/testapp/
    This should print the numbers from 0 to 9.
    Note that Winzip removes the empty directory WEB-INF, which is included
    in this tar file. It might or might not be necessary.
    , Jan 3, 2005
    #2
    1. Advertising

  3. Martin

    Ryan Stewart Guest

    Martin wrote:
    > Hi,
    > I am having difficulties in deploying any servlet that I copy inside

    any
    > context that I define.
    >
    > mycontext\
    > mycontext\WEB-INF\
    > mycontext\WEB-INF\web.xml
    > mycontext\WEB-INF\classes\myServlet.class
    >

    Do not place classes in the default package. Try this:
    1) Add a package statement to your servlet class:
    package mypackage;
    2) Compile your servlet and place it in the /WEB-INF/classes/mypackage
    directory.
    3) In your web.xml:
    <servlet>
    <servlet-name>someName</servlet-name>
    <servlet-class>mypackage.myServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>someName</servlet-name>
    <url-pattern>/someMapping</url-pattern>
    </servlet-mapping>
    4) Reload the context and access your servlet:
    http://localhost:<port>/<context>/someMapping

    "someName" and "someMapping" can be anything.

    Also, note that class names should begin with a capital letter, so
    prefer MyServlet over myServlet.
    Ryan Stewart, Jan 3, 2005
    #3
  4. Martin

    Guest

    The package issue is most probably the source of the problem....
    , Jan 3, 2005
    #4
  5. Martin

    kranthi

    Joined:
    Sep 30, 2008
    Messages:
    2
    iam having problem with diploying tar file

    hallo ,
    i have installed tomcat and running also gut but when want to diploy .tar file in war file section its not taking so how can i diploy my tar file please anybody help me..

    thanking you in advance
    kranthi, Oct 1, 2008
    #5
  6. Martin

    kranthi

    Joined:
    Sep 30, 2008
    Messages:
    2
    Hallo
    when i have given my carwal dir to search using tomact iam gettin this errors can any body help me please..

    thanking you in advance

    org.apache.jasper.JasperException: /search.jsp(151,22) Attribute value
    language + "/include/header.html" is quoted with " which must be escaped when used within the value
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:198)
    org.apache.jasper.compiler.Parser.parseQuoted(Parser.java:301)
    org.apache.jasper.compiler.Parser.parseAttributeValue(Parser.java:250)
    org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:212)
    org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:155)
    org.apache.jasper.compiler.Parser.parseInclude(Parser.java:869)
    org.apache.jasper.compiler.Parser.parseStandardAction(Parser.java:1136)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1466)
    org.apache.jasper.compiler.Parser.parse(Parser.java:138)
    org.apache.jasper.compiler.ParserController.doParse(ParserController.java:216)
    org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:154)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:315)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    kranthi, Oct 1, 2008
    #6
  7. Martin

    anupam.cmit

    Joined:
    Dec 11, 2010
    Messages:
    1
    deploying servlet to tomcat

    you have to edit conf/web.xml and enable servlet invoker
    open web.xml and remove comment from servlet invoker
    you can do this by find and replace in notepad
    find invoker and remove comment

    then restart your tomcat
    create the folder named classes in WEB-INF/<create here classes folder>
    and enter the address in URl localhost:8080/servlet/<your servlet name>
    anupam.cmit, Dec 11, 2010
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    4,315
  2. tiewknvc9
    Replies:
    4
    Views:
    1,732
  3. GaryDean

    Deploy won't deploy Masterpage.master

    GaryDean, Apr 14, 2009, in forum: ASP .Net
    Replies:
    1
    Views:
    393
  4. ses
    Replies:
    4
    Views:
    768
  5. ses
    Replies:
    1
    Views:
    300
    Jan Thomä
    Oct 25, 2010
Loading...

Share This Page