• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

response.sendRedirect problem

 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
server: tomcat 5.5.7

I have the following file (index.jsp) in the root of my_webapp

<% response.sendRedirect("login.jsp"); %>

when I access the my_webapp directory (without specifying any file), I am supposed to call undex.jsp, hence be redirected to login.jsp. Am I right???

However, I only get the following exception (please advise):


HTTP Status 404 - Servlet org.apache.jsp.index_jsp is not available

type Status report

message Servlet org.apache.jsp.index_jsp is not available

description The requested resource (Servlet org.apache.jsp.index_jsp is not available) is not available.
Apache Tomcat/5.5.7
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where are you putting your JSPs?
 
Joseph Sweet
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just one level above the WEB-INF folder of my app. Other JSPs in the same place work okay.
 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if the index.jsp is inside your web-app root directory, and if you access

http://localhost:8080/myapp/

it should work.


Also check out the welcome file list in the web.xml

Regard
 
Joseph Sweet
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
something does not work.

tomcat on local machine, when I access: http://localhost:8080/resumail/

gives me:

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Wrapper cannot find servlet class org.apache.jsp.index_jsp or a class it depends on
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Thread.java:595)

root cause

java.lang.ClassNotFoundException: org.apache.jsp.index_jsp
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1332)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Thread.java:595)

note The full stack trace of the root cause is available in the Apache Tomcat/5.5.7 logs.


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

when I access directly http://localhost:8080/resumail/index.jsp

it gives me:

HTTP Status 404 - Servlet org.apache.jsp.index_jsp is not available

type Status report

message Servlet org.apache.jsp.index_jsp is not available

description The requested resource (Servlet org.apache.jsp.index_jsp is not available) is not available.
Apache Tomcat/5.5.7


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


the web.xml of that app (resumail) is:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Copyright 2004 The Apache Software Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

<display-name>Welcome to Tomcat</display-name>
<description>
Welcome to Tomcat
</description>

<!-- JSPC servlet mappings start -->

<servlet>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>
<servlet-class>org.apache.jsp.index_jsp</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>
<url-pattern>/index.jsp</url-pattern>
</servlet-mapping>

<!-- JSPC servlet mappings end -->

<servlet>
<servlet-name>ch01_06</servlet-name>
<servlet-class>ch01_06</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>ch01_06</servlet-name>
<url-pattern>/servlet/ch01_06</url-pattern>
</servlet-mapping>

<!-- jdbc_odbc dsn example -->

<servlet>
<servlet-name>emaildb</servlet-name>
<servlet-class>emaildb</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>emaildb</servlet-name>
<url-pattern>/servlet/emaildb</url-pattern>
</servlet-mapping>

<!-- emailList servlet -->

<servlet>
<servlet-name>emailList</servlet-name>
<servlet-class>emailList</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>emailList</servlet-name>
<url-pattern>/servlet/emailList</url-pattern>
</servlet-mapping>

<!-- verifyUser servlet -->

<servlet>
<servlet-name>verifyUser</servlet-name>
<servlet-class>verifyUser</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>verifyUser</servlet-name>
<url-pattern>/servlet/verifyUser</url-pattern>
</servlet-mapping>

<!-- updateUserEmail servlet -->

<servlet>
<servlet-name>updateUserEmail</servlet-name>
<servlet-class>updateUserEmail</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>updateUserEmail</servlet-name>
<url-pattern>/servlet/updateUserEmail</url-pattern>
</servlet-mapping>

<!-- updateUserPassword servlet -->

<servlet>
<servlet-name>updateUserPassword</servlet-name>
<servlet-class>updateUserPassword</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>updateUserPassword</servlet-name>
<url-pattern>/servlet/updateUserPassword</url-pattern>
</servlet-mapping>

<!-- emailMe servlet -->

<servlet>
<servlet-name>emailMe</servlet-name>
<servlet-class>emailMe</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>emailMe</servlet-name>
<url-pattern>/servlet/emailMe</url-pattern>
</servlet-mapping>

<!-- updateAddressees servlet -->

<servlet>
<servlet-name>updateAddressees</servlet-name>
<servlet-class>updateAddressees</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>updateAddressees</servlet-name>
<url-pattern>/servlet/updateAddressees</url-pattern>
</servlet-mapping>

<!-- addAddressee servlet -->

<servlet>
<servlet-name>addAddressee</servlet-name>
<servlet-class>addAddressee</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>addAddressee</servlet-name>
<url-pattern>/servlet/addAddressee</url-pattern>
</servlet-mapping>

<!-- insertAddressee servlet -->

<servlet>
<servlet-name>insertAddressee</servlet-name>
<servlet-class>insertAddressee</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>insertAddressee</servlet-name>
<url-pattern>/servlet/insertAddressee</url-pattern>
</servlet-mapping>

<!-- insertConfirm servlet -->

<servlet>
<servlet-name>insertConfirm</servlet-name>
<servlet-class>insertConfirm</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>insertConfirm</servlet-name>
<url-pattern>/servlet/insertConfirm</url-pattern>
</servlet-mapping>

<!-- searchAddressees servlet -->

<servlet>
<servlet-name>searchAddressees</servlet-name>
<servlet-class>searchAddressees</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>searchAddressees</servlet-name>
<url-pattern>/servlet/searchAddressees</url-pattern>
</servlet-mapping>


<!-- searchResults servlet -->

<servlet>
<servlet-name>searchResults</servlet-name>
<servlet-class>searchResults</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>searchResults</servlet-name>
<url-pattern>/servlet/searchResults</url-pattern>
</servlet-mapping>

<!-- tempUpload servlet -->

<servlet>
<servlet-name>tempUpload</servlet-name>
<servlet-class>tempUpload</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>tempUpload</servlet-name>
<url-pattern>/servlet/tempUpload</url-pattern>
</servlet-mapping>


</web-app>
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Joseph Sweet:
Just one level above the WEB-INF folder of my app. Other JSPs in the same place work okay.



Are you putting them in TOMCAT_HOME/webapps/ROOT ?

The ROOT app that ships with Tomcat has pre-compiled JSPs that are explicitly mapped in web.xml.
You'll either need to remove the mappings or start your own app under webapps.

The 2nd is the better option.
 
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could it be something really simple, like a mistake in the filename?

-Yuriy
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try

sendRedirect("/index.jsp");
 
Joseph Sweet
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am still stuck... help...
I have the same problem on my local tomcat and on a remote tomcat server.

Yuriy Zilbergleyt - I don't think so.

Ivan Tamayo - didn't work.

Ben Souther - as I said it is in a new app (called resumail) under webapps.
Should I map JSPs in the web.xml ??? I thought only servlets should be mapped.
If they should be mapped, how do all the other JSPs work fine if they are in the same directory as the index.jsp, login.jsp
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should not need to map JSPs in web.xml. It sounds like there may be a problem with the sturcture of your web app. Could you describe exactly how you've laid out the folders and files under your context root?
 
Joseph Sweet
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
webapps: the one that comes with tomcat.

then: webapps/resumail, this is my app directory.

inside webapps/resumail there are all the JSPs.

webapps/resumail/WEB-INF/classes is where all the classes are

basically most of the app is working.... the index.jsp does not...
 
F is for finger. Can you stick your finger in your nose? Doesn't that feel nice? Now try this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic