Just a quick blog post to alert that there is an error in one of the config files in the Spring-MVC course. I’m uploading a fixed version now, so if you’re a user of the course, please download the new “Practicals and Code” folder, or follow these instructions:
If you start your project from the “Starting Code” folder, our web.xml contains the following:
{!{code}!}czo1MzA6XCIgICAmbHQ7IS0tICB3ZVwndmUgYWxyZWFkeSBjb25maWd1cmVkIFNwcmluZy1NVkMgZm9yIHlvdSAtIG5vdGhpbmcgdG8ge1smKiZdfWRvIGhlcmUhIC0tJmd0OyAgICAgICAgIAogICAgJmx0O3NlcnZsZXQmZ3Q7CiAgICAgICAmbHQ7c2VydmxldC1uYW1lJmd0O0Zyb257WyYqJl19dENvbnRyb2xsZXImbHQ7L3NlcnZsZXQtbmFtZSZndDsKICAgICAgICZsdDtzZXJ2bGV0LWNsYXNzJmd0O29yZy5zcHJpbmdmcmFtZXtbJiomXX13b3JrLndlYi5zZXJ2bGV0LkRpc3BhdGNoZXJTZXJ2bGV0Jmx0Oy9zZXJ2bGV0LWNsYXNzJmd0OwogICAgICAgJmx0O2xvYWQtb24te1smKiZdfXN0YXJ0dXAmZ3Q7MSZsdDsvbG9hZC1vbi1zdGFydHVwJmd0OwogICAgJmx0Oy9zZXJ2bGV0Jmd0OwogIAogICAgJmx0O3NlcnZsZXR7WyYqJl19LW1hcHBpbmcmZ3Q7CiAgICAgICAmbHQ7c2VydmxldC1uYW1lJmd0O0Zyb250Q29udHJvbGxlciZsdDsvc2VydmxldC1uYW1lJmd0O3tbJiomXX0KICAgICAgICZsdDt1cmwtcGF0dGVybiZndDsqLmRvJmx0Oy91cmwtcGF0dGVybiZndDsKICAgICZsdDsvc2VydmxldC1tYXBwaW5ne1smKiZdfSZndDsKXCI7e1smKiZdfQ=={!{/code}!}
However, our Spring XML config file is called “Dispatcher-servlet.xml”.
By default, Spring finds it’s config file in a web app by taking the servlet name and appending “-servlet.xml” to the end – it then looks for a matching file in /WEB-INF.
If you downloaded the course before the date of this post, please rename the servlet name to Dispatcher (it appears twice in web.xml).
So, your web.xml file should be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7c2VydmxldC1tYXBwaW5nJmd0e1smKiZdfTsKICAgICAgICZsdDtzZXJ2bGV0LW5hbWUmZ3Q7RGlzcGF0Y2hlciZsdDsvc2VydmxldC1uYW1lJmd0OwogICAgICAgJmx0O3VybC17WyYqJl19cGF0dGVybiZndDsqLmRvJmx0Oy91cmwtcGF0dGVybiZndDsKICAgICZsdDsvc2VydmxldC1tYXBwaW5nJmd0OwoKJmx0Oy93ZWItYXtbJiomXX1wcCZndDsKXCI7e1smKiZdfQ=={!{/code}!}
Many apologies for the inconvenience this has caused – it was entirely my fault and happened because I changed my naming convention between chapters.
Thanks to David Wubshet and Benjamin Quarless amongst others for flagging up this problem.