reset password
Author Message
layla08
Posts: 70
Posted 17:35 Jul 03, 2015 |

I am unable to access my project. When I try navigating to: http://cs3.calstatela.edu:8080/cs520stu14/homework1/AdminMainController , I get a 404 Error. Attached is the error, as well as my folder hierarchy (both local and remote). 

What am I doing incorrectly?

Thanks for your time!

hgadhia
Posts: 52
Posted 17:54 Jul 03, 2015 |

Just to make sure, you are using WinSCP client.

After you upload files, you have to right click on web.xml file and click on Custom Commands -> Touch.

If you did this already, and still get this error, it may be due to missing class files(or class files not uploaded in correct hierarchy).

layla08
Posts: 70
Posted 18:00 Jul 03, 2015 |

Hi, thanks for replying! I'm actually using FileZilla. 

I just double checked and all of my classes are uploaded, without any missing. 

I was initially thinking it was an issue with the hierarchy, which is why I attached a screenshot of my local and remote hierarchy forms. Looks correct to me, but I haven't ruled it out as a possibility. 

 

hgadhia
Posts: 52
Posted 18:05 Jul 03, 2015 |

Yes, the class files seems to be in correct hierarchy. Please use WinSCP to connect to CS3 server and do the following:

Right click on web.xml and Custom Commands -> Touch.

This should solve the issue.

layla08
Posts: 70
Posted 18:29 Jul 03, 2015 |

I downloaded WinSCP and "touched" the web.xml. Now I am getting a different error! (attached)

After some Googling, it seems like maybe it has to do with the version of my JRE and JDK? However, they match. Both my JRE and JDK Compliance are version 1.8. 

Any ideas? Thanks.

 

Attachments:
Last edited by layla08 at 19:19 Jul 03, 2015.
cysun
Posts: 2935
Posted 18:39 Jul 03, 2015 |

Read Note #3 in http://csns.calstatela.edu/wiki/content/cysun/course_materials/cs520/development.

And after you update your code on CS3, you need to either "touch" or re-upload web.xml so Tomcat will reload your project.

Last edited by cysun at 18:39 Jul 03, 2015.
layla08
Posts: 70
Posted 19:27 Jul 03, 2015 |

Hi Dr. Sun, 

Thanks for your reply! Attached are screenshots of both the JRE and JavaCompiler settings I have for Eclipse. The odd 500 error is gone, but I am still getting the same 404 error, even after touching the web.xml. 

Any other suggestions?

I appreciate your time.

Attachments:
cysun
Posts: 2935
Posted 08:39 Jul 04, 2015 |

Check if it's the right URL.

layla08
Posts: 70
Posted 11:03 Jul 04, 2015 |

I've checked my URLs and they seem okay, according to my understanding - I spent several hours looking through your MVC example codes, as well as watching your lectures, so I'm pretty confident they're correct.  

In case I'm wrong and it really is a URL error, here is one example of my URLs for my AdminMainController .java and .jsp:

1. My AdminMainController.java has this annotation: @WebServlet(urlPatterns="/AdminMainController", loadOnStartup=1)  

2. Here is how I forward to the view in the doGet(): request.getRequestDispatcher( "/homework1jsp/AdminMainView.jsp" ).forward(request, response );

3. When I run it, here is the URL and 404 Error:

4. I think something is wrong my forward request above on #2, but here is my folder hierarchy that matches the forward request:

folder heirachy

5. In my AdminMainView.jsp, I access the controller using this URL syntax: <a href="/cs520stu14/PostNewJobsController">Post New Job Opening</a>

  • Note: I've tried it without the /cs520stu14 in front, but when I run it, it tries to find PostNewJobsController in /cs520stu14/homework1jsp/PostNewJobsController
  • I've also tried doing a page import at the top of my .jsp page with no luck: <%@ page import="cs520.homework1.PostNewJobsController" %>

So is there something wrong with my URLs after all? 

Thanks for your time!

 

 

Last edited by layla08 at 11:04 Jul 04, 2015.
bseemscs
Posts: 26
Posted 12:00 Jul 04, 2015 |

You have your homework1jsp folder in the WebContent directory on your local machine while it is in WEB-INF on the cs3 server. It should be in WEB-INF on your machine as well so your jsp views are accessible only to your controllers and your forwards will be of the form "WIN-INF/homework1jsp/whatever.jsp"

Last edited by bseemscs at 12:04 Jul 04, 2015.
layla08
Posts: 70
Posted 12:30 Jul 04, 2015 |

You are completely correct, @BSEEMSCS. 

Thank you SO much - the issue has been resolved and now when the server looks for my jsp files in the WEB-INF folder, they are all located there. 

bseemscs
Posts: 26
Posted 13:38 Jul 04, 2015 |
layla08 wrote:

You are completely correct, @BSEEMSCS. 

Thank you SO much - the issue has been resolved and now when the server looks for my jsp files in the WEB-INF folder, they are all located there. 

I am glad I could help.