在Domino 8.5.3上的OSGi插件中使用org.apache.commons.fileupload.ServletFileUpload

时间:2014-03-17 17:53:25

标签: java eclipse servlets classloader lotus-domino

我有一个扩展javax.servlet.HttpServlet的servlet。我希望从多部分表单提交中将过程文件上传到它。

当我尝试通过将数据发布到此servlet来做最小的事情时。我得到一个类加载器错误(见下文)。我不是在构建路径中复制jar文件。

如果你看到同样的问题并修好它,我有点难过吗?

代码的相关位是:

import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;

@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {

super.doPost(req, resp);

try{
if (!ServletFileUpload.isMultipartContent(req)) {
             throw new IllegalArgumentException("Request is not multipart, please 'multipart/form-data' enctype for your form.");
}else{
System.out.println("OK");
}
}catch(Exception e){
e.printStackTrace();
}finally{

}

}

错误是这样的:

17/03/14 17:26:异常抛出 java.lang.LinkageError:加载约束违规:加载器“sun / misc / Launcher $ ExtClassLoader @ 23b423b4”以前为加载器“org / eclipse / osgi /”定义的名称为“javax / servlet / http / HttpServletRequest”的其他类型启动加载内部/ baseadaptor / DefaultClassLoader @ 6bb06bb”     at java.lang.ClassLoader.defineClassImpl(Native Method)     at java.lang.ClassLoader.defineClass(ClassLoader.java:275)     at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:74)     at java.net.URLClassLoader.defineClass(URLClassLoader.java:540)     at java.net.URLClassLoader.defineClass(URLClassLoader.java:451)     在java.net.URLClassLoader.access $ 300(URLClassLoader.java:79)     at java.net.URLClassLoader $ ClassFinder.run(URLClassLoader.java:1038)     在java.security.AccessController.doPrivileged(AccessController.java:310)     在java.net.URLClassLoader.findClass(URLClassLoader.java:429)     在sun.misc.Launcher $ ExtClassLoader.findClass(Launcher.java:281)     at java.lang.ClassLoader.loadClass(ClassLoader.java:660)     at java.lang.ClassLoader.loadClass(ClassLoader.java:626)     在org.apache.commons.fileupload.servlet.ServletFileUpload.isMultipartContent(ServletFileUpload.java:68)     在com.jasonhook.test.TestFileUpload.doPost(TestFileUpload.java:30)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:713)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:806)     at org.eclipse.equinox.http.registry.internal.ServletManager $ ServletWrapper.service(ServletManager.java:180)     在org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(ServletRegistration.java:90)     在org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:111)     在org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:59)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:806)     在com.ibm.domino.xsp.adapter.osgi.OSGIModule.invokeServlet(OSGIModule.java:165)     在com.ibm.domino.xsp.adapter.osgi.OSGIModule.access $ 0(OSGIModule.java:151)     在com.ibm.domino.xsp.adapter.osgi.OSGIModule $ 1.invokeServlet(OSGIModule.java:132)     在com.ibm.domino.xsp.adapter.osgi.AbstractOSGIModule.invokeServletWithNotesContext(AbstractOSGIModule.java:179)     在com.ibm.domino.xsp.adapter.osgi.OSGIModule.doService(OSGIModule.java:126)     在com.ibm.domino.xsp.adapter.osgi.OSGIService.doService(OSGIService.java:391)     在com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:341)     在com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:297)     在com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)

0 个答案:

没有答案