• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with JSP deployment in tomcat

 
suseela pennaluru
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a date.jsp which will return todays date.
I have deployed this date.jsp under C:\Tomcat 4.1\webapps\JspProj\WEB-INF\date.jsp
but i m getting the error "The requested resource (/date.jsp) is not available."

I tried placing the date.jsp in C:\Tomcat 4.1\webapps\JspProj\WEB-INF\classes\date.jsp.
this also did not work.
please hepl me.
thanks in advance
suseela
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suseela,

First of all, could you please read the ranch's Naming Policy and change your name accordingly ? Thank you :thumb:

this also did not work. please hepl me.

I'd suggest that you read some basic documentation on web application. Things you put under WEB-INF are not directly accessible. They are hidden from the client. For the moment, try to put your JSP file at the context root (C:\Tomcat 4.1\webapps\JspProj\), or in a directory below it (C:\Tomcat 4.1\webapps\JspProj\jsp\)
 
suseela pennaluru
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Christophe Verre.
I have tried placing date.jsp under C:\Tomcat 4.1\webapps\JspProj\date.jsp.
even though I am getting the same error "The requested resource (/JspProj/date.jsp) is not available."
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I should have asked this at first place, but how are you trying to access the jsp file ?
 
suseela pennaluru
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I a m accessing the JSP page from the below link http://localhost:8080/JspProj/date.jsp
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Files under the WEB-INF directory are not directly accessible to the web.
Either move it out from under WEB-INF or use a controller to forward to your page.
 
suseela pennaluru
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have removed WEB-INF folder and
I placed date.jsp under C:\Tomcat 4.1\webapps\JspProj\date.jsp
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have removed WEB-INF folder

No, don't remove it You'll need it.

I placed date.jsp under C:\Tomcat 4.1\webapps\JspProj\date.jsp

did you restart the container ?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"suseela dd",
Please check your private messages.
 
suseela pennaluru
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So the date.jsp has to be under
C:\Tomcat 4.1\webapps\JspProj\WEB-INF\date.jsp
or
C:\Tomcat 4.1\webapps\JspProj\date.jsp

which one is correct.I tried both the ways.
but i got the same error "The requested resource (/JspProj/date.jsp) is not available."

whenever I made change ,I do restart Container.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. What do you see when you type access http://localhost:8080 ?
2. Try renaming your application folder in lowercase : jspproj
3. Please copy/paste the full error
 
suseela pennaluru
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have renamed the folder to jspproj(lowercase)

Error Message is below.

HTTP Status 404 - /jspproj/date.jsp

--------------------------------------------------------------------------------

type Status report

message /jspproj/date.jsp

description The requested resource (/jspproj/date.jsp) is not available.


--------------------------------------------------------------------------------

Apache Tomcat/4.1.36
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. What do you see when you type access http://localhost:8080 ?
 
Amol Nayak
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I reckon somethings wrong with your jsp and it is not compiling , thats why you are getting this. Can you paste you jsp here as it is? Also try to post the server logs, stacktraces if any.
 
krishnamoorthy kitcha
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi suseela pennaluru


Just try your jsp files, copied , c:\tomcat\webapps\root\urdir\filename.jsp

Then try or

just invoking from your browser
http://localhost:8080/dirname/filename.jsp

just check whether the request is coming or not
 
suseela pennaluru
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is date.jsp

<HTML>
<HEAD>
<TITLE>JSP Example</TITLE>
</HEAD>
<BODY BGCOLOR="ffffcc">
<CENTER>
<H2>Date and Time</H2>
<%
java.util.Date today = new java.util.Date();
out.println("Today's date is: "+today);
%>
</CENTER>
</BODY>
</HTML>

I tried copying the date.jsp to C:\Tomcat 4.1\webapps\ROOT\jspproj

and tried to access JSP from this url:http://localhost:8080/jspproj/date.jsp

but I am getting the error below

HTTP Status 404 - /date.jsp

--------------------------------------------------------------------------------

type Status report

message /date.jsp

description The requested resource (/date.jsp) is not available.


--------------------------------------------------------------------------------

Apache Tomcat/4.1.36


When I gave the url http://localhost:8080/.It is displaying tomcat home page.that is index.jsp
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you touch any configuration files in Tomcat ?

Please retry by following these steps :
1. Make a directory called "jspproj" under webapps
2. Put your JSP file in it
3. Make a directory called WEB-INF under "jspproj"
4. Create a file called "web.xml" under WEB-INF
5. Copy/Paste the following code into web.xml :

6. Restart Tomcat
7. Access http://localhost:8080/jspproj/date.jsp

(Directories and filenames are case sensitive)
You should have the following structure :
- webapps/jspproj/date.jsp
- webapps/jspproj/WEB-INF/web.xml
 
suseela pennaluru
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have added the web.xml under C:\Tomcat 4.1\webapps\jspproj\WEB-INF\web.xml as above in the reply.

I have restarted the Tomcat server.
but I am getting the same error again

HTTP Status 404 - /date.jsp

--------------------------------------------------------------------------------

type Status report

message /date.jsp

description The requested resource (/date.jsp) is not available.


--------------------------------------------------------------------------------

Apache Tomcat/4.1.36


some where I read in web application deployment that we need to change the C:\Tomcat 4.1\conf\server.xml

<Context path="" docBase="" debug="0"

Is it something to do with above context path?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What did you change ? You're not supposed to touch server.xml
 
suseela pennaluru
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am able to run the JSP now.it was problem with the JSP file.
I have corrected and ran again.
The JSP deployment on Tomcat is successfull now.
Thanks a lot
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it was problem with the JSP file.

Can you tell us which problem ?
 
suseela pennaluru
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when I saved date.jsp,in the file name itself it was showing date.jsp.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic