This is not a problem with your file upload code this usually indicates something is wrong with your URL mappings. Check your mappings in web.xml and double check your @RequestMapping value it does not look right to me.
Also in your web.xml find where you have your dispatcher servlet mapping defined and make sure it is mapped to / as follows:
When I created a simple sample project using your code with the above changes it works correctly so try that first.
If that does not work...
The part of your exception that says
Required MultipartFile parameter 'filename' is not present
usually pops up when the below is missing:
Now I know you showed you have that in your config, but do you have it scoped so that the dispatcher servlet can see it? I would also double check that. If none of this works post your web.xml so we can have a look at it.
I had used similar solutions and worked fine. After some efforts I found the problem. The problem is the bug in the Glassfish 3.1.2. After installing the suggested patch it is working fine.
The JiRA link is Glassfish Jira