Tomcat 5.5.6 : How to deploy and run JSP and Servlets

M

Martin

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
 
F

frankgerlach22

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.
 
R

Ryan Stewart

Martin said:
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.
 
Joined
Sep 30, 2008
Messages
2
Reaction score
0
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
 
Joined
Sep 30, 2008
Messages
2
Reaction score
0
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)
 
Joined
Dec 11, 2010
Messages
1
Reaction score
0
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>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top