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

http status 404 error

 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I am using tomcat 5.0.28 and jdk1.5.0_15
Using http://localhost:8080 -> tomcat home page is open
but when I type http://localhost:8080/ch1/serv1 at browser it is giving http error 404

type Status report

message /ch1/serv1

description The requested resource (/ch1/serv1) is not available

I think my folder structure is proper
and content of web-XML is shown below
<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/web-app_2_4.xsd"
version = "2.4" >

<servlet>
<servlet-name>Chapter1 servlet</servlet-name>
<servlet-class>Ch1Servlet</servlet-class>
</servlet>


<servlet-mapping>
<servlet-name>Chapter1 servlet</servlet-name>
<url-pattern>/serv1</url-pattern>
</servlet-mapping>

</web-app>

I tried uncommenting the line in conf/web-xml (servlet-mapping)
Then also it is not working.
please help
Thanks in advance
 
best scout
Posts: 1294
Scala IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

are you sure your application gets deployed correctly (check Tomcat log directory)? If yes, which context is used? Is it really "/ch1".

Depending on your IDE there could be a context.xml file anywhere in your project. Check if it looks something like this:


Your servlet mapping in web.xml looks correct for me. Therefore I'd rather think it's a problem of the web context!

Marco
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I think my folder structure is proper


Could you show it ?
 
V Gala
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how I show folder structure in forum
I am not using any IDE
Thanks for reply
 
V Gala
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
part of the stdout is


Apr 2, 2008 5:26:28 PM org.apache.catalina.startup.ContextConfig defaultConfig
SEVERE: Parse error in default web.xml
java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name invoker
at org.apache.commons.digester.Digester.createSAXException(Digester.java:2540)
at org.apache.commons.digester.Digester.createSAXException(Digester.java:2566)
at org.apache.commons.digester.Digester.endElement(Digester.java:1061)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1548)
at org.apache.catalina.startup.ContextConfig.defaultConfig(ContextConfig.java:515)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:623)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:216)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4290)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595)
at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277)
at org.apache.catalina.core.StandardHost.install(StandardHost.java:832)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:701)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)
at org.apache.catalina.core.StandardService.start(StandardService.java:480)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)
at org.apache.catalina.startup.Catalina.start(Catalina.java:556)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
 
V Gala
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the folder structure under webapps is

ch1
-- WEB-INF
----- classes
--------Ch1Servlet.class
-- web-xml



if i uncomment servlet element having servlet-name invoker and servlet-mapping then error message in stdout is
Apr 2, 2008 5:30:48 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Apr 2, 2008 5:30:48 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 906 ms
Apr 2, 2008 5:30:48 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Apr 2, 2008 5:30:48 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.0.28
Apr 2, 2008 5:30:48 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Apr 2, 2008 5:30:48 PM org.apache.catalina.core.StandardHost getDeployer
INFO: Create Host deployer for direct deployment ( non-jmx )
Apr 2, 2008 5:30:48 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Processing Context configuration file URL file:F:\Tomcat\Tomcat 5.0\conf\Catalina\localhost\admin.xml
Apr 2, 2008 5:30:49 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
Apr 2, 2008 5:30:49 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
Apr 2, 2008 5:30:49 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.webapp.admin.ApplicationResources', returnNull=true
Apr 2, 2008 5:30:51 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Processing Context configuration file URL file:F:\Tomcat\Tomcat 5.0\conf\Catalina\localhost\balancer.xml
Apr 2, 2008 5:30:51 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Processing Context configuration file URL file:F:\Tomcat\Tomcat 5.0\conf\Catalina\localhost\manager.xml
Apr 2, 2008 5:30:51 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /ch1 from URL file:F:\Tomcat\Tomcat 5.0\webapps\ch1
Apr 2, 2008 5:30:51 PM org.apache.catalina.startup.ContextConfig applicationConfig
INFO: Missing application web.xml, using defaults only StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ch1]
Apr 2, 2008 5:30:51 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /jsp-examples from URL file:F:\Tomcat\Tomcat 5.0\webapps\jsp-examples
Apr 2, 2008 5:30:51 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path from URL file:F:\Tomcat\Tomcat 5.0\webapps\ROOT
Apr 2, 2008 5:30:51 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /servlets-examples from URL file:F:\Tomcat\Tomcat 5.0\webapps\servlets-examples
Apr 2, 2008 5:30:51 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /tomcat-docs from URL file:F:\Tomcat\Tomcat 5.0\webapps\tomcat-docs
Apr 2, 2008 5:30:51 PM org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /webdav from URL file:F:\Tomcat\Tomcat 5.0\webapps\webdav
Apr 2, 2008 5:30:51 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Apr 2, 2008 5:30:52 PM org.apache.jk.common.ChannelSocket init
INFO: JK2: ajp13 listening on /0.0.0.0:8009
Apr 2, 2008 5:30:52 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/31 config=F:\Tomcat\Tomcat 5.0\conf\jk2.properties
Apr 2, 2008 5:30:52 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3610 ms

[ April 02, 2008: Message edited by: V Gala ]

[ April 02, 2008: Message edited by: V Gala ]
[ April 02, 2008: Message edited by: V Gala ]
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try by placing your class file in some package and modify the web.xml accordingly.
 
V Gala
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried by putting my classes in package it is not working
Even I am not able to run servlets-examples but able to run jsp-examples

INFO: Missing application web.xml, using defaults only StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ch1]
what this information mean
[ April 02, 2008: Message edited by: V Gala ]
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
web-xml -> web.xml
 
V Gala
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it is web.xml by mistake I type web-xml
getting same error

what do you mean by missing application web.xml
[ April 02, 2008: Message edited by: V Gala ]
 
I was her plaything! And so was this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic