- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
这个问题是关于 Siddhi - CEP 的 java 库
描述:
我试图建立一个 HTTP 源来接收数据。创建运行时并启动它没有错误。
[nioEventLoopGroup-2-1] INFO org.wso2.transport.http.netty.listener.ServerConnectorBootstrap$HTTPServerConnector - HTTP(S) Interface starting on host localhost and port 9056
[main] INFO org.wso2.extension.siddhi.io.http.source.HttpConnectorPortBindingListener - siddhi: started HTTP server connector localhost:9056
[main] INFO org.wso2.extension.siddhi.io.http.source.HttpSourceListener - Source Listener has created for url http://localhost:9056/endpoints/
但是,当我向指定地址发送POST请求时。我得到一个错误:
[nioEventLoopGroup-3-1] ERROR org.wso2.extension.siddhi.io.http.source.HTTPConnectorListener - Error in http server connector
java.lang.NoSuchMethodError: io.netty.handler.codec.http.HttpRequest.method()Lio/netty/handler/codec/http/HttpMethod;
at org.wso2.transport.http.netty.listener.CustomHttpContentCompressor.decode(CustomHttpContentCompressor.java:44)
at org.wso2.transport.http.netty.listener.CustomHttpContentCompressor.decode(CustomHttpContentCompressor.java:14)
at io.netty.handler.codec.MessageToMessageCodec$2.decode(MessageToMessageCodec.java:81)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89)
at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:276)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:354)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:244)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:846)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
at java.lang.Thread.run(Thread.java:748)
任何人都可以提出我做错的原因吗?提前谢谢你。
受影响的产品版本:4.1.17
操作系统、数据库、其他环境详细信息和版本:
IntelliJ IDEA 2017.3.5(社区版)构建 #IC-173.4674.33,构建于 2018 年 3 月 6 日JRE:1.8.0_152-release-1024-b15 amd64JVM:JetBrains s.r.o 的 OpenJDK 64 位服务器 VMWindows 10 10.0
重现步骤:我写的测试代码:
import org.wso2.siddhi.core.SiddhiAppRuntime;
import org.wso2.siddhi.core.SiddhiManager;
import org.wso2.siddhi.core.event.Event;
import org.wso2.siddhi.core.stream.output.StreamCallback;
import org.wso2.siddhi.core.util.EventPrinter;
//import org.wso2.extension.siddhi.io.http.source.*;
public class httpTest
{
public static void main(String[] args) {
String siddhiString = "@App:name(\"haha\") " +
"@App:description(\"fasd\") " +
"@App:statistics(reporter = \"jmx\", interval = \"30\") " +
"@source(type=\"http\",receiver.url=\"http://localhost:9056/endpoints/\",@map(type=\"text\",fail.on.missing.attribute=\"true\",regex.A=\"(.*)\",@attributes(data=\"A\"))) " +
"@sink(type=\"mqtt\",url=\"tcp://120.78.71.179:1883\",topic=\"34\",@map(type=\"text\")) " +
"define stream a4P068X5YCK(data String);";
SiddhiManager siddhiManager = new SiddhiManager();
SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiString);
siddhiAppRuntime.addCallback("a4P068X5YCK", new StreamCallback() {
@Override
public void receive(Event[] events) {
EventPrinter.print(events);
}
});
siddhiAppRuntime.start();
}
}
然后我向 http://localhost:9056/endpoints/ 发送一个 POST 请求.它返回上面发布的异常。
更新:我回去查看 Siddhi-io-http github documentation page .我发现它说:
... This extension only works inside the WSO2 Data Analytic Server and cannot be run with standalone siddhi.
我想这可能表明 siddhi 库目前不支持 http。我已在 siddhi 存储库页面上提交问题以请求确认。
更新 2:我已经更改了我的 Siddhi 查询,以便它将源流复制到另一个接收器流中。代码的其他部分保持不变:
String siddhiString = "@App:name(\"haha\") " +
"@App:description(\"fasd\") " +
"@App:statistics(reporter = \"jmx\", interval = \"30\") " +
"@source(type=\"http\",receiver.url=\"http://localhost:9056/endpoints/\",@map(type=\"text\",fail.on.missing.attribute=\"true\",regex.A=\"(.*)\",@attributes(data=\"A\"))) " +
"define stream a4P068X5YCK(data String); " +
"@sink(type=\"mqtt\",url=\"tcp://120.78.71.179:1883\",topic=\"34\",@map(type=\"text\")) " +
"define stream pout(data String); " +
"from a4P068X5YCK " +
"select * " +
"insert into pout; " +
"";
同样的问题依然存在。我试过 wso2 处理器,它工作正常。现在我的猜测是:
1.版本不匹配
2. wso2 处理器依赖项中缺少一些包。
我会尝试在这两个方向上识别它,并会在发现新内容后立即在此处和问题页面进行更新。
更新 3:随着我不断添加更新,格式似乎有一些问题,但幸运的是这个问题也告一段落。我试图包含来自 wso2 处理器源代码的所有依赖项,我的测试程序开始工作。因此我假设 wso2 处理器中有一个组件缺少 siddhi 库。
我试着一个一个删除依赖,看看我的测试程序是否还能正常运行。最后我找到了那个包裹。有了这个包,我的代码运行良好。
<dependency>
<groupId>org.wso2.msf4j</groupId>
<artifactId>org.wso2.msf4j.feature</artifactId>
<version>${msf4j.version}</version>
<type>zip</type>
</dependency>
由于我是编码初学者,所以我不太清楚问题出在哪里。如果有人能向我解释问题背后的原因,我将不胜感激。我感谢在此过程中收到的所有帮助,这对我来说也是一次很棒的经历。
更新 4: @Grainier 我尝试了您发布的示例代码,它确实有效!虽然我仍然不知道为什么。我试图将您的确切代码复制到我项目中的新 .java。还是不行。因此我想这与 POM 文件有关。
我注意到,当我运行您的示例代码时,控制台中打印了一些警告:小更新:我发现警告出现是因为我使用的是 JDK 10。一旦我切换回1.8 警告消失了,代码仍然有效。所以也许这不是原因。
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/C:/Users/ktz001/.m2/repository/io/netty/netty-common/4.1.16.Final/netty-common-4.1.16.Final.jar) to constructor java.nio.DirectByteBuffer(long,int)
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
第二个区别在于 POM 文件。与我相比,你多了一个仓库。
<repository>
<id>wso2-nexus</id>
<name>WSO2 internal Repository</name>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
</repository>
如果您能提出任何理由,那就太好了。谢谢你所做的一切!这真的很有帮助。
最佳答案
文档似乎有问题...这应该适用于独立的 Siddhi。您所要做的就是在您的项目中添加以下依赖项(还有 mqtt,我没有在下面包含);
<dependencies>
<dependency>
<groupId>org.wso2.siddhi</groupId>
<artifactId>siddhi-core</artifactId>
<version>${siddhi.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.siddhi</groupId>
<artifactId>siddhi-annotations</artifactId>
<version>${siddhi.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.siddhi</groupId>
<artifactId>siddhi-query-compiler</artifactId>
<version>${siddhi.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.extension.siddhi.io.http</groupId>
<artifactId>siddhi-io-http</artifactId>
<version>${siddhi.io.http.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.extension.siddhi.map.text</groupId>
<artifactId>siddhi-map-text</artifactId>
<version>${siddhi.mapper.text.version}</version>
</dependency>
</dependencies>
但是,您的查询存在问题,即您已将 @source
和 @sink
定义为单个流。这是错误的。如果你想让它成为直通,那么你必须定义两个流(一个用于源,一个用于接收器)并编写一个查询以将事件从源流插入到接收器流。
更新:
可以找到样本here ;请尝试一下,看看它是否有效。
关于java - Siddhi HTTP NoSuchMethodError 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50018296/
我正在用来自JSON文件的一些数据填充Flutter中的列表。 但是,我的代码不断抛出异常"NoSuchMethodError (NoSuchMethodError: The method 'add'
通过eclipse运行Tomcat 7报错是: javax.servlet.ServletException: java.lang.NoSuchMethodError: org.eclipse.jdt
这是我的错误行: 这是我的代码: 最佳答案 final jobs= json.decode(response.body)['name_database_table']; 关于mobile - NoSu
很难说出这里问的是什么。这个问题是模棱两可的、模糊的、不完整的、过于宽泛的或修辞的,无法以目前的形式得到合理的回答。为了帮助澄清这个问题以便可以重新打开它,visit the help center
我已经被这个错误困扰了几个小时。。我的pom.xml。应用程序未启动。所有的Spring框架依赖于相同的版本,但仍然得到相同的错误。。更新。MVN依赖的结果:树。看起来这里一切都很好。
我得到: NoSuchMethodError: com.foo.SomeService.doSmth()Z 我是否正确理解这个'Z'意味着doSmth()方法的返回类型是 boolean 值?如果为
我在 Speed 类中引用 PlayerUtil.getMovementSpeed(player);,在我的 PlayerUtil 类中,我将方法定义为: public static double g
我得到: NoSuchMethodError: com.foo.SomeService.doSmth()Z 我是否正确理解这个 'Z' 意味着 doSmth() 方法的返回类型是 boolean 值?
我在使用 Spark 和 Scala 时遇到了一个奇怪的错误。我有一段代码声明了一个变量: var offset = 0 这会导致以下异常: java.lang.NoSuchMethodError:
我已经成功实现了 reflectionEquals 方法,其中包含一个排除字段列表。 return EqualsBuilder.reflectionEquals(this, obj, new Str
我正在使用 Spring 框架和 Maven 开发 Java Enterprise 应用程序。我正在为此学习一门类(class),并且一直坚持集成 Hibernate JPA。当我运行项目时,它返回以
I/flutter ( 8282): The following NoSuchMethodError was thrown building Meme(dirty, state: _MemeState
运行以下代码时出现 NoSuchMethodError - 我想从 JSON url 打印出轨道标题 - 我错过了什么吗? import 'dart:async'; import 'dart:conv
我正在做 Searchview flutter 中的例子 https://github.com/MageshPandian20/Flutter-SearchView 但我想对 进行更改子项类有一个 最
尝试从Eclipse中的简单Java程序连接到Hive时出现以下错误。看起来好像连接,然后引发此错误。我可以通过beeline在本地连接到Hive Thrift服务器,而不会出现问题。 两个libth
当我向安全资源发出请求时,会发生NoSuchMethodError。 基于基于Spring Boot 1.4.4的Grails 3.2.5的项目 AppConfig: @EnableWebSecuri
这个问题已经有答案了: Differences between Exception and Error (11 个回答) 已关闭 7 年前。 我的印象是 Exception 非常适合捕获所有可能的异常
祝大家有美好的一天!我使用 google Vision API,当我在 IntelliJ Idea 中运行我的程序时,它工作得很好,但是当我编译 jar 文件时,它在处理照片时给出错误 java.la
我一直在为这个问题苦苦挣扎。我正在开发一个包含很多包的 netbeans java 项目,起初我更改了 gui,但是当我运行代码时,它没有反射(reflect)任何更改,即使我在保存、清理、清理和编译
我一直在寻找问题的解决方案,但没有得到足够的答案。 我正在开发 Bukkit插件的更新系统。因此,我必须自己编写这些类的代码。但我一直想从 debug(String) 调用一个方法(具体来说: ano
我是一名优秀的程序员,十分优秀!