gpt4 book ai didi

java - Jetty MultipartFormDataInput 未调度

转载 作者:行者123 更新时间:2023-12-01 10:32:30 25 4
gpt4 key购买 nike

我正在开发一个 Jetty Servlet,它应该用于上传文件和一些参数,但是 MultipartFormDataInput 抛出异常。但到目前为止,jetty 网络服务器已按预期启动。

代码如下所示:

@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_JSON)
public void createApp(MultipartFormDataInput ressources, @Suspended AsyncResponse response);

当请求调用此 servlet 时,将引发以下异常:

java.lang.NoClassDefFoundError: Could not initialize class org.apache.james.mime4j.storage.DefaultStorageProvider
at java.lang.Class.forName0(Native Method) ~[?:1.8.0_60]
at java.lang.Class.forName(Class.java:348) ~[?:1.8.0_60]
at org.apache.logging.log4j.core.util.Loader.initializeClass(Loader.java:285) ~[log4j-core-2.0.2.jar:2.0.2]
at org.apache.logging.log4j.core.impl.ThrowableProxy.loadClass(ThrowableProxy.java:500) ~[log4j-core-2.0.2.jar:2.0.2]
at org.apache.logging.log4j.core.impl.ThrowableProxy.toExtendedStackTrace(ThrowableProxy.java:621) [log4j-core-2.0.2.jar:2.0.2]
at org.apache.logging.log4j.core.impl.ThrowableProxy.<init>(ThrowableProxy.java:146) [log4j-core-2.0.2.jar:2.0.2]
at org.apache.logging.log4j.core.impl.Log4jLogEvent.getThrownProxy(Log4jLogEvent.java:323) [log4j-core-2.0.2.jar:2.0.2]
at org.apache.logging.log4j.core.impl.Log4jLogEvent.serialize(Log4jLogEvent.java:429) [log4j-core-2.0.2.jar:2.0.2]
at org.apache.logging.log4j.core.appender.AsyncAppender.append(AsyncAppender.java:153) [log4j-core-2.0.2.jar:2.0.2]
at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:97) [log4j-core-2.0.2.jar:2.0.2]
at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:428) [log4j-core-2.0.2.jar:2.0.2]
at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:407) [log4j-core-2.0.2.jar:2.0.2]
at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:365) [log4j-core-2.0.2.jar:2.0.2]
at org.apache.logging.log4j.core.Logger.logMessage(Logger.java:112) [log4j-core-2.0.2.jar:2.0.2]
at org.apache.logging.slf4j.Log4jLogger.log(Log4jLogger.java:374) [log4j-slf4j-impl-2.0.2.jar:2.0.2]
at org.eclipse.jetty.util.log.JettyAwareLogger.log(JettyAwareLogger.java:607) [jetty-util-9.2.10.v20150310.jar:9.2.10.v20150310]
at org.eclipse.jetty.util.log.JettyAwareLogger.warn(JettyAwareLogger.java:431) [jetty-util-9.2.10.v20150310.jar:9.2.10.v20150310]
at org.eclipse.jetty.util.log.Slf4jLog.warn(Slf4jLog.java:69) [jetty-util-9.2.10.v20150310.jar:9.2.10.v20150310]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:667) ~[jetty-servlet-9.2.10.v20150310.jar:9.2.10.v20150310]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) ~[jetty-server-9.2.10.v20150310.jar:9.2.10.v20150310]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) ~[jetty-servlet-9.2.10.v20150310.jar:9.2.10.v20150310]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) ~[jetty-server-9.2.10.v20150310.jar:9.2.10.v20150310]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[jetty-server-9.2.10.v20150310.jar:9.2.10.v20150310]
at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52) ~[jetty-server-9.2.10.v20150310.jar:9.2.10.v20150310]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) ~[jetty-server-9.2.10.v20150310.jar:9.2.10.v20150310]
at org.eclipse.jetty.server.Server.handle(Server.java:497) ~[jetty-server-9.2.10.v20150310.jar:9.2.10.v20150310]
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310) [jetty-server-9.2.10.v20150310.jar:9.2.10.v20150310]
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) [jetty-server-9.2.10.v20150310.jar:9.2.10.v20150310]
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) [jetty-io-9.2.10.v20150310.jar:9.2.10.v20150310]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_60]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_60]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_60]

如果我删除 MultipartFormDataInput 参数,一切都会按预期工作。我的代码有什么问题吗?

更新

此后还有其他输出消息:

2016-01-26 13:20:00,152 WARN  [pool-2-thread-15] ? (:) - badMessage: java.lang.IllegalStateException: too much data after closed for HttpChannelOverHttp@46c1358f{r=1,c=false,a=IDLE,uri=-}

更新2

这是我的 Maven 依赖项。

<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-multipart-provider</artifactId>
<version>3.0.9.Final</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>

最佳答案

堆栈跟踪告诉您 slf4j + log4j 设置未正确配置。

您的设置中的某些内容正在尝试将日志发送到需要正常运行的 org.apache.james.mime4j.storage.DefaultStorageProvider 类的附加程序。

由于某种原因该类无法初始化。应该有更多的日志记录事件(可能更早)来说明原因。

来自 Apache James Mime4j 网站...

Apache James Mime4J provides a parser, MimeStreamParser, for e-mail message streams in plain rfc822 and MIME format.

也许您的 log4j 设置正在尝试针对某些事件发送电子邮件?

有关“HttpChannelOverHttp 关闭后数据过多”的警告消息是 servlet 出错且未处理请求正文内容的结果。忽略该警告,首先解决根本问题。

关于java - Jetty MultipartFormDataInput 未调度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35014020/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com