The moose likes JSP and the fly likes problem with JSP deployment in tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "problem with JSP deployment in tomcat" Watch "problem with JSP deployment in tomcat" New topic
Author

problem with JSP deployment in tomcat

suseela pennaluru
Greenhorn

Joined: Jan 27, 2006
Posts: 17
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

Joined: Nov 24, 2005
Posts: 14688
    
  16

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\)


[My Blog]
All roads lead to JavaRanch
suseela pennaluru
Greenhorn

Joined: Jan 27, 2006
Posts: 17
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

Joined: Nov 24, 2005
Posts: 14688
    
  16

I should have asked this at first place, but how are you trying to access the jsp file ?
suseela pennaluru
Greenhorn

Joined: Jan 27, 2006
Posts: 17
I a m accessing the JSP page from the below link http://localhost:8080/JspProj/date.jsp
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
suseela pennaluru
Greenhorn

Joined: Jan 27, 2006
Posts: 17
I have removed WEB-INF folder and
I placed date.jsp under C:\Tomcat 4.1\webapps\JspProj\date.jsp
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

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

Joined: Dec 11, 2004
Posts: 13410

"suseela dd",
Please check your private messages.
suseela pennaluru
Greenhorn

Joined: Jan 27, 2006
Posts: 17
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

Joined: Nov 24, 2005
Posts: 14688
    
  16

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

Joined: Jan 27, 2006
Posts: 17
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

Joined: Nov 24, 2005
Posts: 14688
    
  16

1. What do you see when you type access http://localhost:8080 ?
Amol Nayak
Ranch Hand

Joined: Oct 26, 2006
Posts: 218
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

Joined: Feb 04, 2006
Posts: 96
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

Joined: Jan 27, 2006
Posts: 17
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

Joined: Nov 24, 2005
Posts: 14688
    
  16

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

Joined: Jan 27, 2006
Posts: 17
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

Joined: Nov 24, 2005
Posts: 14688
    
  16

What did you change ? You're not supposed to touch server.xml
suseela pennaluru
Greenhorn

Joined: Jan 27, 2006
Posts: 17
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

Joined: Nov 24, 2005
Posts: 14688
    
  16

it was problem with the JSP file.

Can you tell us which problem ?
suseela pennaluru
Greenhorn

Joined: Jan 27, 2006
Posts: 17
when I saved date.jsp,in the file name itself it was showing date.jsp.
 
 
subject: problem with JSP deployment in tomcat