Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Calling servlet from app Tomcat

 
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,
 
Saloon Keeper
Posts: 22133
151
Android Eclipse IDE Tomcat Server Redhat Java 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.
 
Don't count your weasels before they've popped. And now for a mulberry bush related tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic