File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes setup tomcat6 folders in ubuntu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Tomcat
Bookmark "setup tomcat6 folders in ubuntu" Watch "setup tomcat6 folders in ubuntu" New topic
Author

setup tomcat6 folders in ubuntu

Daniel Ross
Greenhorn

Joined: Nov 26, 2010
Posts: 10
Hello everyone, I am new to this forum and also to tomcat.
I have been trying and searching for 3 days and with no success and i have an assignment due in a week,reason why i wanted to setup tomcat at home so I can do some work at home.

I have installed jdk and I can deploy java files use the command javac filename.java
actually everything works perfectly in the university but at home I do have some problem which seems to come from some sort of wrong configuration.

I cant run servlets, I can run website which are in the folder ROOT but then i have a WEB-INF/classes/ folder which contains all the classes and the string to call them is
<form action="/servlet/AllStudents" method="get">

when i do this it says the requested resource is not available, how do it set my tomcat in order to read the classes inside the folder classes and call them using /servlet/name of the class ?

i hope someone can help

thank you
---------------
ps:

this is the error I get
type Status report

message /servlet/AllStudents

description The requested resource (/servlet/AllStudents) is not available.

i tried everything but nothing works
please help!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16095
    
  21

Welcome to the JavaRanch, "sa pr".

One thing you haven't tried is using a real name on your request. We don't have a lot of rules on the CodeRanch forums, but one that we do insist on is a proper display name.

Here's more info: http://www.javaranch.com/name.jsp

Customer surveys are for companies who didn't pay proper attention to begin with.
John Deal
Greenhorn

Joined: Sep 07, 2006
Posts: 20
I have the same basic problem except I am just trying to execute a simple servlet directly. I am following the book Head First Servlets and JSP, Second Edition pages 30-31 (at least those are the pages indicated in Safari Books). I am using Ubuntu 10.04 and installed Tomcat6 as well as the administration application. Doing http://localhost:8080/ gives me the Tomcat welcome page so it is running. I also can run http://localhost:8080/manager/html/ successfully. I created the following directory/file hierarchy in /usr/share/tomcat6/webapps:

ch1/
|
WEB-INF/
|
classes/ web.xml
|
Ch1Servlet.class

My web.xml file is the following:



My Ch1Servlet.java file is as follows:



When in Firefox I try to access the address: http://localhost:8080/ch1/Serv1 I get the 404 error in part stating the following: "The requested resource (/ch1/Serv1) is not available." I also do not see it in the list of applications in the Tomcat GUI management application (not surprised there).

BTW this is not deployed as a WAR file. It is just the built directories with files copied. I restarted Tomcat several times to see if it would pick-up the new servlet but it does not seem too. Does anyone have any ideas? Am I placing my servlet in the correct directory?

Thanks. I am not the original poster here and I hope my real name shows up


SCJP 1.4, SCJD 1.5
John Deal
Greenhorn

Joined: Sep 07, 2006
Posts: 20
There is an error on line 5 of the web.xml file. The end ">" is missing (thank you W3 Validator). Sorry for any inconvenience. Still does not work. Can't seem to find the servlet.
John Deal
Greenhorn

Joined: Sep 07, 2006
Posts: 20
Got my servlet to work. There are a few problems but the main one is I was deploying to the wrong directory. It seems the correct directory for Ubuntu 10.04 Tomcat 6 is /usr/lib/tomcat6/webapps. This was not obvious from the documentation that I read or the book.

One other interesting issue is I got an error with my web.xml file on setting the encoding attribute to "ISO-8850-1" which was given in the example in the book "Head First Servlets and JSP, Second Edition". I installed tomcat6-examples and they used "ISO-8859-1" and that seem to work.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: setup tomcat6 folders in ubuntu