0

This is my first run with Servlets and my problem is such, The name of my webapp is Config-v1 and here below is the form.html (Only included essential part):-

<form class="form-horizontal" method="POST" action="GivePaths">...</form>

Now when i run this webapp in Tomcat using http://localhost:8080/Config-v1/form.html it works fine and displays the form correctly, after that the next step i did was create a WEB-INF folder within my Config-v1 and put in web.xml which is as follows:-

<?xml version="1.0" encoding="UTF-8"?>
<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>bad</servlet-name>
 <servlet-class>com.obp.web.PathSelect</servlet-class>
 </servlet>

 <servlet-mapping>
 <servlet-name>bad</servlet-name>
 <url-pattern>/GivePaths</url-pattern>
 </servlet-mapping>

</web-app>

Now when i try http://localhost:8080/Config-v1/form.html it gives me an error:

 404: The requested resource is not available.

I read around SO that there must be some problem with my xml file and i tried various different urls but for the life of me I can't figure it out. Help would be much appreciated!

The log is such:

127.0.0.1 - - [18/Jun/2014:10:01:12 +0530] "GET / HTTP/1.1" 200 11418
127.0.0.1 - - [18/Jun/2014:10:01:25 +0530] "GET /Config-v1/form.html HTTP/1.1" 200 5326
127.0.0.1 - - [18/Jun/2014:10:01:26 +0530] "GET /Config-v1/cssjs/bootstrap.css HTTP/1.1" 200 125569
127.0.0.1 - - [18/Jun/2014:10:01:26 +0530] "GET /Config-v1/cssjs/bootswatch.min.css HTTP/1.1" 200 2712
127.0.0.1 - - [18/Jun/2014:10:01:26 +0530] "GET /Config-v1/cssjs/bootstrap.min.js HTTP/1.1" 200 29110
127.0.0.1 - - [18/Jun/2014:10:09:46 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 949
127.0.0.1 - - [18/Jun/2014:10:10:16 +0530] "GET / HTTP/1.1" 200 11418
127.0.0.1 - - [18/Jun/2014:10:10:16 +0530] "GET / HTTP/1.1" 200 11418
127.0.0.1 - - [18/Jun/2014:10:10:21 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 985
127.0.0.1 - - [18/Jun/2014:10:10:35 +0530] "GET /Config-v1/ HTTP/1.1" 404 967
127.0.0.1 - - [18/Jun/2014:10:10:43 +0530] "GET / HTTP/1.1" 200 11418
127.0.0.1 - - [18/Jun/2014:10:11:16 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 985
127.0.0.1 - - [18/Jun/2014:10:11:35 +0530] "GET /Config-v1 HTTP/1.1" 404 965
127.0.0.1 - - [18/Jun/2014:10:12:26 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 985
127.0.0.1 - - [18/Jun/2014:10:12:27 +0530] "GET /favicon.ico HTTP/1.1" 200 21630
127.0.0.1 - - [18/Jun/2014:10:12:46 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 985
127.0.0.1 - - [18/Jun/2014:10:12:48 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 985
127.0.0.1 - - [18/Jun/2014:10:12:53 +0530] "GET / HTTP/1.1" 200 11418
127.0.0.1 - - [18/Jun/2014:10:12:59 +0530] "GET /Config-v1/form.html HTTP/1.1" 200 5326
127.0.0.1 - - [18/Jun/2014:10:13:55 +0530] "GET /Config-v1/form.html HTTP/1.1" 304 -
127.0.0.1 - - [18/Jun/2014:10:14:32 +0530] "POST /Config-v1/GivePaths.do HTTP/1.1" 404 991
127.0.0.1 - - [18/Jun/2014:10:49:49 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 949
127.0.0.1 - - [18/Jun/2014:10:49:53 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 949
127.0.0.1 - - [18/Jun/2014:10:50:03 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 949
127.0.0.1 - - [18/Jun/2014:10:53:01 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 949
127.0.0.1 - - [18/Jun/2014:10:53:02 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 949
127.0.0.1 - - [18/Jun/2014:10:53:05 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 949
127.0.0.1 - - [18/Jun/2014:10:56:18 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 985
127.0.0.1 - - [18/Jun/2014:10:57:13 +0530] "GET / HTTP/1.1" 200 11418
127.0.0.1 - - [18/Jun/2014:10:57:13 +0530] "GET / HTTP/1.1" 200 11418
127.0.0.1 - - [18/Jun/2014:10:57:19 +0530] "GET /Config-v1/form.html HTTP/1.1" 200 5360
127.0.0.1 - - [18/Jun/2014:10:57:26 +0530] "POST /GivePaths HTTP/1.1" 404 969
127.0.0.1 - - [18/Jun/2014:10:58:15 +0530] "GET /Config-v1/form.html HTTP/1.1" 200 5368
127.0.0.1 - - [18/Jun/2014:10:58:18 +0530] "POST /Config-v1/GivePaths HTTP/1.1" 404 985
127.0.0.1 - - [18/Jun/2014:10:58:42 +0530] "GET /Config-v1/form.html HTTP/1.1" 304 -
127.0.0.1 - - [18/Jun/2014:10:58:46 +0530] "POST /Config-v1/GivePaths HTTP/1.1" 404 985
127.0.0.1 - - [18/Jun/2014:10:59:11 +0530] "GET /Config-v1/form.html HTTP/1.1" 200 5359
127.0.0.1 - - [18/Jun/2014:10:59:15 +0530] "POST /Config-v1/GivePaths HTTP/1.1" 404 985
127.0.0.1 - - [18/Jun/2014:11:01:27 +0530] "GET / HTTP/1.1" 200 11418
127.0.0.1 - - [18/Jun/2014:11:04:42 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 949
127.0.0.1 - - [18/Jun/2014:11:04:48 +0530] "GET / HTTP/1.1" 200 11418
127.0.0.1 - - [18/Jun/2014:11:04:53 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 949
127.0.0.1 - - [18/Jun/2014:11:09:08 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 985
127.0.0.1 - - [18/Jun/2014:11:19:53 +0530] "GET / HTTP/1.1" 200 11418
127.0.0.1 - - [18/Jun/2014:11:19:59 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 985
127.0.0.1 - - [18/Jun/2014:11:21:43 +0530] "GET / HTTP/1.1" 200 11418
127.0.0.1 - - [18/Jun/2014:11:21:47 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 985
127.0.0.1 - - [18/Jun/2014:11:32:03 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 985
127.0.0.1 - - [18/Jun/2014:11:32:51 +0530] "GET /Config-v1/form.html HTTP/1.1" 200 5394
127.0.0.1 - - [18/Jun/2014:11:32:51 +0530] "GET /Config-v1/cssjs/bootstrap.css HTTP/1.1" 304 -
127.0.0.1 - - [18/Jun/2014:11:32:51 +0530] "GET /Config-v1/cssjs/bootswatch.min.css HTTP/1.1" 304 -
127.0.0.1 - - [18/Jun/2014:11:32:51 +0530] "GET /Config-v1/cssjs/bootstrap.min.js HTTP/1.1" 304 -
127.0.0.1 - - [18/Jun/2014:11:33:00 +0530] "POST /Config-v1/$%7BpageContext.request.contextPath%7D/GivePaths HTTP/1.1" 404 1063
127.0.0.1 - - [18/Jun/2014:11:33:23 +0530] "POST /Config-v1/$%7BpageContext.request.contextPath%7D/GivePaths HTTP/1.1" 404 1063
127.0.0.1 - - [18/Jun/2014:11:33:38 +0530] "POST /Config-v1/$%7BpageContext.request.contextPath%7D/GivePaths HTTP/1.1" 404 1063
127.0.0.1 - - [18/Jun/2014:11:34:05 +0530] "GET /Config-v1/ HTTP/1.1" 404 967
127.0.0.1 - - [18/Jun/2014:11:34:12 +0530] "POST /Config-v1/$%7BpageContext.request.contextPath%7D/GivePaths HTTP/1.1" 404 1063
127.0.0.1 - - [18/Jun/2014:11:37:41 +0530] "GET /Config-v1/form.html HTTP/1.1" 200 5347
127.0.0.1 - - [18/Jun/2014:11:37:47 +0530] "POST /Config-v1/GivePaths HTTP/1.1" 404 985
127.0.0.1 - - [18/Jun/2014:11:41:00 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 949
127.0.0.1 - - [18/Jun/2014:11:42:44 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 949
127.0.0.1 - - [18/Jun/2014:11:42:48 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 949
127.0.0.1 - - [18/Jun/2014:11:54:47 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 949
127.0.0.1 - - [18/Jun/2014:12:07:28 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 949
127.0.0.1 - - [18/Jun/2014:12:07:30 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 949
127.0.0.1 - - [18/Jun/2014:12:09:53 +0530] "GET / HTTP/1.1" 200 11418
127.0.0.1 - - [18/Jun/2014:12:09:57 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 985
127.0.0.1 - - [18/Jun/2014:12:10:00 +0530] "GET /Config-v1/form.html HTTP/1.1" 404 985
damien hawks
  • 512
  • 3
  • 17
  • did you put form.html inside WEB-INF folder later i mean the second time cause anything you put under WEB-INF and try to access is not possible – vikeng21 Jun 18 '14 at 06:35
  • No @vikeng21 form.html is outside that folder, in the Config-v1 webapp folder. – damien hawks Jun 18 '14 at 06:36
  • 1
    check you webapp server logs, maybe the webapp did not even load. – Scary Wombat Jun 18 '14 at 06:38
  • I have updated the log file i found. Should i update the stdrr one too? @ScaryWombat, how would i know if it didn't load? – damien hawks Jun 18 '14 at 06:41
  • Hope these two answers will help http://stackoverflow.com/questions/16963185/http-status-404-servlet-the-requested-resource-is-not-available and http://stackoverflow.com/questions/19208164/tomcat-servlet-error-404-the-requested-resource-is-not-available – A Stranger Jun 18 '14 at 06:42
  • @AStranger already checked both out, no avail. I don't have a path problem. – damien hawks Jun 18 '14 at 06:44
  • @ScaryWombat in my Catalina log file i do see that it says SOCKET FAILED TO BIND and CONNECTOR errors. Can you guide me towards anything that'll help me understand this better? – damien hawks Jun 18 '14 at 06:47
  • there ya go. it looks like something is running on this port already, maybe another instance of tomcat? – Scary Wombat Jun 18 '14 at 06:48
  • @ScaryWombat i restarted Tomcat, went on to the Manager-GUI and indeed my app is not running, but even if i click start it doesn't change the status to "true" can you tell me the most common reason for this kind of problem? I'd really be grateful. Also can it be a folder permission problem? – damien hawks Jun 18 '14 at 06:55
  • maybe reboot you machine – Scary Wombat Jun 18 '14 at 06:57
  • please check http://localhost:8080/Config-v1/GivePaths/form.html Since you give /GivePaths in URL pattern if not works then change url pattern to /GivePaths/* and try again – A Stranger Jun 18 '14 at 06:57
  • is this your real web.xml? it is using ” quotes instead of " in your declaration. – Cédric Couralet Jun 18 '14 at 09:05
  • @CédricC yes i figured that was one of the problems. But i encountered that later after i got the webapp started. Thank you anyway and thank you ScaryWombat – damien hawks Jun 18 '14 at 09:33

0 Answers0