• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

First Jsp - HTTP 404/Not Found

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
I have displayed the tomcat default page but when i try my own jsp i get a HTTP 404 - File not found in my
Internet Explorer. i would greatly appreciate any insight.
Thanks,
Jim
 
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
where did u place ur jsp page in??? better place it in Web directory!! im sure u will have a directory called Web in ur tomcat server , just place ur jsp page there and it query, it should work!!
 
Desperado
Posts: 3226
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which version of TOMCAT do you have installed?
I am an advocate of placing the JSPs in one directory under the root, which has the name (or facsimile) related to the application name.
I don't know how many beginners with TOMCAT know this, but you can have your JSPs wherever you like. You don't need to place them In a "special" place.
You do have to tell TOMCAT that you want to do this and also where the document root for the application is going to be.
In the server.xml file, you can state:
<!-- My Application Context -->
<Context path="/myapplication" docBase="C:\myapp" debug="0"/>
I forget the exact meaning of "debug" but you get the picture.
Then your application root would be at c:\myapp.
Another thing, while in this subject, is that you can define the servlet path name to your servlets using the <servlet-mapping> element in web.xml.
There is nothing sacred about the /servlet/ part of the path.
 
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Put it in your webapps directory - actually, you should stick it in a subidirectory in webapps (i.e. webapps/yourapp).
Also, you'll probably need to make an additional context entry in tomcat.conf
Open up tomcat.conf and look for the line like this:
<b>ApJServMount /examples /root</b>
and add your own directory to it so it looks like
<b>ApJServMount /examples /root /yourapp</b>
If you just installed Tomcat and haven't changed anything else it should be as simple as this. (of course there is a 90% chance I am forgetting something but Im sure somebody else will help out if I have)
Good luck
 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All the configurations and stuff may be still too confusing for you. I usually do this before i start messing with web.xml or server.xml.
In your Tomcat\webapps directory create folder and call it, for example, myproject. Place your test.jsp page in that folder,
restart Tomcat. Open up your browser and type http://localhost:8080/myproject/test.jsp
That is all you shoul do.
 
Jim Panagiotopoulos
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
First off thanks for the prompt responses!I reinstalled Tomcat in order to get a fresh start.I think i've tried to do all those things and its still not working.Here's the response in the dos screen:
Ctx():404 R( +/ExJSP/MyFirstJSP.jsp + null) JSP file not found.
I'm pretty sure that because i'm trying a little of everyone's suggestions im getting thrown off with the directories and editing variables and stuff.Well I've been at it for over 10 hours now and i want to get this right! lol! If any one can give me a step by step installation guide i would appreciate it.
Thanks Vivek,Tony,B.J.,and Mocca for your input.I've learned alot already!
Jim
 
BJ Grau
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh, I think maybe you should ignore what I said about Tomcat.conf - I apologize if I confused you. I am using Apache with Tomcat which has involved Tomcat.conf but you shouldn't worry about it.
Anyway, Mocca Az and Vivek probably have the best advice here - keep it simple.
Does your out of the box Tomcat install work at all? Can you run any of the examples? Please tell me the directory on your machine that MyFirstJSP.jsp is located in, and also exactly what URL you are entering in your browser.
Hang in there.

[This message has been edited by BJ Grau (edited September 02, 2001).]
[This message has been edited by BJ Grau (edited September 02, 2001).]
[This message has been edited by BJ Grau (edited September 02, 2001).]
[This message has been edited by BJ Grau (edited September 02, 2001).]
 
Jim Panagiotopoulos
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi BJ,
No apologies necessary . You guys have been a big help.
The file is in c:\tomcat\ExJSP\MyFirstJSP.jsp.
I can see the default page and run its examples.Do i have to set an environmental variable that i perhaps have overlooked?
My autoexec.bat looks like this:
rem - By Windows 98 Network - C:\WINDOWS\net start
SET PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\JDK1.2.1\BIN;%PATH%
I know that i have to set HOME_PATH=C\JDK1.2.1.
I'm not so sure if i'm supposed to change the classpath in tomcat.bat or in autoexec.bat though. lol!What do you think?

Thanks ,
Jim
Tomcat Marathoner
 
Jim Panagiotopoulos
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for to Vivek,Tony,B.J.,and Mocca for your input ! I finally installed tomcat! aaahhhhhhh..........zzzzzzzzzzzzzzzzzzzzz
 
mocca az
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jim,
You didn't follow instructions that i posted. If you want to keep existing path to your .jsp files then you must follow instructions posted by sheriff Tony, therefore you must edit server.xml found in C:\Tomcat\conf directory.
If you want keep it simple then you must follow instructions posted by me earlier, which means that your .jsp pages must live in C:\Tomcat\webapps\ExJSP\MyFirstJSP.jsp.
If you can run default examples than your CLASSPATH, JAVA_HOME & TOMCAT_HOME are set correctly.
follow this steps
1. Create folder called ExJSP in C:\Tomcat\webapps
= C:\Tomcat\webapps\ExJSP
2. Put MyFirstJSP.jsp in this folder
= C:\Tomcat\webapps\ExJSP\MyFirstJSP.jsp
3. Start Tomcat or restart it if its running already so the changes take affect.
4. Open up your browser and type http://localhost:8080/ExJSP/MyFirstJSP.jsp
This is it.
The error message you are getting at the moment means that Tomcat can't find directory ExJSP therefore MyFirstJSP.jsp can't be found as well. Reason for this is because your folder/file does not live in C:\Tomcat\webapps and the place where it lives "c:\tomcat\ExJSP\MyFirstJSP.jsp" is not configured in server.xml.
If you follow the steps i describe above, you can't miss it.
Hopefully after you get some sleep you'll clear your head up a bit an stay with me on this one, OK...
 
permaculture is giving a gift to your future self. After reading this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic