IE, tomcat 4.0 - running servlet kicks to localhost7070 search screen
I moved my shopping cart website (my first) to a PC running xp, downloaded j2sdk1.4.1_02 & tomcat4.0, set classpath, java_home, catalina_home. Set html in the webapps directory of Tomcat, java servlets in the webapps/mywebsite/WEB-INF/classes folder and recompiled sucessfuly. Tomcat runs on localhost7070, I can see the HTML in /mywebsite but when I click on the 'submit button' to run the servlet, my IE momentarily shows 'not found' but immediately goes to an ATT Worldnet site with a search field filled with localhost:7070.
I have no idea of what setting might be off on IE but I have checked the directorys and system variables multiple times and can't figure this out. Any ideas would be greatly appreciated.
Bruce
Your web.xml (in WEB-INF) have your Servlet URL mapping. Try and see if you can get in contact with your Servlet manualy by typing in URLs like
HTTP://localhost:7070/servlet/ProductLookup
HTTP://localhost:7070/mywebsite/servlet/ProductLookup
HTTP://localhost:7070/mywebsite/ProductLookup
and when you find it, compare it the the URL in your HTML, relative to the URL used load the HTML page.
Similar Messages
-
Tomcat crashes while running servlet chat in IE
Hi all!
I've seen similar problems posted about three years ago, but I didn't see an answer for it.
I'd be very grateful if you could help me.
I'm writing a chat, the code was taken from the J.Hunter "Servlet programming book" O'reilly, "absurdly simple chat", and adjusted (I only need the Http version). It's an applet-servlet chat.
When executed in IE, Tomcat crashes after a few (usually 5) sent messages. When executed in a debugger (I use Forte, the last available version, 4 update 1) the program works just fine...
Another question is about debugging an applet, executed in a browser - how do I do this?
Here is the code for the servlet:
=================================
import java.io.*;
import java.net.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class TryChatServlet extends HttpServlet
// source acts as the distributor of new messages
MessageSource source = new MessageSource();
// doGet() returns the next message. It blocks until there is one.
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/plain");
PrintWriter out = res.getWriter();
// Return the next message (blocking)
out.println(getNextMessage());
// doPost() accepts a new message and broadcasts it to all
// the currently listening HTTP and socket clients.
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
// Accept the new message as the "message" parameter
String message = req.getParameter("message");
// Broadcast it to all listening clients
if (message != null) broadcastMessage(message);
// Set the status code to indicate there will be no response
res.setStatus(res.SC_NO_CONTENT);
// getNextMessage() returns the next new message.
// It blocks until there is one.
public String getNextMessage() {
// Create a message sink to wait for a new message from the
// message source.
return new MessageSink().getNextMessage(source);
// broadcastMessage() informs all currently listening clients that there
// is a new message. Causes all calls to getNextMessage() to unblock.
public void broadcastMessage(String message) {
// Send the message to all the HTTP-connected clients by giving the
// message to the message source
source.sendMessage(message);
// MessageSource acts as the source for new messages.
// Clients interested in receiving new messages can
// observe this object.
class MessageSource extends Observable {
public void sendMessage(String message) {
setChanged();
notifyObservers(message);
// MessageSink acts as the receiver of new messages.
// It listens to the source.
class MessageSink implements Observer {
String message = null; // set by update() and read by getNextMessage()
// Called by the message source when it gets a new message
synchronized public void update(Observable o, Object arg) {
// Get the new message
message = (String)arg;
// Wake up our waiting thread
notify();
// Gets the next message sent out from the message source
synchronized public String getNextMessage(MessageSource source) {
// Tell source we want to be told about new messages
source.addObserver(this);
// Wait until our update() method receives a message
while (message == null) {
try { wait(); } catch (Exception ignored) { }
// Tell source to stop telling us about new messages
source.deleteObserver(this);
// Now return the message we received
// But first set the message instance variable to null
// so update() and getNextMessage() can be called again.
String messageCopy = message;
message = null;
return messageCopy;
=============================
The code for the applet is
=============================
import java.applet.*;
import java.awt.*;
import java.io.*;
import java.net.*;
import java.util.*;
public class TryChatApplet extends Applet implements Runnable {
TextArea text;
Label label;
TextField input;
Thread thread;
String user;
public void init() {
// Check if this applet was loaded directly from the filesystem.
// If so, explain to the user that this applet needs to be loaded
// from a server in order to communicate with that server's servlets.
URL codebase = getCodeBase();
if (!"http".equals(codebase.getProtocol())) {
System.out.println();
System.out.println("*** Whoops! ***");
System.out.println("This applet must be loaded from a web server.");
System.out.println("Please try again, this time fetching the HTML");
System.out.println("file containing this servlet as");
System.out.println("\"http://server:port/file.html\".");
System.out.println();
System.exit(1); // Works only from appletviewer
// Browsers throw an exception and muddle on
// Get this user's name from an applet parameter set by the servlet
// We could just ask the user, but this demonstrates a
// form of servlet->applet communication.
user = getParameter("user");
if (user == null) user = "anonymous";
// Set up the user interface...
// On top, a large TextArea showing what everyone's saying.
// Underneath, a labeled TextField to accept this user's input.
text = new TextArea();
text.setEditable(false);
label = new Label("Say something: ");
input = new TextField();
input.setEditable(true);
setLayout(new BorderLayout());
Panel panel = new Panel();
panel.setLayout(new BorderLayout());
add("Center", text);
add("South", panel);
panel.add("West", label);
panel.add("Center", input);
public void start() {
thread = new Thread(this);
thread.start();
String getNextMessage() {
String nextMessage = null;
while (nextMessage == null) {
try {
URL url = new URL(getCodeBase(), "/servlet/TryChatServlet");
HttpMessage msg = new HttpMessage(url);
InputStream in = msg.sendGetMessage();
DataInputStream data = new DataInputStream(
new BufferedInputStream(in));
nextMessage = data.readLine();
catch (SocketException e) {
// Can't connect to host, report it and wait before trying again
System.out.println("Can't connect to host: " + e.getMessage());
try { Thread.sleep(5000); } catch (InterruptedException ignored) { }
catch (FileNotFoundException e) {
// Servlet doesn't exist, report it and wait before trying again
System.out.println("Resource not found: " + e.getMessage());
try { Thread.sleep(5000); } catch (InterruptedException ignored) { }
catch (Exception e) {
// Some other problem, report it and wait before trying again
System.out.println("General exception: " +
e.getClass().getName() + ": " + e.getMessage());
try { Thread.sleep(1000); } catch (InterruptedException ignored) { }
return nextMessage + "\n";
public void run() {
while (true) {
text.appendText(getNextMessage());
public void stop() {
thread.stop();
thread = null;
void broadcastMessage(String message) {
message = user + ": " + message; // Pre-pend the speaker's name
try {
URL url = new URL(getCodeBase(), "/servlet/TryChatServlet");
HttpMessage msg = new HttpMessage(url);
Properties props = new Properties();
props.put("message", message);
msg.sendPostMessage(props);
catch (SocketException e) {
// Can't connect to host, report it and abandon the broadcast
System.out.println("Can't connect to host: " + e.getMessage());
catch (FileNotFoundException e) {
// Servlet doesn't exist, report it and abandon the broadcast
System.out.println("Resource not found: " + e.getMessage());
catch (Exception e) {
// Some other problem, report it and abandon the broadcast
System.out.println("General exception: " +
e.getClass().getName() + ": " + e.getMessage());
public boolean handleEvent(Event event) {
switch (event.id) {
case Event.ACTION_EVENT:
if (event.target == input) {
broadcastMessage(input.getText());
input.setText("");
return true;
return false;
=====================================
HttpMessage
======================================
import java.io.*;
import java.net.*;
import java.util.*;
public class HttpMessage {
URL servlet = null;
String args = null;
public HttpMessage(URL servlet) {
this.servlet = servlet;
// Performs a GET request to the previously given servlet
// with no query string.
public InputStream sendGetMessage() throws IOException {
return sendGetMessage(null);
// Performs a GET request to the previously given servlet.
// Builds a query string from the supplied Properties list.
public InputStream sendGetMessage(Properties args) throws IOException {
String argString = ""; // default
if (args != null) {
argString = "?" + toEncodedString(args);
URL url = new URL(servlet.toExternalForm() + argString);
// Turn off caching
URLConnection con = url.openConnection();
con.setUseCaches(false);
return con.getInputStream();
// Performs a POST request to the previously given servlet
// with no query string.
public InputStream sendPostMessage() throws IOException {
return sendPostMessage(null);
// Performs a POST request to the previously given servlet.
// Builds post data from the supplied Properties list.
public InputStream sendPostMessage(Properties args) throws IOException {
String argString = ""; // default
if (args != null) {
argString = toEncodedString(args); // notice no "?"
URLConnection con = servlet.openConnection();
// Prepare for both input and output
con.setDoInput(true);
con.setDoOutput(true);
// Turn off caching
con.setUseCaches(false);
// Work around a Netscape bug
con.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
// Write the arguments as post data
DataOutputStream out = new DataOutputStream(con.getOutputStream());
out.writeBytes(argString);
out.flush();
out.close();
return con.getInputStream();
// Converts a Properties list to a URL-encoded query string
private String toEncodedString(Properties args) {
StringBuffer buf = new StringBuffer();
Enumeration names = args.propertyNames();
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
String value = args.getProperty(name);
buf.append(URLEncoder.encode(name) + "=" + URLEncoder.encode(value));
if (names.hasMoreElements()) buf.append("&");
return buf.toString();
Those files are the only files needed to execute the program.The whole Tomcat crashes, and no exception
displayed.
Do I have to write the log file, or it's kept by
Tomcat itself?yes, tomcat writes a log file, you find it in the tomcat dir. but it's just very highlevel. Having a look in it could help.
Is there a way to write a log file by myself?sure. you could get the log file from tomcat by getting it from the ServletContext:
ServletContext = getServletContext();
ServletContext.log("text to log");
When I view the output window in Forte, it doesn't
even write that Tomcat crashed.
I use Tomcat that is installed with the last version
of Forte(Sun 1 Studio, update 1), I guess it's the
last version of Tomcat also.No. The lastest is 4.1.12 and i guess it's 4.0.4 with forte.
Get Tomcat standalone from jakarta.apache.org and try to run your servlet with the standalone tomcat. this could help since i also expirenced problems sometimes with the forte-integrated tomcat. -
Tomcat: How to run servlets in ROOT directory ?
Hi,
I am developing an app that has all JSP in ROOT directory.
ROOT/appname/submodule/XXX.jsp
How do I configure Tomcat so that I can place Servlets
also in the same directory.
(For better organization)
i.e I would like to run as:
http://host/appname/submodel/XXX.jsp
and
http://host/appname/submodule/YYY
where YYY is the servlet YYY.class ??
Is this doable ?Hi there,
I am running into some trouble in configuring servlet directory other than the default /example/servlet/
i am using tomcat3.2 with IIS as the webserver(NT 4.0).
in the $tomcat_home/conf/server.xml, I added the following:
<Context path="/myServletDir"
docBase="E:/myServletDir"
crossContext="false"
debug="0"
reloadable="true" >
</Context>
and i store my classes in
E:/myServletDir/WEB-INF/classes/
i even added a E:/myServletDir/WEB-INF/web.xml
and tried to add something like this as suggested by some other people in tomcat forum:
<servlet>
<servlet-name>
HelloWorldExample
</servlet-name>
<servlet-class>
HelloWorldExample
</servlet-class>
</servlet>
i stopped tomcat and restart, still can't make it work:
http://myhost/myServletDir/servlet/HelloWorldExample
or
http://myhost/myServletDir/HelloWorldExample
it would then tell me files not found. but if i put any classes in the examples/WEB-INF/classes, they would be just fine...
what should I do? please help...
thanks in advance,
ann -
Tomcat can't run servlet /servlet tag help me please!
do I config the web.xml file?
Take a look at:
http://java.sun.com/dtd/web-app_2_3.dtd
It is the definition of what can be (and in what order) in a web.xml file for servlet specification 2.3 (ie: Tomcat 4.1). -
How to Run servlet in Tomcat 5.5.9
hi
How to run servlet in tomcat 5.5.9?how to set context path in server.xml of conf folder in tomcat since there is no context tag in server.xml.
JitenHi ! I have a similar problem, well, it's along the same line ...
I'm using NetBeans 4.1, and i've coded a servlet. Using NetBeans to launch my servlet (with the bundled Tomcat 5.5.7) works fine, however i need to deploy my application unto a Tomcat 5.5.9 server.
Thus, i copied the WAR file generated by NetBeans into the Tomcat 5.5.9 webapps directory, and Tomcat expands it.
Problem is when i run my JSP pages with the form tags, they do not work on the Tomcat 5.5.9 environment. Anyone knows why?
(These work on the NetBeans Tomcat bundle 5.5.7)
My form action :
<form name="index" method="get" action="PageServlet">
My web.xml :
<servlet>
<servlet-name>PageServlet</servlet-name>
<servlet-class>application.PageServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>PageServlet</servlet-name>
<url-pattern>/PageServlet</url-pattern>
</servlet-mapping>
I'm really stumbed on why it doesn't work in Tomcat 5.5.9, any help is greatly appreciated, thanks in advance ^_^ -
How to run Servlet in Tomcat 5.5.7 Server
Hi,
How to run Servlet in Tomcat 5.5.7 Server. I mean where I should copy my *.class file.
Thanks in Advance.
bbye.In order to complile the servlet you need to tell java where to find the servlet libary (as stated above by setting the class path). or (much easier IMO)
copy the servlet-api.jar to
JavaInstallDirectory\jre\lib\ext -
How to run Servlet on Tomcat 4.0.1?
OK. I've made a simple servlet and using Tomcat 4.0.1 on Windows ME. Tomcat's root directory is C:\jakarta-tomcat-4.0.1\webapps\ROOT. I copied folder with my servlet (java's class) in tomcat's root folder. When I try to run the dialog 'File Download' is showen. Why?
Thanks.I have Tomcat 4.0. I am trying to run servlet but I could not manage it. I have put my class file in webapp/root/web-inif/classes/ I can not run my servlet... how can I manage this... what should I do more?
the errors are :
type Exception report
message Internal Server Error
description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Cannot allocate servlet instance for path /servlet/Servlet1
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:419)
at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:484)
root cause
java.lang.NoClassDefFoundError: Servlet1 (wrong name: servlet/Servlet1)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1643)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:937)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1372)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1254)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:867)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:655)
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:400)
at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:484) -
Running servlet in tomcat 4.1.18
Hi,
I am new to servlet and am having trouble running a simple servlet on tomcat 4.1.18. I keep getting an Error 404 resource not found. will someone show me how to run servlet on tomcat?Please.
ThanksTo start, make sure you have specified the servlet and mapping in your application's WEB-INF/web.xml file.
<!-- for example -->
<servlet>
<servlet-name>yourServletName</servlet-name>
<servlet-class>path.to.Servlet</servlet-class>
</sevlet>
<servlet-mapping>
<servlet-name>yourServletName</servlet-name>
<url-pattern>/servlet/yourServletName</url-pattern>
</servlet-mapping> -
How Can I Run Servlet in tomcat
Hi My Friends
Please can any one tell me how can I Run Servlet in tomcat using my own Virtual Directory � my ask about , what is the structure it must be make it in the hierarchy of the sub folder of Virtual Directory , and in watch folder it must be put the servlet files and there is any change it must be make it in any file of the tomcat files and so on
Please give my full details about this thing
And thanksWhat version of Tomcat are u using?
-
Run servlet in tomcat 4.1
Hi ,
could someone please help me.
Iam trying to run servlet in tomcat4.1 but in vain.
please helphi
If you want run a servlet in tomcat4.1,First write one html file,and servlet file.
finally you need to write web.xml.this file will be placed in web-inf folder.
You need to write this tags to run a servlet in tomcat 4.1
<servlet>
<servlet-name> name of the servlet</servlet-name>
<servlet-class>class name of the servlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>name of the servlet</servlet-name>
<url-pattern>/the ref name which u want call servlet</url-pattern>
<servlet-mapping>
Here the servlet name sholud be same .
The url pattern name must match with the action attribute value in html.
now you place your html file in root folder.
place your servlet class file in classes folder.
start ur browser type this http://localhost:8080/htmlfilename. -
Cant run servlet in Vista with Tomcat 6 version...
I lost my one day to solve this problem but at the end of the day i got mad
OS: Vista
Tomcat: 6
i have directory structure as
C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps
now i have create my own directory to run my own servlets its has structure like
C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\myApp\WEB-INF
myApp is my directory and it has subdirectory WEB-INF
WEB-INF has two sub directories named classes and src and one file web.xml
in src i have Simple.java servlet
in classes i have Simple.class
my classpath variable has value
C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet-api.jar
my path variable has value
PATH=C:\Program Files\Java\jdk1.6.0_06\bin;C:\oraclexe\app\oracle\product\10...............................
my web.xml is
<?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>
<display-name>My Test Servlet</display-name>
<description>My Test Servlet </description>
<servlet>
<servlet-name>Simple</servlet-name>
<servlet-class>Simple</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Simple</servlet-name>
<url-pattern>/Simple</url-pattern>
</servlet-mapping>
<web-app>
and i m runnig servlet as
http://localhost:8080/myApp/Simple
and finallt its giving error
HTTP Status 404 - /myApp/Simple
type Status report
message /myApp/Simple
description The requested resource (/myApp/Simple) is not available.
Apache Tomcat/6.0.16
Please solve it out ..............if i recall, you need to put that class in a package
i could be wrong but i seem to remember someone running into this awhile back
in any case, don't ever make Java classes outside of packages (bad practice) -
How to run servlet with tomcat
I have a probrom that how can I run servlet with tomcat?
I have new a folder classes in webapps\root\WEB-INF\,and put the .class
programme in it ,but http://localhost:8080/servlet/HelloWorldExample
can't run ,it give me a error than http:404 not found.
could you tell me how i can solve the problem.
Thank u very much.Hi,
Make sure the class is in classpath or in WEB-INF/classes folder and make an entry for servlet tag in web.xml in WEB-INF folder.
Regards -
How to run servlet,jsp in eclipseand to start tomcat in eclipse
hi
i want to know how to run servlet and jsp in eclipse 3.0
and to start tomcat server in same.
please reply me the steps involved indetail.
regards
saravanakumarFind Lomboz J2EE plugin and a tutorial of how to use it :)
-
Hi ,
How to run servlets in tomcat server. I created two files html and servlet file.
Html file
callservlet.html
<html>
<body>
<form method=post action="servletcalled.class">
<input type=submit value="submit">
</form>
<body>
</html>
servlet file
servletcalled.java contains
public void doPost(HttpServletRequest req,HttpServletResponse res ){
java.io.PrintWriter out = req.getWriter();
out.println("Hi, executed");
i put the callservlet.html in webapps/examples/ and servletcalled.class was in webapps/examples/Web-inf/classes/
After starting the tomcat and running the program html file is getting exceuted but when i click on the submit button this error is prompted
type Status report
message servletcalled.class
description The requested resource (servletcalled.class) is not available.
Thanks in advanceThanks,
I created a new directory in webapps
s "webapps/test".
Test directory contains
1. callservlet.html file
2. another directory Web-inf (i.e,
webapps/test/Web-inf)
Web-inf directory contains
1. web.xml file
2. another directory classes (i.e,
webapps/test/Web-inf/calsses)
classes directory contains
1. servletcalled.class file
web.xml file contains
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web
Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>Example</servlet-name>
<servlet-class>Example</servlet-class>
</servlet>
</web-app>
-->should be: <servlet-class>servletcalled</servlet-called>
then in the <web-app> scope define this:
<servlet-mapping>
<servlet-name>Example</servlet-name>
<url-pattern>/servlets/Example</url-pattern>
</servlet-mapping>
>
thanks in advance i am working hard on that but
notable to get the solutionbtw by reading the documentation of tomcat and tutorials of jave on the java site (here), you would have known this! -
How to run servlets under Tomcat 6 in java1.5
hi all
i am unable to run servlets under tomcat 6,i checked environment variables ....all are correct..im getting http 503 error....A 503 response says
503 Service Unavailable
The server is currently unable to handle the request due to a
temporary overloading or maintenance of the server
You apparently have the server mis-configured. Recheck the configuration (or reinstall Tomcat per its instructions.)
Maybe you are looking for
-
Preview text annotation customization
I'm trying to change the following in preview text annotation: 1) text & underline/strikethru colour 2) font super-/sub-script 3) line spacing I've read posts here suggesting clicking ⌘T to get to font menu which does come up but does NOT show any of
-
While Idoc to File XI processing : data format change
Hi All, need help. I am processing idoc to file in a sscenario. Here we have one field in Idoc is "Miscdata" Where we are passing one String with multiple spaces" While this String goes to XI it remove the multiple space and make single space. I
-
Images printing too small using Lightroom
I have an image that is 316x x 2317 pixels that I am printing using Lightroom 2.3 on Windows XP SP2. I use the Picture Package and add one 4x6 image to the sheet. I am using the Maximize template from the browser. The photo borders are minimum. The i
-
Hi Hi, I hit an error - 'The argument ' 0 .0' cannot be interpreted as a number' when assigning application structure, line 1, contents "9230000189000001ZF2 LMCNY 20202020080410 ..." when trying out the first loading. Do not know wher
-
Nothing on my itunes will play. I tried restarting my computer but it didn't work.
I dont know what to do.