【发布时间】:2021-12-25 18:08:36
【问题描述】:
我正在尝试将文件上传到 Azure Blob 存储,但将文件推送到存储时出现错误。
我正在使用带有 Quarkus 的 java 11 进行开发。 在 POM 上,我添加了工件 azure-storage-blob 和 azure-sdk-bom
代码:
BlobClient blobClient = new BlobClientBuilder()
.endpoint("...")
.sasToken("...")
.containerName("random-files")
.blobName("file")
.buildClient();
String randomText = "random string";
blobClient.upload(BinaryData.fromString(randomText));
恢复错误
io.net.cha.DefaultChannelPipeline] (vert.x-eventloop-thread-2) 触发了一个 exceptionCaught() 事件,它到达了管道的尾部。这通常意味着管道中的最后一个处理程序没有处理异常。:java.lang.NoClassDefFoundError: Could not initialize class io.netty.handler.codec.http.HttpVersion
完整的错误日志:
WARN [io.net.cha.DefaultChannelPipeline] (vert.x-eventloop-thread-2) 触发了一个 exceptionCaught() 事件,它到达了管道的尾部。这通常意味着管道中的最后一个处理程序没有处理异常。:java.lang.NoClassDefFoundError: Could not initialize class io.netty.handler.codec.http.HttpVersion 在 io.vertx.core.http.impl.VertxHttpRequestDecoder.createMessage(VertxHttpRequestDecoder.java:35) 在 io.netty.handler.codec.http.HttpObjectDecoder.decode(HttpObjectDecoder.java:273) 在 io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:501) 在 io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:440) 在 io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:404) 在 io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:371) 在 io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:354) 在 io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262) 在 io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248) 在 io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241) 在 io.netty.channel.DefaultChannelPipeline$HeadContext.channelInactive(DefaultChannelPipeline.java:1405) 在 io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262) 在 io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248) 在 io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:901) 在 io.netty.channel.AbstractChannel$AbstractUnsafe$8.run(AbstractChannel.java:818) 在 io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) 在 io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472) 在 io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:497) 在 io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) 在 io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) 在 io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) 在 java.base/java.lang.Thread.run(Thread.java:833)
你知道问题出在哪里吗?我只是使用 Quarkus 上传文件的基础知识,但看起来存在版本问题或类似问题。
【问题讨论】:
-
你能添加你的 pom.xml 吗?看起来你缺少一些基本的 netty 包?
-
我不这么认为..实际上我添加了依赖项
添加所有缺失的依赖项io.netty netty-all 5.0.0.Alpha2 provided -
为什么提供范围?这表明运行时提供了库