首页 > 解决方案 > 使用 IntelliJ IDEA 插件在 Siddhi SDK 中启动 HL7 服务时端口绑定错误

问题描述

我尝试使用 IntelliJ 插件开发 Siddhi 扩展。当我尝试在任何端口上配置“hl7”源时,HL7Service 似乎启动了两次。这不起作用,因为网络端口只能打开一次。

我检查了没有其他 Siddhi 实例正在运行,并尝试了许多不同的端口。

@App:name('HL7SiddhiApp')
@App:description('Description of the plan')
@source(type = 'hl7', port = "7777", hl7.encoding = "er7", @map(type = 'text'))
define stream hl7stream (message string);

@sink(type = 'log', @map(type = 'passThrough'))
define stream outStream (message string);

from hl7stream
select message
insert into outStream;
[ca.uhn.hl7v2.util.Home] : hapi.home is set to C:\Workspace\IdeaProjects\HelloSiddhi\HL7Siddhi\.
[ca.uhn.hl7v2.VersionLogger] : HAPI version is: 2.2
[ca.uhn.hl7v2.VersionLogger] : Default Structure libraries found for HL7 versions 2.2, 2.3, 2.4, 2.5, 2.5.1, 
[ca.uhn.hl7v2.conf.store.FileProfileStore] : Profile store directory doesn't exist: C:\Workspace\IdeaProjects\HelloSiddhi\HL7Siddhi\./profiles
[ca.uhn.hl7v2.concurrent.Service] : Starting service HL7 Server
[ca.uhn.hl7v2.app.HL7Service] : Starting ConnectionCleaner service
[ca.uhn.hl7v2.concurrent.Service] : Starting service ConnectionCleaner
[ca.uhn.hl7v2.app.SimpleServer] : Starting SimpleServer running on port 7777
[ca.uhn.hl7v2.concurrent.Service] : Thread ConnectionCleaner entering main loop
[ca.uhn.hl7v2.concurrent.Service] : Starting service Socket Acceptor
[ca.uhn.hl7v2.concurrent.Service] : Thread HL7 Server entering main loop
[ca.uhn.hl7v2.concurrent.Service] : Thread Socket Acceptor entering main loop
[ca.uhn.hl7v2.concurrent.Service] : Prepare to stop thread HL7 Server
INFO  [org.wso2.siddhi.sdk.launcher.LauncherUtils] - Event Input file is not provided or file is empty
[ca.uhn.hl7v2.concurrent.Service] : Starting service HL7 Server
[ca.uhn.hl7v2.app.HL7Service] : Starting ConnectionCleaner service
[ca.uhn.hl7v2.concurrent.Service] : Starting service ConnectionCleaner
[ca.uhn.hl7v2.app.SimpleServer] : Starting SimpleServer running on port 7777
[ca.uhn.hl7v2.concurrent.Service] : Starting service Socket Acceptor
[ca.uhn.hl7v2.concurrent.Service] : Thread HL7 Server entering main loop
[ca.uhn.hl7v2.concurrent.Service] : Thread ConnectionCleaner entering main loop
[ca.uhn.hl7v2.concurrent.Service] : Thread exiting main loop due to exception:
java.lang.RuntimeException: java.net.BindException: Address already in use: JVM_Bind
    at ca.uhn.hl7v2.app.AcceptorThread.afterStartup(AcceptorThread.java:106)
    at ca.uhn.hl7v2.concurrent.Service.run(Service.java:202)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

标签: javaintellij-ideasdksiddhi

解决方案


您可以尝试以下命令来检查本地计算机上正在使用哪些端口以及哪些进程正在使用它。尝试输出中不存在的端口。

sudo netstat -tulpn
  • t:tcp
  • 你:udp
  • l:监听端口
  • p:进程 n:网络

推荐阅读