camel with netty4-http - EncoderException(camel with netty4-http - EncoderException)
我正在使用带有netty4-http的camel 2.14.0,我得到以下异常。
场景是这样的:我有一个发送请求的路由,等待响应(inOut),然后发送另一个请求。 第一个请求有效,然后第二个请求失败。
另外,如果我在失败后迅速做到这一点 - 第一个请求也将失败。
在调试一下(HttpObjectEncoder) - 我看到在工作流程中请求的状态是:state = ST_INIT(0)并且在失败的请求中是:ST_CONTENT_NON_CHUNK(1)当导致非法状态时的类型消息是HttpMessage
这是一个错误还是我可以配置什么来修复它?
引起:io.netty.handler.codec.EncoderException:java.lang.IllegalStateException:意外消息类型:io.netty.channel上的io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:107)中的DefaultFullHttpRequest。 CombinedChannelDuplexHandler.write(combinedChannelDuplexHandler.java:192)位于io.netty的io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658)io.netty.channel.AbstractChannelHandlerContext.access $ 2000(AbstractChannelHandlerContext.java:32)。 channel.AbstractChannelHandlerContext $ AbstractWriteTask.write(AbstractChannelHandlerContext.java:939)at io.netty.channel.AbstractChannelHandlerContext $ WriteAndFlushTask.write(AbstractChannelHandlerContext.java:991)at io.netty.channel.AbstractChannelHandlerContext $ AbstractWriteTask.run(AbstractChannelHandlerContext.java: 924)at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:380)at io.netty.channel.nio.NioEventLoop.r un(NioEventLoop.java:357)at io.netty.util.concurrent.SingleThreadEventExecutor $ 2.run(SingleThreadEventExecutor.java:116)at java.lang.Thread.run(Thread.java:745)引起:java.lang。 IllegalStateException:意外消息类型:io.netty.handler.codec.http.HttpObjectEncoder.encode(HttpObjectEncoder.java:63)中的DefaultFullHttpRequest,位于io.netty.handler.codec.http.HttpClientCodec $ Encoder.encode(HttpClientCodec.java:106) )at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:89)... 10更多
I'm using camel 2.14.0 with netty4-http and I get the following exception.
the scenario is this: I have a route that sends a request, waits for the response (inOut) and then sends another request. the first request works, and then the second one fails.
also, if I do it quickly enough after the failure - the first request will also fail.
while debugging a bit (HttpObjectEncoder) - I saw that in the working flow the state of the request is: state = ST_INIT (0) and in the request that failed it is: ST_CONTENT_NON_CHUNK (1) which causes the illegal state when the type of message is HttpMessage
is this a bug or is there anything I can configure to fix it?
Caused by: io.netty.handler.codec.EncoderException: java.lang.IllegalStateException: unexpected message type: DefaultFullHttpRequest at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:107) at io.netty.channel.CombinedChannelDuplexHandler.write(CombinedChannelDuplexHandler.java:192) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658) at io.netty.channel.AbstractChannelHandlerContext.access$2000(AbstractChannelHandlerContext.java:32) at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.write(AbstractChannelHandlerContext.java:939) at io.netty.channel.AbstractChannelHandlerContext$WriteAndFlushTask.write(AbstractChannelHandlerContext.java:991) at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:924) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:380) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.IllegalStateException: unexpected message type: DefaultFullHttpRequest at io.netty.handler.codec.http.HttpObjectEncoder.encode(HttpObjectEncoder.java:63) at io.netty.handler.codec.http.HttpClientCodec$Encoder.encode(HttpClientCodec.java:106) at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:89) ... 10 more
原文:https://stackoverflow.com/questions/26201196
最满意答案
你遇到的问题的原因是由于范围界定。 具体来说,
forEach
this
内部不再绑定到Vue实例。 为了解决这个问题,请尝试在进入循环之前将参考存储在变量中,如下所示:select_rowse: function () { this.deselect_rows(); var this_vue_instance = this; this.get_rows().forEach(function (entry) { this_vue_instance.selectedRows.push(entry.id); }); }
一般来说,您应尽可能避免使用
vm.$data
。 尤其是,如果您有多个对整个代码中散布的变量的引用,并且您需要重命名该变量,而this
将保持一致,则会遇到问题。 如果绝对必要,只能使用变量引用,这应该是不常见的。The reason you run into the issue you're having is due to scoping. Specifically,
this
inside of theforEach
is no longer bound to the Vue instance. In order to resolve this problem, try storing the reference in a variable prior to entering the loop, like in the following:select_rowse: function () { this.deselect_rows(); var this_vue_instance = this; this.get_rows().forEach(function (entry) { this_vue_instance.selectedRows.push(entry.id); }); }
In general, you should try to avoid using
vm.$data
whenever possible. In particular, you will run into issues if you have multiple references to the variable scattered throughout your code and if you ever need to rename the variable, whereasthis
will remain consistent. Only use a variable reference if absolutely necessary, which should be infrequent.
相关问答
更多-
电脑二级考试 是考access 还是VPF[2022-06-08]
access -
你遇到的问题的原因是由于范围界定。 具体来说, forEach this内部不再绑定到Vue实例。 为了解决这个问题,请尝试在进入循环之前将参考存储在变量中,如下所示: select_rowse: function () { this.deselect_rows(); var this_vue_instance = this; this.get_rows().forEach(function (entry) { this_vue_instance.selectedRo ...
-
你在用Vueify吗? 我对你如何在这里组织你的文件感到有点困惑。 https://github.com/vuejs/vueify 我们需要看到的是您的模板。 看起来你有一个topmenu组件和一个topmenu-search组件,所以topmenu的模板topmenu应该是这样的:
-
经过一些尝试和错误后,我找到了答案,现在很明显了。 问题是,我在错误的地方搜索数据。 我定义的vm对象是这样的 vm = new Vue({ template: '', components: { account } }).$mount() 是仅具有组件和模板选项的Vue实例,我搜索的数据位于该实例的子级中 。 所以,我必须用这种方式来访问数据 const accountInstance = vm.$children[0] 这样做,因为 ...
-
你需要.bind this上下文,因为回调并不是在组件的上下文中自然调用的: var MyComp = Vue.extend({ props: { html_prop: null, }, // .... fetchCondiciones: function(url){ $.ajax({ type: "GET", url: url, ...
-
Vue属性未定义(Vue property undefined)[2024-03-11]
您看到的错误是由于在获取引号之前尝试绑定quotes[index].quote的值,因此您需要使用v-if有条件地呈现该部分:{{ quotes[index].quote }}var vue = new Vue({ el: '#vue-wrapper', data: { items: [{ subitems: []}], }) 您的示例中未定义子项。 这应该解决它。 var vue = new Vue({ el: '#vue-wrapper', data: { items: [{ subitems: []}], }) Subitems was not defined in your example. This should fix it.回调中的内容是指回调本身(或者更确切地说,如指出的,回调的执行上下文),而不是Vue实例。 如果要访问this您需要将其分配给回调之外的内容: // Assign this to self var self = this; firebase.auth().signInWithEmailAndPassword(this.email, this.password) .then(function (data) { self.user = firebase.auth().curre ...在vuejs中访问父组件中的子组件数据 如果您有一个名为parent的父组件parent组件,则可以使用props和events在彼此之间进行通信。 props :促进父母与孩子之间的沟通。 events :可用于将子组件中的数据传递给父组件。 对于这个问题,我们需要事件,并将使用v-model使子组件在任何地方都可用,而设置更少。 Vue.component('counter', { template: `我认为你不能在JS对象语法中使用equal data: { articles = '' } I think you can't use equal in the JS object syntax data: { articles = '' }相关文章
更多- [Netty 1] 初识Netty
- Netty环境配置
- Netty开发环境配置
- Netty源码分析
- HTTP缓存问题
- 快速了解HTTP
- storm学习之Netty代替ZMQ
- Netty基于流的传输处理
- 在Twitter,Netty 4 GC开销降为五分之一
- Guava ASCII字符转换 CaseFormat类
最新问答
更多- 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
- 如何通过引用返回对象?(How is returning an object by reference possible?)
- 矩阵如何存储在内存中?(How are matrices stored in memory?)
- 每个请求的Java新会话?(Java New Session For Each Request?)
- css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
- 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
- xcode语法颜色编码解释?(xcode syntax color coding explained?)
- 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
- 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
- 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
- 西安哪有PLC可控制编程的培训
- 在Entity Framework中选择基类(Select base class in Entity Framework)
- 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
- 电脑二级VF有什么用
- Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
- 金华英语角.
- 手机软件如何制作
- 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
- 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
- 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
- Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
- 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
- python的访问器方法有哪些
- DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
- 在Ruby中对组合进行排序(Sorting a combination in Ruby)
- 网站开发的流程?
- 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
- 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
- 透明度错误IE11(Transparency bug IE11)
- linux的基本操作命令。。。