Where do u put servlets in Tomcat 4.1?
Where do u put servlets in Tomcat 4.1? and how do you acces them?
I've tried accesing SetMyCookie servlet (/myapp/WEB-INF/classes/SetMyCookie.java) using then following url:
http://localhost:8080/myapp/servlet/SetMyCookie, but I keep getting a 404 error - The requested resource (/myapp/servlet/SetMyCookie) is not available
Take a look at
http://forum.java.sun.com/thread.jsp?forum=33&thread=373591&tstart=0&trange=15
Similar Messages
-
Where do i put servlets to application server
Hi!
we develop servlet in JDeveloper.But we must use application server.What we must do?For ex:Which directory we must put servlets?Directory:
$ORACLE_HOME/j2ee/home/default-web-app/WEB-INF/classes
Example:
Sample Servlet class name : HelloWorld.class
http://<hostname>:<port>/j2ee/servlet/HelloWorld -
Where i can put my servlet class in tomcat 4.1
where i can put my servlet class in tomcat 4.1 ?
hi,
you have to put your serlet class file in
Tomcat\webapps\
Here create a directory as you wish
then, Tomcat\webapps\your directory\WEB-INF\classes
and you have to copy web.xml to WEB-INF directoy.
Hope this will help.
Regards
Sekhar -
Where should I put Java Servlet Spec
Dear all,
I'm in the process of installing Oracle Application Express Listener where it needs Java Servlet Spec 2.3. I got the Spec downloaded, but I don't know where should I put it. How come it's hard to find documentation about this? Please help....
Currently I'm using Linux 64.
Best regards,
ValOh,
haha.. I just realized that....
About System Requirements
Oracle Application Express Listener system and space requirements are as follows:
Oracle Database (Enterprise Edition, Standard Edition or Standard Edition One) release 10.2.0.3 or higher, or Oracle Database 10g Release 2 Express Edition or higher.
Java 6 Update 20 JDK or higher.
Java Servlet Specification 2.3 or higher.
Web browser requirements:
o
Microsoft Internet Explorer 8.0 or higher.
o
Mozilla Firefox 3.0 or higher.
o
Google Chrome 2.0 or higher. -
I just started to work with Tomcat and I compiled the helloWorld sevlet.
It's said from a book that the sevlet should be placed in serlver_root/webapps/ROOT/WEB-INF/classes, however there isn't a "classes" folder in my WEB-INF folder. So I put the helloWorld sevlet in the WEB-INF folder.
Then I type http://localhost:8080/servlet/helloworld in my browser, I get a message from the sever said "The requested resource (/servlet/HelloWorld) is not available".
Could anybody tell me how can solve this prolbem, where should I put the sevelt?have ones more a look to your book - especially to information about the configuration file "web.xml" which also should be placed in the WEB-INF folder. This file defines which servlets should be found by the server and which request-URL should be mapped to this servlet.
for examples concerning the web.xml file see those already defined in your server. copy one and edit it for your needs. if you really want to understand what else might be configured using web.xml see the DTD for this file - it's pretty good documented!
hope it helps :) -
Where do I put config files for a webapp (war file)?
To my understanding a war file is supposed to be dropped in. It's isn't intended to be unzipped by the person installing the webapp. Inside my web app I have some xml files I access to get configuration information for how the servlet works. This xml file is intended to be edited by the sysadmin using the webapp. So, it's obvious I can't put my xml file inside my war file otherwise they'd have to unzip it to edit it. So my question is, where do I put it? What is the normal place to put stuff like this for a webapp?
Example:
I make a servlet (or jsp/custom tags) that generates an explorer-like directory tree. It reads the tree folders and files from an xml file. So one sysadmin might make a tree that looks like this:
Fruit
|-apples
| |-Gala
|-oranges
|-pears
another sysadmin might make a tree that looks like this:
Bookstore
|-Technical Books
| |- JSP to go
|-Children's Books
|-Dr Seuss
And these are defined in the xml file.
It's driving me crazy because I want to make my webapp deployable in a war file. Since I have to unzip it right now, the war file is useless.
Thanks,
DavidI don't have the answer, but I understand your pain. I was trying to figure this out last year before my company went out of business and made this problem go away.
The issue is that you want to have a user install your webapp by deploying the war file and configure the app without unzipping the war file. If you can start the webapp first, why not just put the default or empty configuration file somewhere in your webapp director structure and write an administration servlet or JSP to configure it.
If you must configure the application before it can start up, the following might apply.
The obvious approach would be to install a properties or xml file separately from the war file and let the user edit that file. The problem is that your servlets and jsps need to be able to find it at run time. This is problematic because the current directory for relative paths seems to vary from one server to another. If I remember correctly, on Windows NT running Tomcat, current directory points to C:\jakarta-tomcat-x.x.x\bin. When running Websphere, it points to C:\WINNT. You can figure this out for the server your user is going to be running and have them put the file in one of those places. But I don't like putting my application files in places like that.
I can't remember at the moment how it works in other servers, but at least in Tomcat you might put the configuration file in the webapps directory with your war file. Then you could have your servlet do a getServletContext().getRealPath() or something like that and back up the path one level to get to the file.
At one point I thought it would be nice to put the path to the configuration file in the system environment, but we couldn't find any way in Java to get access to it.
Will. -
Where do I put all my service classes?
I am new weblogic server environment. I want to know where do I put all my service classes? I am deploying all my servlet in WEB-INF/classes directory (under the context root) but donot know where to put the service classes. (The service classes have the jdbc and sql code in them. They are like simple java beans. I don't have any sql in the servlet classes).
<p>Hello,</p>
<p>If the only other classes that use your service classes are in your webapp then putting them under WEB-INF/classes is perfectly acceptable, you might want to wrap them up in their own jar file and stick them under WEB-INF/lib, it is up to you.</p>
<p>
Hussein Badakhchani</br>
</p> -
Where do I put my beans?
With a default installation of IAS 1.1 and relative to Oracle_Home, where does one put .class files for Java beans? And what is plan B when that doesn't work?
Just to clarify, the CLASSPATH doesn't need to point there to run Tomcat.
Tomcat has its own idea of Classpath, seperate from the system one.
The ONLY reason I could think of to point the classpath at the directory here, is if you were compiling a class with dependencies on classes you have already compiled. Normally you don't need it. -
I am new to Java Servlets. I am trying to run a servlet on TOMCAT but I don't know where to place my Servlet class file. TOMCAT works ok with sample jar file. Please guide.
-- HTML code
<HTML>
<HEAD>
<TITLE> Request Object </TITLE>
</HEAD>
<BODY>
<FORM METHOD="POST" ACTION="/servlet/WelcomeServlet">
Enter your Name: <INPUT TYPE=TEXT NAME="myName">
<INPUT TYPE="SUBMIT" VALUE="Send Name">
</FORM>
</BODY>
</HTML>
-- Servlet Code
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
public class WelcomeServlet extends HttpServlet {
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
String Name = request.getParameter("myName");
PrintWriter out = response.getWriter();
String mName = "test";
try {
mName = gName("AAA","VVV");
catch (SQLException ex)
out.println("SQLException");
out.println("Welcome 1.1 " + Name + " !" + " mName " + mName);
public String gName(String inputUserid, String inputPwd)
throws SQLException{
String vname = "Test";
return vname;
thanks
VineetI have Tomcat version 4.0 installed on my machine. If you look at the directory where you have Tomcat installed, you should find the directory structure:
tomcat-folder/webapps/root/web-inf/classes
Try placing your class files in the classes folder. -
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 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?
-
Getting error 404 when iam running a simple login servlet in tomcat
hi
this is my Login.java
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class Login extends HttpServlet
public void doPost(HttpServletRequest rq, HttpServletResponse rs)
String username =rq.getParameter("username");
String password =rq.getParameter("password");
try{
rs.setContentType("text/html");
PrintWriter out=rs.getWriter();
out.println("<html><body>");
out.println("thank u, " + username + "you r logged sucessfully");
out.println("</body></html>");
out.close();
}catch(Exception e){
e.printStackTrace();
i have saved in the form ofC:\Program Files\apache-tomcat-4.1\webapps\sravan\WEB-INF\classes\Login.class
where sravan is my folder
step 2: Login.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>login page</title></head>
<body>
<h1> WELCOME TO THE SERVLET HOME PAGE</h1>
ENTER UR USERNAME AND PASSWORD
<form action="/sravan/Login" method="Post">
username<input type="text" name="username" >
password<input type="password" name="password" >
<input type="submit" value="submit"></form>
</body>
</html>
i have saved in the form C:\Program Files\apache-tomcat-4.1\webapps\sravan\Login.html
step3:
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>
<display-name>beginning j2ee</display-name>
<servlet>
<servlet-name>Login</servlet-name>
<servlet-class>Login</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Login</servlet-name>
<url-pattern>Login</url-pattern>
</servlet-mapping>
</web-app>
i have saved in C:\Program Files\apache-tomcat-4.1\webapps\sravan\WEB-INF\web.xml
step4:
here is my server.xml
<Context path="/sravan" docBase="sravan" debug="0" reloadable="true" privileged="true"/>
saved in C:\Program Files\apache-tomcat-4.1\webapps\sravan\WEB-INF\server.xml
everything is fine....program is compiled ...but when iam running the servlet in tomcat iam getting error 404 Login.html not found....
so plz kindly help me this my first servlet .....There seems not to be any '.html' in your url-pattern
<url-pattern>Login</url-pattern>- so i presume you should use
http://yourhost/Logininstead. -
How to run a servlet in Tomcat 5.0 server
HI Everybody,
I want to know how to run the servlet file on my tomcat 5.0 server. that is where to place a class file and deployment details.
Thanks In ADVANCESourav_cs wrote:
I am a biginner to start servlet i get confusion to configure servlet in tomcat 5 where it should be saved in tomcat directory and how to execute that as first timeHi,
goto
tomcat 5.0\webappsnow create a folder here. this is your webapplication project name. Let's suppose it as "TestApp"
inside this create directories as follows :
TestApp
|
|-----JSP/htmls( if you have any )
|
|-----WEB-INF(File Folder)
|
|-----web.xml
|-----lib ( Directory. place all the .jar files which are required for this project(if any) )
|-----classes ( .class files. )[all of your java code should be placed here.](servlets / beans/ pojo )this is the general Directory structure of a web application. now you've to place the compiled .class file of your servlet in the "TestApp\WEB-INF\classes" directory. make sure that you've configured the servlet in Deploment Desctiptor, i.e, web.xml.
now start the server and type the url like : "http://localhost:8080/TestApp/TestServlet"
the port no. 8080 is the default port no. of tomcat. you have to give your port no. if u've modified it. and TestServlet is the <url-pattern> of your servlet.
go through some tutorials .. then you can easily know that
Diablo -
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 -
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!
Maybe you are looking for
-
How can I use regular expression to open files of certain types in java?
Ok this is the problem I am facing: I have a command line input of something like "/usr/foo/bar/*.html" and there are multiple files in that folder that end with .html. How can I use the input to go through/open all the .html files in Java? Help woul
-
How to restart "Fill Header Table for Table EQUI" job?
I've made some changes to the job through troubleshooting guide. Now my problem is I can't restart the job. The system says that the job is already running. How should I go about this?
-
Updated N95-8gb Now None of my soft keys or center...
also when i put in my product code it says i can update to 31.01.11 or something but it says i am up to date at 20.??.?? any help would be appreciated
-
How to add .mpg file in my jsp
I wanted to run mpg (video) files within my jsp frame.I will appreciate if somebody forward me the code for that.... Regards, srbwin
-
Everyone group in an alternate RDBMS Security Realm
We have implemented an alternate Oracle RDBMS security realm. The problem we have is that users added to the RDBMS realm do not show up in the console display of the Everyone group. Only users in the file realm show. Has anybody else experienced this