0

我收到此错误,但不确定它的实际领先位置。当我尝试上传 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();
        }
4

1 回答 1

1

对我在这里收到的回复非常满意[实际上没有];我不确定你们这些极客是否知道这个问题或实际上有任何意见:但无论如何,它已经解决了,这里是答案:

问题是,在我们的 unix 机器中,配置了 Ngnix,当检查 Ngnix 错误日志时,发现:

[error] 25556#0: *52 client intended to send too large body:

这甚至不允许上传 2 MB 的文件。将配置更改为更高的大小限制后;它开始工作了。下面的代码将帮助你:

php.ini 的变化

将最大文件上传大小更改为 100MB

vim /etc/php5/fpm/php.ini

设置...</p>

upload_max_filesize = 100M
post_max_size = 100M

谢谢,

于 2013-06-16T20:47:25.483 回答