5

I am trying to save a data in DB through spring MVC. when I hit save button it redirects me to a page where the error is as follows:

The requested URL /save was not found on this server.

Same code is working on DEV on localhost, I think there is some problem with standalone

In Controller.java:

@RequestMapping(value="/save", params="save")     
public ModelAndView save(@RequestParam("save") String save) {.....}

The save pages updates/delete the data from data base

Javier C.
  • 7,859
  • 5
  • 41
  • 53
Rick
  • 373
  • 5
  • 19
  • check this http://stackoverflow.com/questions/18853066/404-not-found-the-requested-url-was-not-found-on-this-server – Pavan Kumar Jorrigala Mar 30 '17 at 14:58
  • You could increase your chances of getting an answer by posting a simplified example of how you configured your /save url mapping – Gary Apr 04 '17 at 02:39
  • @Gary the same code is working fine on local system of my and my colleagues but not working on server. – Rick Apr 04 '17 at 15:16
  • I would check the startup log file and look for Spring RequestMappingHandlerMapping lines matching "Mapped". Do you see your /save url there? – Gary Apr 04 '17 at 15:57
  • Also - I assume you are deploying this application as a war file to Jboss? If so, how is that context configured? – Gary Apr 04 '17 at 15:59

3 Answers3

3

I wonder if your application is actually deployed, but just at a URL you don't expect. It is quite common for app servers to add a context url with the name of the war file. For example, if you war file is named myapp.war, your /save url might be visible like

http://www.example.com/myapp/save

Gary
  • 6,357
  • 5
  • 30
  • 36
  • If i deploy same war file in testing or development environment it works fine. the jBoss settings are same, i reconfigured it twice onlu standalone.xml differs. in code i have mentioned timeout as 15 15 – Rick Apr 05 '17 at 08:40
  • 1
    Do you see evidence in the log file that your application started up? i..e the /save url is mapped? – Gary Apr 05 '17 at 17:09
1

may be your Spring web application doesn't deploy correctly. please follow this link.

Tharaka
  • 189
  • 2
  • 4
  • 20
  • The code is working fine on local system, its not working on server. I tried your answer but still no success – Rick Apr 05 '17 at 08:34
0
id: my-service
    uri: ${param.url}
    predicates:
        - Path=/storage/**
    filters:
        - RewritePath=/storage/(?<segment>.*), /$\{segment}

i also use this method but it just work on localhost, in server it doesnt work