Spring 3, OpenJPA 2 and Commons-fileupload.
sudhi Jan 3, 2013 10:48 AMHi All,
i am using Spring 3.1, with OpenJPA 2.1 in JBOSS 7 . As per discussions and few articles, i have created new module for OpenJPA 2.1and used in application. Application worked fine until a functional requirement came for uploading files wherein we were supposed to use commons-fileupload.
Firstly while creating module for OpenJPA, server failed to start until i added Commons-fileupload jar. Below shows the module.xml that i used for OpenJPA 2, So question is not sure why OpenJPA is refering to fileupload.
<module xmlns="urn:jboss:module:1.1" name="org.apache.openjpa">
<resources>
<resource-root path="openjpa-all-2.2.0.jar"/>
<resource-root path="serp-1.13.1.jar"/>
<resource-root path="commons-fileupload-1.2.2.jar"/>
</resources>
<dependencies>
<module name="javax.persistence.api"/>
<module name="javax.transaction.api"/>
<module name="javax.validation.api"/>
<module name="org.apache.log4j"/>
</dependencies>
</module>
Secondly, after above conf, when i wanted to implement upload functionality, i created a controller in Spring and multipart request was sent.
But runtime i get NoClassDefFound excpetion for HttpServletRequest
java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
org.apache.commons.fileupload.servlet.ServletFileUpload.isMultipartContent(ServletFileUpload.java:68)
org.springframework.web.multipart.commons.CommonsMultipartResolver.isMultipart(CommonsMultipartResolver.java:122)
org.springframework.web.servlet.DispatcherServlet.checkMultipart(DispatcherServlet.java:991)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:860)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
Can anyone please tell me where i am going wrong or guide me for right class loading approach that needs to be followed in Jboss 7
Thanks
Sudhi