This week's book giveaway is in the OCP forum.
We're giving away four copies of OCP Java SE 8 Programmer II Exam Study Guide and have Kathy Sierra, Bert Bates, & Elizabeth Robson on-line!
See this thread for details.
Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Http 404 error  RSS feed

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When i try to Run my form in eclipse i get this http 404 error saying the origin server not detected or it is closed.
I downloaded thr mysql and eclipse and tomcat server all under my c drive under windows. Im not sure why the files are not looking to the server. Can someone help please?
 
Vani Jay
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here below is the error msg:

HTTP Status 404 – Not Found
Type Status Report

Message /P_Form/

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

Apache Tomcat/9.0.7
 
Vani Jay
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Vani Jay wrote:Here below is the error msg:

HTTP Status 404 – Not Found
Type Status Report

Message /P_Form/

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

Apache Tomcat/9.0.7



Can someone please help? I am not able to find a solution.. I have read all the solutions and have changed accordingly in my code but still I am getting the same error.
 
Saloon Keeper
Posts: 8587
161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, at least there is a service running at that address, otherwise you wouldn't get a HTTP error at all.

Can you show us the URL that you're trying, your web.xml and if you're using Tomcat, the context.xml?
 
Vani Jay
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:Well, at least there is a service running at that address, otherwise you wouldn't get a HTTP error at all.

Can you show us the URL that you're trying, your web.xml and if you're using Tomcat, the context.xml?



Hi Stephan,

Below is my code in web.xml?

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
        "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
<constant name="struts.devMode" value="true" />
    <package name="default" namespace="/" extends="struts-default">
        <action name="register" class="com.admin.RegisterAction">
            <result name="Success">/success2.jsp</result>
            <result name="input">/error2.jsp</result>
        </action>
    </package>

</struts>
 
Vani Jay
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now I am getting the below error... This error i am getting when I try to input data into the mysql ..

HTTP Status 404 – Not Found
Type Status Report

Message There is no Action mapped for namespace [/] and action name [Register] associated with context path [/JayForm].

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

Apache Tomcat/8.5.30
 
Stephan van Hulst
Saloon Keeper
Posts: 8587
161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The file you shared is not the web.xml, it's the struts.xml. The web.xml is located under webapp/WEB-INF/. How did you create your application?
 
Vani Jay
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Vani Jay wrote:

Stephan van Hulst wrote:Well, at least there is a service running at that address, otherwise you wouldn't get a HTTP error at all.

Can you show us the URL that you're trying, your web.xml and if you're using Tomcat, the context.xml?



Hi Stephan,

Below is my code in struts.xml?

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
        "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
<constant name="struts.devMode" value="true" />
    <package name="default" namespace="/" extends="struts-default">
        <action name="register" class="com.admin.RegisterAction">
            <result name="Success">/success2.jsp</result>
            <result name="input">/error2.jsp</result>
        </action>
    </package>

</struts>



This is my web.xml

<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_3_0.xsd"
    version="3.0">

<welcome-file-list>
<welcome-file>register.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
 
</web-app>
 
Vani Jay
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:The file you shared is not the web.xml, it's the struts.xml. The web.xml is located under webapp/WEB-INF/. How did you create your application?


I know I made a mistake in copying the correct file. Sorry about that.

My Error now is:

HTTP Status 404 – Not Found
Type Status Report

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

Apache Tomcat/8.5.30
 
Stephan van Hulst
Saloon Keeper
Posts: 8587
161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what URL did you try to access? Are you using Tomcat? What are the contents of the context.xml file (if it exists)?
 
Vani Jay
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:So what URL did you try to access? Are you using Tomcat? What are the contents of the context.xml file (if it exists)?



Yes I am using Tomcat as Server. I dont have a Context.xml file. I have only three xml files which is Struts.xml and web.xml. I also using maven and thus have pom.xml.  I am using Eclipse as IDE. When i run from Eclipse I this the above error. If I run through the http://localhost:8080/JayForm/register I get the error.jsp page.
 
Stephan van Hulst
Saloon Keeper
Posts: 8587
161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm assuming your WAR is named JayForm? Can you show us your POM xml?
 
Vani Jay
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my structure:

i have attached
Capture.PNG
[Thumbnail for Capture.PNG]
Structure of JayForm project
 
Marshal
Posts: 5592
384
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vani Jay. There is one administrative request. When you post code, please always use code tags, that helps people who are helping you to read your code easier.
 
Liutauras Vilda
Marshal
Posts: 5592
384
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Our developers worked hard, and voluntarily to produce an ability even to use "xml" codetags, you can select them in a drop down menu, where Java is set as a default.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!