You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by krishna prasad <kr...@hotmail.com> on 2002/06/12 19:05:30 UTC
unable to run some servlets
hi everyone,
I'm having trouble running servlets which are in a directory i created.
Details:
System: Win95
Tomcat Version: 4.0
Problem:
I created a new directory in called "kp"
"install_dir/webapps" folder. I also created WEB-INF and classes dirctories
(install_dir/webapps/kp/WEB-INF/classes).
I wrote a small servlet program and kept the .class file in classes folder.
I also wrote the xml file and kept it in WEB-INF folder.
xml file-------------------
<?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_2.dtd">
<web-app>
<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>HelloWorldServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
</web-app>
end of xml file---------------------------
when i'm trying to access from browser like this
http://localhost/kp/hello OR
http://localhost/kp/HelloWorldServlet
the browser is displaying the file not found page.
(i changed the port no. to 80 in server.xml file)
(i also inserted <DefaultContext reloadable="true"/> in server.xml)
What am i missing here? And wat really beats me is i downloaded a bookstore
example from java.sun.com in
.war format. When i placed it in the reqd folder the folders WEB-INF,
classes etc were automatically created
(install_dir/webapps/bookstore/WEB-INF/classes)
and it is working fine. Now I tried moving my HelloWorldServlet.class file
into classes folder of bookstore and made necessay changes to xml file of
bookstore in
install_dir/webapps/bookstore/WEB-INF/web.xml
and i'm able to run the helloworld servlet using
http://localhost/bookstore/hello
I'm also able to run the servlet when i put the class file in
install_dir/webapps/ROOT/WEB-INF/classes
and using http://localhost/servlet/hello.
Why am i not able to run when the file are in the folder i created. Kindly
help me with this problem.
If this prob has been addressed before kindly provide pointers
Thank you
kp
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: unable to run some servlets
Posted by "Trenton D. Adams" <tr...@telusplanet.net>.
You have to put the WAR in the webapps directory of tomcat. Or, you can
copy the entire directory tree of your app to the webapps directory. Or
you can use the tomcat webapp manager. Or you can add a <Context> to
the server.xml file pointing to your own directory.
-----Original Message-----
From: krishna prasad [mailto:krishnaprasad6@hotmail.com]
Sent: June 12, 2002 11:06 AM
To: tomcat-user@jakarta.apache.org
Subject: unable to run some servlets
hi everyone,
I'm having trouble running servlets which are in a directory i
created.
Details:
System: Win95
Tomcat Version: 4.0
Problem:
I created a new directory in called "kp" "install_dir/webapps"
folder. I also created WEB-INF and classes dirctories
(install_dir/webapps/kp/WEB-INF/classes).
I wrote a small servlet program and kept the .class file in classes
folder.
I also wrote the xml file and kept it in WEB-INF folder.
xml file-------------------
<?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_2.dtd">
<web-app>
<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>HelloWorldServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
</web-app>
end of xml file---------------------------
when i'm trying to access from browser like this
http://localhost/kp/hello OR http://localhost/kp/HelloWorldServlet
the browser is displaying the file not found page.
(i changed the port no. to 80 in server.xml file)
(i also inserted <DefaultContext reloadable="true"/> in server.xml)
What am i missing here? And wat really beats me is i downloaded a
bookstore
example from java.sun.com in
.war format. When i placed it in the reqd folder the folders WEB-INF,
classes etc were automatically created
(install_dir/webapps/bookstore/WEB-INF/classes)
and it is working fine. Now I tried moving my HelloWorldServlet.class
file
into classes folder of bookstore and made necessay changes to xml file
of
bookstore in
install_dir/webapps/bookstore/WEB-INF/web.xml
and i'm able to run the helloworld servlet using
http://localhost/bookstore/hello
I'm also able to run the servlet when i put the class file in
install_dir/webapps/ROOT/WEB-INF/classes
and using http://localhost/servlet/hello.
Why am i not able to run when the file are in the folder i created.
Kindly
help me with this problem.
If this prob has been addressed before kindly provide pointers
Thank you
kp
_________________________________________________________________
Get your FREE download of MSN Explorer at
http://explorer.msn.com/intl.asp.
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>