• 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

The requested resource (/servletTestApp/) is not available

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am trying to run a servlet on tomcat 6

defined the directory structure in the following manner
-webapps
-servletTestApp
-WEB-INF
-web.xml
-classes
-testServletPackage contains class file-testServlet.class

i believe i have set the classpath correctly both for java and servlet-api.jar. I can also see the application nae /servletTestApp when i open the manager in the browser...but when i click on it..i get a 404 error-cant find resource

HTTP Status 404 - /servletTestApp/

type Status report

message /servletTestApp/

description The requested resource (/servletTestApp/) is not available.

web.xml looks like this

<?xml version="1.0" encoding="UTF-8" ?>

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

<servlet>
<servlet-name>testServlet</servlet-name>
<servlet-class>testServletPackage.testServlet</servlet-class>
</servlet>


<servlet-mapping>
<servlet-name>testServlet</servlet-name>
<url-pattern>/testServlet</url-pattern>
</servlet-mapping>
</web-app>

and the servlet is as follows-

package testServletPackage;

import javax.servlet.*;
import java.io.*;

import javax.servlet.http.*;

public class testServlet extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Hello World!</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Hello World!</h1>");
out.println("</body>");
out.println("</html>");
}
}

finally the log file for localhost-its pretty long but i guess bold will help


1 Sep, 2011 12:12:19 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
1 Sep, 2011 12:12:19 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
1 Sep, 2011 12:15:10 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
1 Sep, 2011 12:15:10 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()
1 Sep, 2011 12:39:46 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
1 Sep, 2011 12:39:46 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
1 Sep, 2011 12:40:46 AM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet testServlet as unavailable
1 Sep, 2011 12:40:46 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Allocate exception for servlet testServlet
java.lang.IllegalAccessException: Class org.apache.catalina.core.StandardWrapper can not access a member of class testServletPackage.testServlet with modifiers ""
at sun.reflect.Reflection.ensureMemberAccess(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1116)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:809)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)
at java.lang.Thread.run(Unknown Source)
1 Sep, 2011 12:48:19 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
1 Sep, 2011 12:48:19 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()
1 Sep, 2011 12:57:47 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
1 Sep, 2011 12:57:47 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
1 Sep, 2011 1:13:44 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
1 Sep, 2011 1:13:44 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()
1 Sep, 2011 1:14:42 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
1 Sep, 2011 1:14:42 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
1 Sep, 2011 1:19:27 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
1 Sep, 2011 1:19:27 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()
1 Sep, 2011 1:19:32 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
1 Sep, 2011 1:19:32 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
1 Sep, 2011 1:36:09 AM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet testServlet as unavailable
1 Sep, 2011 1:36:09 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Allocate exception for servlet testServlet
java.lang.IllegalAccessException: Class org.apache.catalina.core.StandardWrapper can not access a member of class testServletPackage.testServlet with modifiers ""
at sun.reflect.Reflection.ensureMemberAccess(Unknown Source)

at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1116)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:809)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)
at java.lang.Thread.run(Unknown Source)
1 Sep, 2011 1:52:02 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
1 Sep, 2011 1:52:02 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()
1 Sep, 2011 1:52:38 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
1 Sep, 2011 1:52:38 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
1 Sep, 2011 1:53:04 AM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet testServlet as unavailable
1 Sep, 2011 1:53:04 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Allocate exception for servlet testServlet
java.lang.IllegalAccessException: Class org.apache.catalina.core.StandardWrapper can not access a member of class testServletPackage.testServlet with modifiers ""
at sun.reflect.Reflection.ensureMemberAccess(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1116)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:809)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)
at java.lang.Thread.run(Unknown Source)

PLease help..tried to search the errors on the net..in vain.

 
Sheriff
Posts: 67746
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

HTTP Status 404 - /servletTestApp/


That URL does not match what you've mapped in the deployment descriptor.
 
hiteshi kalani
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:

HTTP Status 404 - /servletTestApp/


That URL does not match what you've mapped in the deployment descriptor.



tried that too..http://localhost:8080/testServlet at the browser but it gives 404...

also tried to change servlet mapping to /servletTestApp/testServlet and wrote this on the browser http://localhost:8080//servletTestApp/testServlet
but it still gives 404...the problem is that when i click on the /servletTestApp link in the list of applications tomcat manager...t gives 404..so if it cant find my webapp..i cant expect it to find the servlet file...can't understand why it's not working out when my webapp is listed in the list of applications in tomcat manger??
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the Tomcat manager is not showing the app as running that means that the app never started so of course it won't respond.

Look in the logs for the reason for the failure.
 
hiteshi kalani
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:If the Tomcat manager is not showing the app as running that means that the app never started so of course it won't respond.

Look in the logs for the reason for the failure.



bear boss..u'r right i just noticed the tomcat manager flag is false in the running column...which log am i supposed to see? i have posted one of them above..and it was localhost.date in my logs folder..
 
hiteshi kalani
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

hiteshi kalani wrote:

Bear Bibeault wrote:If the Tomcat manager is not showing the app as running that means that the app never started so of course it won't respond.

Look in the logs for the reason for the failure.



bear boss..u'r right i just noticed the tomcat manager flag is false in the running column...which log am i supposed to see? i have posted one of them above..and it was localhost.date in my logs folder..



ok so i set the servlet mappng to /servletTestApp/testServlet and the running column showed true...but the 404 doesnt go..
 
Bear Bibeault
Sheriff
Posts: 67746
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

hiteshi kalani wrote:ok so i set the servlet mappng to /servletTestApp/testServlet and the running column showed true...but the 404 doesnt go..


The servlet mapping should not include the context path. The URL should include the context path.
 
hiteshi kalani
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:

hiteshi kalani wrote:ok so i set the servlet mappng to /servletTestApp/testServlet and the running column showed true...but the 404 doesnt go..


The servlet mapping should not include the context path. The URL should include the context path.



I had added that in the URL only under the servlet mapping tag.
<url-pattern></url-pattern>
 
Stinging nettles are edible. But I really want to see you try to eat 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