Java Web Applications
03/15/2001This article is the first in a series of articles on Apache's Jakarta-Tomcat server. The Tomcat server is a Java-based Web Application container that was created to run Servlet and JavaServer Page web applications. It has become the reference implementation for both the Servlet and JSP specifications. The purpose of this first article is to give you a basic understanding of web applications. Once we have this basic understanding, we will be able to move on to discussions of Tomcat. This article assumes that you have a basic understanding of Servlets and JSPs.
In this article we will discuss
- the definition of a web application,
- the directory structure of a web application,
- the web application deployment descriptor, and
- packaging a web application.
The definition of a web application
With the release of the Java Servlet Specification 2.2, the concept of a web application was introduced. According to this specification, a "Web Application is a collection of servlets, html pages, classes, and other resources that can be bundled and run on multiple containers from multiple vendors." To you and me, a web application is anything that resides in the web layer of an application.
One of the main characteristics of a web application is its relationship to the ServletContext. Each web application has one and only one ServletContext. This relationship is controlled by the servlet container and guarantees that web applications will not clash when storing objects in the ServletContext.
The following items can exist in a web application:
- Servlets
- JavaServer Pages
- Utility Classes
- Static Documents including, XHTML, images, etc.
- Client side classes
- Meta information that describes the web application
Note: For this series we will be using the proposed Servlet SDK 2.3.
The Directory Structure
The container that holds the components of a web application is the
directory structure in which it exists. The first step in creating a
web application is creating this structure. The following table
contains a sample web application, named onjava, and what
each of its directories should contain. Each one of these directories
should be created from the <SERVER_ROOT> of the
servlet container. An example of a <SERVER_ROOT>,
using Tomcat, would be /jakarta-tomcat-4.0/webapps.
Table 1. The Web Application Directory Structure |
|
Directory |
Contains |
/onjava | This is the root directory of the web application. All JSP and XHTML files are stored here. |
/onjava/WEB-INF |
This directory contains all resources related to the application that are not in the document root of the application. This is where your web application deployment descriptor is located. Note that the WEB-INF directory is not part of the public document. No files contained in this directory can be served directly to a client. |
/onjava/WEB-INF/classes | This directory is where servlet and utility classes are located. |
/onjava/WEB-INF/lib | This directory contains Java Archive files that the web application depends upon. For example, this is where you would place a JAR file that contained a JDBC driver. |
As you look over the contents of the web application's directory
structure, you will notice that web applications allow for classes to
be stored in both the /WEB-INF/classes and
/WEB-INF/lib directories. Of these two, the class loader
will load classes from the /classes directory first
followed by the JARs in the /lib directory. If you have
duplicate classes in both the /classes and
/lib directories, the classes in the
/classes directory will be used.
The Web application deployment descriptor
At the heart of all web applications is a deployment
descriptor. The deployment descriptor is an XML file named web.xml
located in the
/<SERVER_ROOT>/applicationname/WEB-INF/
directory. It describes configuration information for the entire web
application. For our application the location of the
web.xml file is in the /<SERVER_ROOT>/onjava
/WEB-INF/ directory. The information that is contained in the
deployment descriptor includes the following elements:
- ServletContext Init Parameters
- Localized Content
- Session Configuration
- Servlet / JSP Definitions
- Servlet / JSP Mappings
- Mime Type Mappings
- Welcome File list
- Error Pages
- Security
The following code snippet contains a limited example of a web
application deployment descriptor. As we progress through this
series, we will be looking at the web.xml file and its
elements in much more detail.
<web-app>
<display-name>The OnJava App</display-name>
<session-timeout>30</session-timeout>
<servlet>
<servlet-name>TestServlet</servlet-name>
<servlet-class>com.onjava.TestServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<init-param>
<param-name>name</param-name>
<param-value>value</param-value>
</init-param>
</servlet>
</web-app>
In this example we are setting three application level
elements. The first of the application level elements is the
<display-name>. This element simply describes the
name of the web application. It is functionally inoperative.
The second web application level element is the
<session-timeout> element. This element controls
the lifetime of the application's HttpSession object. The
<session-timeout> value that we have used above
tells the JSP/Servlet container that the HttpSession object will
become invalid after 30 minutes of inactivity.
The last application level element that we have defined is the
<servlet> element. This element defines a servlet
and its properties. We will further define the
<servlet> elements when we discuss deploying
Servlets and JSPs to Tomcat in a subsequent article.
Packaging a Web application
Now that we know what a web application is, we can package it for
deployment. The standard method for packaging web applications is to
use a Web ARchive file (WAR). You can create a WAR file by using
Java's archiving tool jar. An example of this would be to
change to the root directory of your web application and type the
following command:
jar cvf onjava.war .
This command will produce an archive file named
onjava.war that will contain your entire web
application. Now you can deploy your web application by simply
distributing this file, which we will cover in the next article,
"Installing and Configuring Tomcat."
James Goodwill is the co-Founder of Virtuas Solutions, LLC, a Colorado-based software consultancy.
Return to ONJava.com.
Showing messages 1 through 78 of 78.
-
HTTP Status 404 - /onjava/servlet/com.onjava.login
2007-06-07 01:22:54 DhirajShetty [Reply | View]
-
HTTP Status 404 - /onjava/servlet/com.onjava.login
2008-02-10 19:13:18 pakornss [Reply | View]
I use Metro 1.0, i forgot install Metro with "wsit-on-tomcat.xml" script
WepApp Error like this:
FAIL - Application at context path /fromjava could not be started -
http://localhost:9090/saiapp/HelloWorldExample
2008-03-04 16:43:45 my email [Reply | View]
HTTP Status 404 - /saiapp/HelloWorldExample
--------------------------------------------------------------------------------
type Status report
message /saiapp/HelloWorldExample
description The requested resource (/saiapp/HelloWorldExample) is not available.
--------------------------------------------------------------------------------
Apache Tomcat/6.0.13 -
HTTP Status 404 - /onjava/servlet/com.onjava.login
2007-07-23 12:42:56 RaviKA [Reply | View]
Add the below servlet mapping to your web.xml. The servlet mapping should be given under the servlet. And the example should work.
<servlet-mapping>
<servlet-name>login</servlet-name>
<url-pattern>/servlet/com.onjava.login</url-pattern>
</servlet-mapping>
-
HTTP Status 404 - /onjava/servlet/com.onjava.login
2007-07-23 12:41:20 RaviKA [Reply | View]
Add the servlet mapping to your web.xml. And the example should work. -
HTTP Status 404 - /onjava/servlet/com.onjava.login
2007-09-25 03:00:06 vikaschablani [Reply | View]
Below is the complete correct web.xml.
Do not forget <web-app> tag.
Restart the server.
The meaning of this is that in our login.jsp we have written action=servlet/com.onjava.login.
This same string "servlet/com.onjava.login" has to appear in web.xml in url-pattern. You can write any string but has to be same in jsp and in xml e.g. you can have string "Good", no problem.
The string between <servlet-mapping> and between
<servlet-name> has to be same, here it is login.
Then finally :) the string between <servlet-class> is the actual class part for your FILE login.class i.e. com.onjava.login. :)
web.xml->
-----------------------------------
<web-app>
<servlet>
<servlet-name>login</servlet-name>
<servlet-class>com.onjava.login</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>login</servlet-name>
<url-pattern>servlet/com.onjava.login</url-pattern>
</servlet-mapping>
</web-app>
------------------------------------- -
HTTP Status 404 - /onjava/servlet/com.onjava.login
2007-09-25 04:14:45 vikaschablani [Reply | View]
One correction. In url patern there is a forward slash prefixed before the string. So if in jsp string was: action="servlet/com.onjava.login", in xml it will be
<url-pattern>/servlet/com.onjava.login</url-pattern>
web.xml->
-----------------------------------
<web-app>
<servlet>
<servlet-name>login</servlet-name>
<servlet-class>com.onjava.login</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>login</servlet-name>
<url-pattern>/servlet/com.onjava.login</url-pattern>
</servlet-mapping>
</web-app>
-------------------------------------
-
HTTP Status 404 - /
2006-08-19 16:32:55 brahmadapa [Reply | View]
Hi, I have installed jakarta-tomcat-5.0.30 first time and got the following status 404 error when I start the sever and tyring to browse localhost at: http://localhost:8080/ to view the tomcat home page.
Configuration instructions got it from the below webpage: http://www.moreservlets.com/Using-Tomcat-4.html#Enable-Root-Context
Error description:
HTTP Status 404 - /
-------------------------
type Status report
message /
description: The requested resource (/) is not available.
--------------------------
I have installed tomcat in my C drive as: C:\Tomcat 5.0 and my jdk available in: C:\j2sdk1.4.2_12 and I have set the user and environment varialbles as below:
JAVA_HOME: C:\j2sdk1.4.2_12
CATALINA_HOME: C:\Tomcat 5.0
CLASSPATH: ;.;C:\j2sdk1.4.2_12\lib\tools.jar;C:\Tomcat 5.0\common\lib\servlet-api;C:\Tomcat 5.0\common\lib\jsp-api
PATH: ;C:\j2sdk1.4.2_12\bin
Please suggest me. -
HTTP Status 404 - /
2007-01-25 03:47:57 aspai [Reply | View]
Hi, I have installed jakarta-tomcat-5.0.30 first time and got the following status 404 error when I start the sever and tyring to browse localhost at: http://localhost:8080/ to view the tomcat home page.
Configuration instructions got it from the below webpage: http://www.moreservlets.com/Using-Tomcat-4.html#Enable-Root-Context
Error description:
HTTP Status 404 - /
-------------------------
type Status report
message /
description: The requested resource (/) is not available.
--------------------------
I have installed tomcat in my C drive as: C:\Tomcat 5.0 and my jdk available in: C:\j2sdk1.4.2_12 and I have set the user and environment varialbles as below:
JAVA_HOME: C:\j2sdk1.4.2_12
CATALINA_HOME: C:\Tomcat 5.0
CLASSPATH: ;.;C:\j2sdk1.4.2_12\lib\tools.jar;C:\Tomcat 5.0\common\lib\servlet-api;C:\Tomcat 5.0\common\lib\jsp-api
PATH: ;C:\j2sdk1.4.2_12\bin
pls suggest me -
HTTP Status 404 - /
2007-03-23 00:06:08 kandiyoorpreethi [Reply | View]
-
HTTP Status 404 - /
2007-07-23 12:47:54 RaviKA [Reply | View]
Did you start the tomcat. If yes did it start without any problems. Please check the log to check for errors. Sometimes java-bind error may error due to port problems. -
HTTP Status 404 - /
2007-07-20 12:36:31 mukkamalas [Reply | View]
I have installed tomcat in my C drive as: C:\Tomcat 5.0 and my jdk available in: C:\j2sdk1.4.2_12 and I have set the user and environment varialbles as below:
JAVA_HOME: C:\j2sdk1.4.2_12
CATALINA_HOME: C:\Tomcat 5.0
CLASSPATH: ;.;C:\j2sdk1.4.2_12\lib\tools.jar;C:\Tomcat 5.0\common\lib\servlet-api;C:\Tomcat 5.0\common\lib\jsp-api
PATH: ;C:\j2sdk1.4.2_12\bin
-
HTTP Status 404 - /
2007-01-24 02:56:17 vijay-kumar-mishra [Reply | View]
do one thing uninstall all the jdk n tomcat n reinstall all the software but dont delete the path's install in same place where that software was
-
HTTP Status 404 error in The requested resource (/Example) is not available.
2007-01-25 03:45:14 aspai [Reply | View]
hello sir,
error is like this:
HTTP Status 404 - /Example
--------------------------------------------------------------------------------
type Status report
message /Example
description The requested resource (/Example) is not available.
wat to do...last 3 days i am trying,pls suggest me.its very urgent..
-
HTTP Status 404 - /
2006-08-25 12:01:14 dmersino [Reply | View]
I just had this same problem. The message I got was identical and the command prompt which had the logs showed no exceptions at all. What's strange is that it was working just fine an hour prior. I tried rebooting, recompiling, etc., etc.
Finally I remembered that I had changed the name of a Filter that I was using, that was referenced in the web.xml file. Once I corrected this in my web.xml, everything returned to normal.
Normally when a class defn is incorrect you'll get a classNotFound or other exception in the logs. I don't know if this is just a bug in Apache when loading filters or if it will happen with other classes.
So, you may want to try scanning your web.xml for any mis-spelled or missing classes that the server is trying to load.
-
Status 500?
2006-06-07 06:14:19 ultimastrike [Reply | View]
I keep getting error 500 when I try to run my webapps. I've followed the directions on multiple tutorials (they're all just about the same) and this continues to be a problem. Here's the error generated:
org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
error: error reading C:\jdk1.6.0\jre\lib\ext\localedata.pack; error in opening zip file
1 error
-
404 exception for the folder created in webapps
2006-05-05 22:54:52 Sree_nice [Reply | View]
I have created a folder NewFolder in webapps, when I tried to start it, it is throwing an error 404 saying -
The requested resource (/NewFolder/) is not available.
when I try to click on start to deploy the folder in webserver from the Tomcat Manager page it is giving me a message -
FAIL - Application at context path /NewFolder could not be started
what could be the reason for these errors. Hope someone will reply to these queries asap and help me out.
Please reply it asap, it's very urgent.. -
404 exception for the folder created in webapps
2007-03-20 11:55:59 rpjd [Reply | View]
I have installed jakarta tomcat 5.0.28 and jdk1.6
I can view and execute JSP examples and servlets at htp://localhost:8080 but I am getting this error when I type http://localhost:8080/Example
HTTP Status 404 - /Example
type Status report
message /Example
description The requested resource (/Example) is not available.
Apache Tomcat/5.0.28
Any suggestions?
-
on weblogic8.1
2006-04-27 02:12:15 balu_203 [Reply | View]
actualy if we start weblogic server it shows point base server is stopped like that it shows,
what is the problem behined that .pls find out send back to me.
Thanx
Balu
-
Http 404 error the resource is not found
2006-01-09 02:03:37 nitinchoube [Reply | View]
i have register the servlet class file in web.xml file.
<servlet>
<servlet-name>check</servlet-name>
<servlet-class>LoginCheckServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>check</servlet-name>
<url-pattern>/LoginCheckServlet</url-pattern>
</servlet-mapping>
my directory structure is:
root directory:webapps
web application directory:examples
images:contains all images
Jsp:jsp files
servlets:html files
WEB-INF:web.xml
classes:servlet .class files
i have stored Login.html file in servlets folder and call the LoginCheckServlet by action attribute in form tag.
http://localhost:8080/examples/servlets/Login.html
HTTP Status 404 - /LoginCheckServlet
--------------------------------------------------------------------------------
type Status report
message /LoginCheckServlet
description The requested resource (/LoginCheckServlet) is not available.
--------------------------------------------------------------------------------
Apache Tomcat/4.1.31
plz reply it it urgent.
thanks
regards,
nitin choube
-
place the .class file?
2005-11-23 22:34:24 kethi [Reply | View]
I have been through the document and followed each step, can u please tell me where should i place the .class and .java files,
As i am new to it , can u tell me what should be the <servlet-class>?? </servlet-class>
and what should be written in action="" tag? -
place the .class file?
2006-02-15 21:57:23 subhash10 [Reply | View]
how i compile my first java servlet program under tomcat
which directory i place it
how i configer xml file
how i test my first programming -
differece between web-container
2007-06-20 23:50:19 KumarDeepak [Reply | View]
Hi
I have a little bit confusion in web-container and web-server -
place the .class file?
2006-07-18 00:33:09 Sujin [Reply | View]
well i do place my class file in class file in webapp folder inside my "mypage"...now the prob i have is error saying "error in userbean attribute class 'login' not found...but i have placed my login.class in clas folder...pls help me
do reply
it's urgent
sujin
sujin.abraham@gmail.com
-
404 error and tomcat server not starting
2005-07-19 19:19:33 wxwx [Reply | View]
Hi, I am very new to this. I followed your instrructions for installing and configuring tomcat and it worked. I am having problem with deploying the application. I keep getting the 404 error that the com.onjava.login does not exist. I changed the web.xml and server.xml as described. Uncommented the invoker servlet mapping as well. Nothing works. Another major problem is that once I save the web.xml under the WEB-INF folder, I cannot restart Tomcat. I have to take the file web.xml out of this server to restart tomcat. It is very-very urgent. Please help.
-
HTTP Status 404
2005-02-17 04:46:39 Doro [Reply | View]
hi
Im having hard time trying to browse the following servlet. Here is the error it outputs.
HTTP Status 404 - /jktomcat/200100809/WEBINFO/classes/project/servlet/HelloServlet
type Status report
message /jktomcat/200100809/WEB-INFO/classes/project/servlet/HelloServlet
description The requested resource (/jktomcat/200100809/WEB-INFO/classes/project/servlet/HelloServlet) is not available.
the servlet is as follows
package project;
import java.io.*;
import javax.servlet.http.*;
import javax.servlet.*;
public class HelloServlet extends HttpServlet {
public void doGet (HttpServletRequest req,
HttpServletResponse res)
throws ServletException, IOException
{
PrintWriter out = res.getWriter();
out.println("Hello, world!");
out.close();
}
}
the xml file is
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>project.HelloServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/servlet/project/HelloServlet</url-pattern>
</servlet-mapping>
</web-app>
the directory
csweb\jktomcat\200100809\WEBINFO\
web.xml
classes
project\HelloServlet.class
lib
"library file that came with Tomcat"
i compiled the program outside the tomcat environment and and copied the class file into the project package. it compiled succefully.
-
Regarding libs in Tomcat Server
2004-10-25 06:19:34 kishans [Reply | View]
sir,
what is the difference between lib folder in shared,common and server folders in Tomcat server.Its very urgent please respond quickly
-
type "jar cvf onjava.war" where with what?
2004-04-28 22:00:30 doubleoevan [Reply | View]
Packaging a Web application
Now that we know what a web application is, we can package it for deployment. The standard method for packaging web applications is to use a Web ARchive file (WAR). You can create a WAR file by using Java's archiving tool jar. An example of this would be to change to the root directory of your web application and type the following command:
jar cvf onjava.war .
-
404 Error
2003-05-15 10:00:34 anonymous2 [Reply | View]
The previous solutions for the 404 Error will work for this servlet, meaning that you would have to include a servlet-mapping for each servlet in your application...to tedious. A better solution is to uncomment the servlet-mapping element for the invoker servlet in the [CATALINA_HOME]\conf\web.xml file. Look under the section "Built In Servlet Mappings" you should find the subsection comment "The mapping for the invoker servlet". Uncomment the servlet-mapping element, it's commented out in version 4.1.18, I don't know about any of the other versions. Fire up Tomcat and it should now be able to find your servlets...life is good. -
404 Error
2005-10-14 18:20:53 rizalina83 [Reply | View]
Hi. I don't know who you are, but I just wanted to thank you. I've been wrestling with Tomcat for the past 3 weeks, and I could never get the darn thing working. Well, up until I read your post. I just wanted to Thank You! Heck, you helped me more than my professor!
Kudos,
Riza -
404 Error
2003-10-08 08:48:23 anonymous2 [Reply | View]
Well done for putting up this info about HTTP 404 messages. I couldn't find it anywhere else on the web. Why did Tomcat comment out the invoker servlet mapping in the latest releases? They should clearly warn people that their servlets wont de deployed until they uncomment this mapping. Thanks again!
-
Deploying the WAR
2003-03-11 16:07:44 anonymous2 [Reply | View]
The article is very concise, fair play to the author - its the best I've seen on the web. However, I dont think I have configured my server.xml correctly because when I deploy the WAR file to TOMCAT_HOME/webapps, and after restarting tomcat - it doesnt work i.e. 404 Error. I have no problem with any other part of the tutorial except the last stage. Any ideas anyone?
-
404 Error - resolution
2003-01-29 08:34:04 anonymous2 [Reply | View]
I have noted that the only way to get around the 404 Error when trying to load servlets is to place the following code in web.xml before the servlet initialisation, inside <web-app></web-app>:
"
<servlet-mapping>
<servlet-name>YourServlet</servlet-name>
<url-pattern>/YourServlet</url-pattern>
</servlet-mapping>
"
This should solve the 404 error. Cheers, Shannon -
404 Error - resolution
2006-05-05 07:03:16 Sree_nice [Reply | View]
I tried all those tips mentioned but still I am unable to get the servlets executed. Whatever changes I make it is showing :
Requested resources /Myfolder/Servlet_Name not available.
Can anyone give me detailed explanation where to place my .html, .class and .java files so that i can compile them successfully.
Please reply asap.
-
Doesn't work
2003-01-27 03:25:47 anonymous2 [Reply | View]
I appreciate step by step explanations, but the problem is this doesn't work. I always get 404, The requested resource (/onjava/login) is not available. :((
Why can't someone make a simple nice article on deploying servlets to tomcat that actually works?!
-
thank you
2003-01-13 22:21:17 anonymous2 [Reply | View]
Nice article--thanks for the simplicity and clarity.
-
error 404- servlet would not load
2002-12-16 00:19:32 anonymous2 [Reply | View]
Even I got this error and man...it bugged the hell out of me...Thanks to this note on the modified web.xml file
Thanks to the good soul who researched this....
error 404- servlet would not load
2002-11-18 12:37:46 anonymous
-
error 404- servlet would not load
2002-11-18 12:37:46 anonymous2 [Reply | View]
I just want to share this with anyone having this problem.
Despite setting the server.xml netry for the context and, having the correct directory structure, the servlet login wouldn't load and kept giving a 404 error.
I managed to get it right by setting the web.xml file this way :
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>
login
</servlet-name>
<servlet-class>
com.onjava.login
</servlet-class>
<load-on-startup>
1
</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>
login
</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
</web-app>
I don't know if this makes any sense, but the node <url-pattern> did it and it works now. -
error 404- servlet would not load
2003-07-14 04:40:52 anonymous2 [Reply | View]
I have my project folder and i have made modification in my server.xml i have added
context path
in the web.xml in the webapps /web-inf folder i am doing the servlet mapping.. but it is taking the file from the root only
<web-app>
<display-name>Application </display-name>
<session-timeout>30</session-timeout>
<servlet>
<servlet-name>LoginServlet</servlet-name>
<servlet-class>com.project.LoginServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>LoginServlet</servlet-name>
<url-pattern>project/servlet/*</url-pattern>
</servlet-mapping>
</web-app>
what is the solution ?..plz write back soon
vijay_shah_78@rediffmail.com -
error 404- servlet would not load
2005-11-17 02:41:24 Shreyas [Reply | View]
Tomcat has following folders
bin, common, conf, logs, server, shared, temp and webapps
The classpath is an environment variable that tells the java compiler javac.exe where to look for class files to import or java.exe where to find class files to interpret.
The path is an environment variable that tells the command processor where to look for executable files. e.g. *.exe, *.com and *.bat files.
Compiling a servlet
You require to include in your classpath
D:\j2sdk1.4.2_03\lib\tools.jar, where j2sdk1.4.2_03 is a java installation. now you can compile servlet source file, with javac Servlet_sourcename.java
Setting tomcat to allow servlets to run
create your WApp folder containing web application this contains WEB-INF and folders like classes, lib and web.xml folders.
In web.xml folder of above web application you require to include
<servlet>
<servlet-name>Servlet_Name</servlet-name>
<servlet-class>Servlet_class</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Servlet_Name</servlet-name>
<url-pattern>/Servlet_class</url-pattern>
</servlet-mapping>
Add following text in tomcat_instal\conf\server.xml
before </Host> tag
<Context path="/WApp"
docBase="D:\tomcat\webapps\webAppln">
</Context>
To execute servlet on Tomcat server
at classpath include tomcat_dir\bin
and type at command prompt startup
At browser
http://localhost:8080/WApp/Servlet-class
will give you servlet.
-
error 404- servlet would not load
2006-01-09 04:16:57 nitinchoube [Reply | View]
Add following text in tomcat_instal\conf\server.xml
before </Host> tag
<Context path="/WApp"
docBase="D:\tomcat\webapps\webAppln">
</Context>
when i done this after that my tomcat server is not running it terminate immidetly.plz tell me.can i type that mension above or any other canges in the server.xml file.
plz reply it is urgent.
thanks
regards,
nitin -
error 404- servlet would not load
2006-04-27 12:24:08 codedmind [Reply | View]
Can you please please tell me how you finally worked around it, i also followed the instructions written here but when i changed the server and run the tomcat , it is not starting and the window is closing as soon as it opens.
I will appreciate your help...i am strugelling with trying to run a somple hello world example on tomcat for last 2 weeks...i have to finist the project but haven't yet statred...
please reply asap.. -
error 404- servlet would not load
2006-01-09 03:55:43 nitinchoube [Reply | View]
thanks u r send me the answer.i have one Login.html file on that we r accessing the servlet file to checking the uname & pass but it will give an error:http error 404 that this servlet file is not found plz.reply.
thanks again
regards,
nitin
-
Web App series - well worth it
2002-10-13 21:16:38 anonymous2 [Reply | View]
Just want to let you know that your explanation
of web application architecture is nicely done.
The core concepts have been isolated and presented
in simple way - i got the message the 1st time
well done !
-
Tomcat 4 with Apache [RE]
2002-09-20 01:20:05 anonymous2 [Reply | View]
Personaly, y use two methods :
* Proxy configuration
* mod_jk
mod_jk (use mod_jk2 if possible) is very good
method to separate static object (html, gif, ...) and dynamic object (jsp/servlet)
for mod_jk, see jakarta.apache.org
-
JavaOne 2002
2002-03-17 17:33:04 dhecksel [Reply | View]
There is a BOF session at JavaOne 2002
that covers this subject matter.
-
PS to the message below
2002-01-16 11:09:52 daveferre [Reply | View]
You might want to do part 2 of this article to get the tomcat and jdk installations first. My message makes more sense if you do because it assumes you have the jdk and the jar.exe file. Part 2 is at:
http://www.onjava.com/pub/a/onjava/2001/03/29/tomcat.html
dave
-
I, for one, appreciate the hand holding
2002-01-16 11:02:13 daveferre [Reply | View]
I know, you experts find this to be too much hand holding, but it's just what I needed as being someone totally new to the subject. Just a couple of comments, to get the onjava.war file created, I had to modify the article example:
from: jar cvf onjava.war
to: jar cvf onjava.war onjava
... and then modify the Win PATH command so jar.exe would be found in d:\jdk1.3\bin, since I'm running it from:
d:\jakarta-tomcat-4.0\webapps.
Once the above was done, I got the onjava.war file.
-
hmmm
2001-11-23 00:00:51 tmwhalens [Reply | View]
sometimes what you get with articles like this, is someone trying to help others but not tell TOO much. why? if you questioned your job security would YOU tell everything you knew?
-
Too poor
2001-09-19 08:38:42 ni-k [Reply | View]
I thought i was going to find really useful info about dpeloying web apps with a WAR. Thanks anyway
-
more more more
2001-06-20 01:51:31 antonrechenauer [Reply | View]
A few links would be nice (but I cant find better stuff on the web?!) - I think that everbody working with apache/tomcat/servlet needs more and detailed infomations
-
Tomcat 4 with Apache
2001-04-02 21:02:52 purav [Reply | View]
Hi..Maybe an article on how to use Tomcat 4 with Apache web server i.e to use tomcat just as a servlet Engine.





On running the tutorials on my machine i get the following HTTP error after submitting the login.jsp page . I fail to realise as to where does it contain the pathname folder servlet .
My Web/xml entry is as follows:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>The OnJava App</display-name>
<session-timeout>30</session-timeout>
<servlet>
<servlet-name>login</servlet-name>
<servlet-class>com.onjava.login</servlet-class>
<load-on-startup>1</load-on-startup>
<init-param>
<param-name></param-name>
<param-value></param-value>
</init-param>
</servlet>
</web-app>
Any guidance in this regards will be highly appreciated .
********************ERROR **********************
HTTP Status 404 - /onjava/servlet/com.onjava.login
type Status report
message /onjava/servlet/com.onjava.login
description The requested resource (/onjava/servlet/com.onjava.login) is not available.
Apache Tomcat/5.5.23