aspose file tools*
The moose likes Servlets and the fly likes resource not found Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "resource not found" Watch "resource not found" New topic
Author

resource not found

arvind doraiswamy
Greenhorn

Joined: Jun 19, 2004
Posts: 11
hi,
i need to write code for a minibanking appilication for my project...its bin going ok till now..where my WTK2.1 is working fine...it actually sends the data to teh servlet..but then the servlet screws up and throws a resource not found...im using tomcat 5.0.26 and theres no servlet.jar there like suggested in the documentation.My web.xml is ok but my server.xml behaves strangely...each time i tried previously viewing the servlet it showed me stuff id written three days ago...the reloadable attribute was set...any help please....thanks a million...
Arvind
Heres the code

import javax.servlet.http.*;
import javax.servlet.*;
import java.io.*;

public class MobileServlet extends HttpServlet
{
//private int mCount;
public void doGet(ServletRequest request,
ServletResponse response)
throws ServletException, IOException
{
//PrintWriter out=new PrintWriter();
InputStream input;
byte []name;
input.read(name);
System.out.println("fff"+name);
String message=new String();
response.setContentType("text/plain");
response.setContentLength(50);
/*PrintWriter requ = request.getWriter();
PrintWriter resp = response.getWriter();
System.out.println("huhhhhhhhhhh");
message="what rubbish!!!";
System.out.println(message);*/
}
}

Heres my web.xml

<?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>arvind</servlet-name>
<servlet-class>MobileServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>arvind</servlet-name>
<url-pattern>/Mobile</url-pattern>
</servlet-mapping>
</web-app>


p.s.....should i download an older version of tomcat???
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12678
    
    5
1. put your servlet in a package and correctly name the package in the servlet-class element of web.xml, change the location of the compiled class files to reflect the packge.
2. As I recall, Tomcat 5 uses a slightly different name for servlet.jar possibly servlet-api.jar
The easiest way to be absolutely sure that your revised code is loaded is to shut down Tomcat and restart it.

Bill


Java Resources at www.wbrogden.com
arvind doraiswamy
Greenhorn

Joined: Jun 19, 2004
Posts: 11
how do i do that...put a servlet in a package and stuff...could u guide me through it ...the strnager part is that when i tried th example given in the docs it worked absolutely perfect without any hitches..so i just modified the example a little changed a little changed my web.xml and boom ...resource not found...if the example ran properly..that meant my tomcat was fine..and it properly reloaded...everything fine in short...so why doesnt it wurk when i try my own code..this is extremely strange..any pointers..its really urgent...got to get a lot of stuff done by saturday..
thnx a lot
arvind
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12678
    
    5
If you don't understand what a package is in Java, you need to drop back and study the basics. Take a look at this Sun tutorial Table of Contents - there is a section on packages.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: resource not found
 
Similar Threads
Page can't displayed - problem of configuring error location with servlet name in DD
Cannot run servlets in Tomcat
Cannot run servlets in Tomcat
JSP not able to find the servlet
Geting error while i accessing URL