2

I added maven dependencies servlet-api 2.5, javaee-web-api 6.0, but I still get this exceptions. Any help would be very much appreciated =) Thanks.

        java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.getParts()Ljava/util/Collection;
at org.springframework.web.multipart.support.StandardMultipartHttpServletRequest.<init>(StandardMultipartHttpServletRequest.java:57)
  at org.springframework.web.multipart.support.StandardServletMultipartResolver.resolveMultipart(StandardServletMultipartResolver.java:58)
  at org.springframework.web.servlet.DispatcherServlet.checkMultipart(DispatcherServlet.java:1020)
  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:883)
  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
  at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
  at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
  at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1221)
  at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:147)
2
  • 1
    please check that the server you run the application on also supports this version of the API Commented Nov 30, 2013 at 11:07
  • please paste some code from StandardMultipartHttpServletRequest.java with all imports Commented Nov 30, 2013 at 11:11

2 Answers 2

3

According to me, following may be the problem. your code is referring some Other HttpServletRequest at compile time which has a method called getParts() and at runtime(when you are deploying your project and running) it is referring javax.servlet.http.HttpServletRequest for resolution and it is not finding any such method.

check in your code(imports) which package is it referring for HttpServletRequest class resolution

i can also see that servlet API 2.5 does not have any such method in HttpServletRequest class while javaee-web-api 6.0 does you can remove unwanted dependancy and also you need to make sure the dependancy you used is available to your code at runtime

Sign up to request clarification or add additional context in comments.

Comments

1

Since you are using Jetty 6 (servlet spec 2.5), the HttpServletRequest object doesn't have the Servlet 3.0 getParts() method. You need to get an other servlet container (upgrade to Jetty 9) to get this working.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.