The Wayback Machine - https://web.archive.org/web/20210111173652/https://github.com/lets-blade/blade/issues/171
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got an exception while uploading a file #171

Open
runyan opened this issue Dec 22, 2017 · 5 comments
Open

Got an exception while uploading a file #171

runyan opened this issue Dec 22, 2017 · 5 comments

Comments

@runyan
Copy link

@runyan runyan commented Dec 22, 2017

Environment

  • blade: 2.0.5-RELEASE
  • jdk: 1.8.0_111
  • maven: 3.3.9
  • OS: Windows 7 Home Basic

Description

When I tried to upload a file, an java.lang.UnsupportedOperationException: direct buffer raised, so that the upload operation cannot be done. The full exception stack is as follows:

java.lang.UnsupportedOperationException: direct buffer
	at io.netty.buffer.PooledUnsafeDirectByteBuf.array(PooledUnsafeDirectByteBuf.java:343)
	at com.blade.mvc.http.HttpRequest.parseFileUpload(HttpRequest.java:124)
	at com.blade.mvc.http.HttpRequest.parseData(HttpRequest.java:103)
	at java.util.ArrayList.forEach(ArrayList.java:1249)
	at com.blade.mvc.http.HttpRequest.init(HttpRequest.java:81)
	at com.blade.mvc.http.HttpRequest.build(HttpRequest.java:286)
	at com.blade.server.netty.HttpServerHandler.channelRead0(HttpServerHandler.java:73)
	at com.blade.server.netty.HttpServerHandler.channelRead0(HttpServerHandler.java:36)
	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
	at io.netty.handler.codec.http.HttpServerExpectContinueHandler.channelRead(HttpServerExpectContinueHandler.java:95)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:438)
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284)
	at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1359)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:935)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:141)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

Screenshot of the problem

postman's screenshot

_20171222140326

Config
And my maven configuration is
_20171222141613

Addtional Information

My project could be found at https://github.com/runyan/blade/tree/master/bladeDemo

@biezhi biezhi self-assigned this Dec 22, 2017
@biezhi
Copy link
Member

@biezhi biezhi commented Dec 22, 2017

Thanks for your feedback on this issue, you are trying to use version 2.0.6-Alpha1, a known incompatibility bug in netty-4.1.18.Final.

@runyan
Copy link
Author

@runyan runyan commented Dec 25, 2017

@biezhi thanks for your information, however, the problem still exists in blade 2.0.6-Alpha1, but with this version, there is no error information printed out in the web server, and postman still cannot get any responses.

@biezhi
Copy link
Member

@biezhi biezhi commented Dec 29, 2017

I will try this problem in windows system.

@chenshun00
Copy link

@chenshun00 chenshun00 commented May 26, 2018

@biezhi
Adding such annotations like @Path("upload") will cause the upload to fail. but use @Path will successful . and there is url log like 2018/05/26 20:30:55 INFO [ worker@threadㄧ1 ] c.b.m.h.RequestExecution : 200 1679ms POST /upload/file but not handled by controller

OS : windows 10
Blade:blade 2.0.8-BETA1

@chenshun00
Copy link

@chenshun00 chenshun00 commented Dec 30, 2020

hmmmm , in my mac , it work , upload success

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.