• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling servlet from app Tomcat

 
uday bhaskar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am new to the tomcat.I would like to call the servlet in applet
using tomcat. for that i am using web.xml following are the details but i am not able to call the servlet. can any one help on this.
In applet, i am calling with the following method,
public Object getConnection()
{
Hashtable htPutLoginData = new Hashtable(1,1);
try
{
urlcheck = new URL(getCodeBase(),"RequestInfoExample");
LoginMessage msg = new LoginMessage(urlcheck);
InputStream in = msg.sendPostMessage(htPutLoginData);
ObjectInputStream result = new ObjectInputStream(in);
in.close();
}catch(Exception e){System.out.println("Error at" + e.toString());}
return(obj);
}
My Web.xml page looks like this,
<?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/j2ee/dtds/web-app_2_3.dtd">
<web-app>

<servlet>
<servlet-name>RequestInfoExample</servlet-name>
<servlet-class>/RequestInfoExample</servlet-class>
</servlet>
</web-app>
This servlet is placed with the following hirerchy
Jakarta tomcat4.0/webapp/test/Web-Inf/classes
where test is the root
since this class is not package, even i placed the class under root and tried. I mean in the directory
/test
when i call from the applet, it shows the Error message as
Error atjava.io.FileNotFoundException: localhost:8080//RequestInfoExample
I understood as the code while calling from the applet is some where wrong!!
can any one help in this regard,
 
Tim Holloway
Saloon Keeper
Posts: 18367
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you have a slash in front of your class name in the servlet-class tag?
You should place the file RequestInfoExample.class in your WEB-INF/classes directory for it to be properly found.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic