Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not able to execute a sample jsp file

 
Padma priya Gururajan
Ranch Hand
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What else is in the "check" directory?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15207
36
Android IntelliJ IDE Java Scala Spring
 
Padma priya Gururajan
Ranch Hand
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
check is the name of the directory under which the jsp file is placed.Thanks.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Saloon Keeper
Posts: 15207
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Saloon Keeper
Posts: 15207
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Saloon Keeper
Posts: 15207
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Saloon Keeper
Posts: 15207
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
By J2SE 5 JRE, are you talking about jdk 1.5 version?
Thanks.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15207
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jesper,
I shall try and let you know.
Thanks.
 
Muhammad Saifuddin
Ranch Hand
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Padma,

you can use this tutorial for
Configuring & Using Apache Tomcat 6
 
Padma priya Gururajan
Ranch Hand
Posts: 437
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I placed the file under webapps/root/check and it runs well.
Thanks.
 
Damodar Mukherjee
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am facing the same problem. I have tomcat 5.5, is tomcat 5.5 don't support any other directory rather then ROOT???
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am really sorry Ben
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic