| Author |
Not able to execute a sample jsp file
|
Padma priya Gururajan
Ranch Hand
Joined: Oct 05, 2006
Posts: 411
|
|
Hi, I have placed a simple jsp file(test.jsp) within webapp/check/test.jsp. And, I tried to run it from the browser as: http://localhost:8080/check I was not able to see the link to the jsp file. I had correctly set the environment variables(java_home and path). Can anybody tell me as to why I am not able to execute the code? Thanks.
|
Padma priya N.G.
Be the change you want to be - Mahatma Gandhi
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
|
What else is in the "check" directory?
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12929
|
|
|
Try: http://localhost:8080/check/test.jsp instead of http://localhost:8080/check (without test.jsp).
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
Padma priya Gururajan
Ranch Hand
Joined: Oct 05, 2006
Posts: 411
|
|
Hi, check is the name of the directory under which the jsp file is placed.Thanks.
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Originally posted by Padma priya Gururajan: Hi, check is the name of the directory under which the jsp file is placed.Thanks.
Do you have a WEB-INF directory? If not, you need to add one to your checks directory in order for Tomcat to see it as a webapplication.
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12929
|
|
Originally posted by Padma priya Gururajan: Hi, check is the name of the directory under which the jsp file is placed.Thanks.
I know, but Tomcat doesn't automatically find test.jsp in that directory if you only specify the name of the directory in the URL (.../check instead of .../check/test.jsp).
|
 |
Padma priya Gururajan
Ranch Hand
Joined: Oct 05, 2006
Posts: 411
|
|
Hi, I tried all options like 1) http://localhost:8080/check 2) http://localhost:8080/check/test.jsp But, I am unable to get the contents of test.jsp. I get the error message saying that "The resource cannot be found" Can anybody help me? Thanks.
|
 |
Padma priya Gururajan
Ranch Hand
Joined: Oct 05, 2006
Posts: 411
|
|
Hi, Is it necesary that i should have the entire file as a war file? With regards, Padma priya N.G.
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12929
|
|
Which version of Tomcat are you using? I tested the following with Tomcat 6.0 and it works: - In the webapps directory create a subdirectory 'check' - Add a file 'test.jsp' in that subdirectory - Start Tomcat - Open a browser and go to http://localhost:8080/check/test.jsp But it might not work in the same way for all versions of Tomcat, and it may also depend on how Tomcat is configured. Normally you should have a proper webapplication with a WEB-INF directory and a web.xml deployment descriptor; it doesn't necessarily have to be packaged in a WAR file. [ September 03, 2007: Message edited by: Jesper Young ]
|
 |
Padma priya Gururajan
Ranch Hand
Joined: Oct 05, 2006
Posts: 411
|
|
Hi Jesper, I am using Tomcat 5.5. In which version did you try? Why do such compatability issues arise? Thanks.
|
 |
Padma priya Gururajan
Ranch Hand
Joined: Oct 05, 2006
Posts: 411
|
|
Hi Jesper, Is it necessary to change the version to 6.0 or can i make it right in 5.5? Thanks.
|
 |
Padma priya Gururajan
Ranch Hand
Joined: Oct 05, 2006
Posts: 411
|
|
Hi, I have re-installed Tomcat 5.0 to Tomcat 6.0. I have set the following environment variables. JAVA_HOME=C:\j2sdk1.4.0_02\bin and path=C:\j2sdk1.4.0_02 I have a folder called check under webapps and and a file called test.jsp under check.I tried creating a folder called WEB-INF and put a sample web.xml under it. Still, it does not work. The error message I get is"The requested resource (/check/test.jsp) is not available". Thanks in advance.
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12929
|
|
|
Tomcat 6.0 requires Java 5 or newer. So if you are using Java 1.4 then Tomcat 6.0 will not work. Are you really using Tomcat 6.0 and Java 1.4?
|
 |
Padma priya Gururajan
Ranch Hand
Joined: Oct 05, 2006
Posts: 411
|
|
Yes. I am using Tomcat 6.0 and java 1.4. Is it necessary to change the version of java to 5.0 now? Thanks.
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Yes, Tomcat 6 requires J2SE 5 JRE. http://tomcat.apache.org/tomcat-6.0-doc/setup.html [ September 04, 2007: Message edited by: Ben Souther ]
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12929
|
|
|
I'm surprised that it is even possible to start Tomcat 6.0 with Java 1.4 without getting errors about missing classes.
|
 |
Padma priya Gururajan
Ranch Hand
Joined: Oct 05, 2006
Posts: 411
|
|
Hi, By J2SE 5 JRE, are you talking about jdk 1.5 version? Thanks.
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12929
|
|
|
You should use a Java runtime environment (JRE) for Java 5 or newer (currently the newest version is Java 6). So JDK 5 is OK.
|
 |
Padma priya Gururajan
Ranch Hand
Joined: Oct 05, 2006
Posts: 411
|
|
Hi Jesper, I shall try and let you know. Thanks.
|
 |
Muhammad Saifuddin
Ranch Hand
Joined: Dec 06, 2005
Posts: 1318
|
|
hi Padma, you can use this tutorial for Configuring & Using Apache Tomcat 6
|
Saifuddin..
[Linkedin] How To Ask Questions On JavaRanch My OpenSource
|
 |
Padma priya Gururajan
Ranch Hand
Joined: Oct 05, 2006
Posts: 411
|
|
Hi, I placed the file under webapps/root/check and it runs well. Thanks.
|
 |
Damodar Mukherjee
Ranch Hand
Joined: Mar 20, 2007
Posts: 135
|
|
I am facing the same problem. I have tomcat 5.5, is tomcat 5.5 don't support any other directory rather then ROOT???
|
SCJP 1.5, SCWCD 1.4, Next... SCBCD5
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Originally posted by Damodar Mukherjee: I am facing the same problem. I have tomcat 5.5, is tomcat 5.5 don't support any other directory rather then ROOT??? 
Damodar Mukherjee, First this isn't the same problem. Second, please don't hijack other people's threads. Start a new thread with your topic.
|
 |
Damodar Mukherjee
Ranch Hand
Joined: Mar 20, 2007
Posts: 135
|
|
I am really sorry Ben
|
 |
 |
|
|
subject: Not able to execute a sample jsp file
|
|
|