我收到此错误,但不确定它的实际领先位置。当我尝试上传 100 KB 的文件时;它可以很好地上传到 S3,但是对于 2MB 的文件,它会失败,没有严重的异常,但是:
[trace] play - Sending simple result: SimpleResult(200, Map(Content-Type -> text/html; charset=utf-8, Set-Cookie -> ))
[trace] application - Exception caught in Netty
java.lang.ClassCastException: scala.runtime.BoxedUnit cannot be cast to scala.Function0
at play.core.server.netty.PlayDefaultUpstreamHandler.channelDisconnected(PlayDefaultUpstreamHa n dler.scala:50) ~[play.play_2.10-2.1.0.jar:2.1.0]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.cleanup(ReplayingDecoder.java:570) ~[io.netty.netty-3.6.3.Final.jar:na]
at org.jboss.netty.handler.codec.frame.FrameDecoder.channelDisconnected(FrameDecoder.java:365) ~[io.netty.netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.Channels.fireChannelDisconnected(Channels.java:396) ~[io.netty.netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.close(AbstractNioWorker.java:336) ~[io.netty.netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.handleAcceptedSocket(NioServ erSocketPipelineSink.java:81) ~[io.netty.netty-3.6.3.Final.jar:na]
[trace] play - Http request received by netty: DefaultHttpRequest(chunked: false)
GET /favicon.ico HTTP/1.0
X-Real-IP: X.X.X.X
X-Scheme: http
X-Forwarded-For: X.X.X.X, X.X.X.X
Host:
Connection: close
Accept: */*
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
Cookie: s_nr=1369981333181; PLAY_SESSION=f672ed541f895539f476
它甚至没有到达 Web 服务器并且失败并抛出 500 page not found 错误;因为它突然关闭了连接。
我正在使用 Play Framework 2.0 并使用 AWS S3 HL 分段上传。我等到上传在我的服务中完成。
请让我知道可能是什么问题;或任何导致这个?
这是我的代码:
//Setting expiration time for the files in temp bucket to 24 hours [1 Day]
ObjectMetadata objectMetadata = new ObjectMetadata();
objectMetadata.setExpirationTime(DateTime.now().plusDays(1).toDate());
objectMetadata.setContentLength(UploadData.getFileSize());
//Setting user data
userData = new HashMap<>();
userData.put(UserMetaData.filename.name(), UploadData.getFileName());
if (!NullChecker.isEmpty(UploadData.getFileSize())) {
userData.put(UserMetaData.size.name(), String.valueOf(UploadData.getFileSize()));
}
if (!NullChecker.isEmpty(UploadData.getSerialNo())) {
userData.put(UserMetaData.serialno.name(), UploadData.getSerialNo());
}
objectMetadata.setUserMetadata(userData);
// TransferManager processes all transfers asynchronously,
// so this call will return immediately.
upload = transferManager.upload(bucketName, key, UploadData.getFileInputStream(), objectMetadata);
try {
// Or you can block and wait for the upload to finish
upload.waitForCompletion();
} catch (AmazonClientException amazonClientException) {
logger.info("Unable to upload file, upload was aborted.");
amazonClientException.printStackTrace();
}