0

我是eclipse和tomcat的新手。我正在创建一个 servlet,它获取图像并将其保存在数据库中。
我正在使用 Jre 1.6 和 tomcat 7。为此,我使用了自定义库:

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

现在我在部署我的项目时遇到了这个错误:

10 Jun, 2013 6:34:37 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/BIOMetric2]]
    at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
    at java.util.concurrent.FutureTask.get(Unknown Source)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)    

etc..

在此处输入图像描述

4

1 回答 1

-1

我使用了@MultipartConfig,现在工作正常。我使用了这段代码。...

import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;

...

Part filePart = request.getPart("img");
String imageName = filePart.getName(); 
InputStream in = filePart.getInputStream();

……

于 2013-06-11T08:25:51.363 回答