473,624 Members | 2,539 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Could not get Tomcat Servlet to be recognize

Any help is appreciated.
Installed Tomcat 4.1 and Mysql on a WinXP. I've manage to get Tomcat
up and was able to view my first application ( myhome ) simple home
page. Tomcat was installed under C:\Tomcat4\ with
C:\Tomcat4\weba pps\myhome\WEB-INF\classes to store all my java.class
files. Under WEB-INF, I've have edit the web.xml file as

<?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-mapping>
<servlet-name>
invoker
</servlet-name>
<url-pattern>
/servlet/
</url-pattern>
</servlet-mapping>
</web-app>
After creating simple compile "hello.java " java program and place
under the classes directory, I've tried to see if the servlet will
work by targeting the URL to
http://localhost:7500/myhome/servlet/hello. This did not work. Also by
calling the servlet from another html page "/servlet/hello" did not
work either.
could someone help?
Jul 17 '05 #1
1 3889
"Hai Tran" <Ha******@qwest .com> wrote in message
news:33******** *************** ***@posting.goo gle.com...
Any help is appreciated.
Installed Tomcat 4.1 and Mysql on a WinXP. I've manage to get Tomcat
up and was able to view my first application ( myhome ) simple home
page. Tomcat was installed under C:\Tomcat4\ with
C:\Tomcat4\weba pps\myhome\WEB-INF\classes to store all my java.class
files. Under WEB-INF, I've have edit the web.xml file as

<?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-mapping>
<servlet-name>
invoker
</servlet-name>
<url-pattern>
/servlet/
</url-pattern>
</servlet-mapping>
</web-app>
After creating simple compile "hello.java " java program and place
under the classes directory, I've tried to see if the servlet will
work by targeting the URL to
http://localhost:7500/myhome/servlet/hello. This did not work. Also by
calling the servlet from another html page "/servlet/hello" did not
work either.
could someone help?


Fist, you're missing a <servlet> tag, like:
<servlet>
<servlet-name>invoker</servlet-name>
<servlet-class>com.foo.H ello</servlet-class>
</servlet>

where the servlet-name matches the servlet-name in your servlet-mapping and
servlet-class is the fully qualified java name of the class file. Second, a
url-pattern of /servlet/ means you'd type:
http://localhost:7500/myhome/servlet/

to access it. So you want something like this in your deployment descriptor:
<?xml version="1.0" encoding="UTF-8"?>

<!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>invoker</servlet-name>
<servlet-class>com.foo.H ello</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/invoke</url-pattern>
</servlet-mapping>

</web-app>

This assumes that you have the servlet Hello.class in the
/WEB-INF/classes/com/foo directory, and you would call the servlet like
this:
http://localhost:7500/myhome/invoke/

In the future, please post to comp.lang.java. help for simple questions or
comp.lang.java. programmer for advanced questions. This group is not carried
by all news servers.
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3666
by: Jagdeesh | last post by:
Hai Colleagues, I am using Tomcat 4.1.24 and JDK 1.4.0_03 in my winXP machine. I've transferred a set of folders(containing jsp files) into tomcat's webapps directory(to /webapps/bob , /webapps/sue) and i have added the folders bob, sue in my server.xml(in the context path). When i am trying to run jsp files from my browser, it works fine. But, the following jsp files reports some exceptions which is quite hard to understand. Here is...
5
4027
by: nmac | last post by:
Hi all, hopefully someone can offer some sagely advice regarding Production use of Jakarta's Tomcat. First, some brief background. My company have a servlet application that connects to a MySQL database. The servlet is deployed on two seperate win2k servers (Access to the tomcat servers is via DNS round robin load balancing). The database is on a another win2k server.
2
9504
by: kimbuba | last post by:
Hi all, i'm writing cause i'm not able to find any good resources about this topic. I'm programming on tomcat and i have my browser open to see changes i made. The problem is that i'd like to see changes immediatly, is there a way to do this, but using start-stop-reload from tomcato manager admin? I tried to add this to server.xml <Context path="/info" docBase="info" debug="0" reloadable="true">
2
5764
by: devu | last post by:
Hello, I'm getting the following error when trying to start Apache Tomcat.The version shows up in the snapshot. I can't figure out why this is happening. It is aparently the <context-param> tag. If I remove it tomcat starts properly. I have pasted web.xml below with the error. WEB.XML ?xml version="1.0" encoding="ISO-8859-1"?>
5
27979
by: Grant Collins | last post by:
Hi I am writing a web based application as part of a small project that I am undertaking using servlets beans and jsp. I already have one servlet - bean - jsp page working and I have written another servlet - bean - jsp but I am hitting an error from tomcat that I have no idea why it is failing. I am getting an org.apache.jasper.JasperException: with the root cause being java.lang.ClassNotFoundException:
1
6912
by: ptaz | last post by:
Hi I'm trying to run a web page but I get the following error. Ca anyone please tell me a solution to this. Thanks Ptaz HTTP Status 500 - type Exception report
2
12856
by: Wired Earp | last post by:
I don't get it. First of all, it claims to run on a JRE. This is obviously a fraud, it even says so when you attempt to start it: "The JAVA_HOME variable should point to a JDK and not a JRE". I can accept that, being new to it all and not really caring, but things are going downhill rather fast from here. I'm installing a simple webapp in the the the webapps folder, complete with a context.xml in the conf folder. My servlet behaves just as...
3
15394
by: Andrew Johnson | last post by:
Hi, I am trying to make a UBD DB2 7.2 connection using the Java COM.ibm.db2.jdbc.app.DB2Driver via Tomcat 3.2.1 on Solaris (and also on an AIX system with 3.3.1). I am attempting this either via JSP or a servlet. I have a separate java application that I can run from the command line and as long as the user has the correct env variables:
2
3336
by: shanmukhi | last post by:
Hi all, i created on jsf,hibernate application and i deployed on Tomcat 5.0 while running a jsf page i got error as HTTP Status 500 - -------------------------------------------------------------------------------- type Exception report
0
8179
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8685
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8341
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7174
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6112
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4184
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2612
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.