使用SMSLib运行java应用程序时NoSuchPortException [英] NoSuchPortException when running java application using SMSLib

查看:948
本文介绍了使用SMSLib运行java应用程序时NoSuchPortException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的java应用程序中使用 SMSLib 发送一个短信,我将USB互联网调制解调器连接到我的电脑,然后确定它是端口号(即COMx),然后创建一个串行调制解调器网关,如下所示:



确定端口号



创建网关:

  SerialModemGateway gateway = new SerialModemGateway(mobile,COM5,115200, 苹果,iPhone); 

但无论我将端口定义为COM4还是COM5,它首先运行连接,然后给我以下例外情况就是以通常的方式停止服务:

  0 2013-06-19 15:36:49,915 [main] INFO org.smslib.Service  -  SMSLib:用于通过GSM调制解调器或其他支持的网关发送和接收短信的Java API库。 
该软件根据Apache v2.0许可证的条款分发。
网站:http://smslib.org
10 2013-06-19 15:36:49,925 [main] INFO org.smslib.Service - 版本:3.5.3
10 2013 -06-19 15:36:49,925 [main] INFO org.smslib.Service - JRE版本:1.7.0_21

经过很多运行和大量执行:

  org.smslib.GatewayException:通讯库异常:java .lang.RuntimeException:org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java:102)上的javax.comm.NoSuchPortException 
$ org.mslib.modem.AModemDriver.connect中的
(AModemDriver.java: 114)
在org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
在org.smslib.Service $ 1Starter.run(Service.java:277)
1463 2013 -06-19 15:36:51,378 [NotifyQueueManager] DEBUG org.smslib.threading.AServiceThread - 正在运行...
1463 2013-06-19 15:36:51,378 [NotifyQueueManager] DEBUG org.smslib.notify。 NotifyQueueManager $ NotificationQueueManager - NotifyQueueManager运行...
1463 2013-06-19 15:36:51,378 [NotifyQueueManager] DEBUG org.smslib.threading.AServiceThread - 已停止。

值得一提的是,在执行期间和抛出异常之前,它给我的错误: / p>

 加载win32com时出错:java.lang.UnsatisfiedLinkError:否java.library.path中的win32com 

尽管我已经将RxTx(64位)jar文件添加到jdk中,并且应该避免由 SMSLib文档

解决方案

获取调制解调器端口格式,控制面板>电话和调制解调器>调制解调器
现在您可以找到附加到COM端口
尝试使用




I'm using SMSLib in my java application to send an SMS, i connect a USB internet modem to my PC then determine it's port number (ie. COMx) then creating a serial modem gateway like this :

determining the port number :

creating the gateway:

SerialModemGateway gateway = new SerialModemGateway("mobile", "COM5", 115200, "Apple", "iPhone");

but whether i define the port as COM4 or as COM5 it runs the connection at first then gives me that following exception then stops the service by the usual way:

0      2013-06-19 15:36:49,915 [main] INFO  org.smslib.Service  - SMSLib: A Java API library for sending and receiving SMS via a GSM modem or other supported gateways.
This software is distributed under the terms of the Apache v2.0 License.
Web Site: http://smslib.org
10     2013-06-19 15:36:49,925 [main] INFO  org.smslib.Service  - Version: 3.5.3
10     2013-06-19 15:36:49,925 [main] INFO  org.smslib.Service  - JRE Version: 1.7.0_21

after a lot of running and a lot of executions:

org.smslib.GatewayException: Comm library exception: java.lang.RuntimeException: javax.comm.NoSuchPortException
    at org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java:102)
    at org.smslib.modem.AModemDriver.connect(AModemDriver.java:114)
    at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
    at org.smslib.Service$1Starter.run(Service.java:277)
1463   2013-06-19 15:36:51,378 [NotifyQueueManager] DEBUG org.smslib.threading.AServiceThread  - Running...
1463   2013-06-19 15:36:51,378 [NotifyQueueManager] DEBUG org.smslib.notify.NotifyQueueManager$NotificationQueueManager  - NotifyQueueManager running...
1463   2013-06-19 15:36:51,378 [NotifyQueueManager] DEBUG org.smslib.threading.AServiceThread  - Stopped.

worth to mention that during the execution and before throwing the exception by while it gives me that error:

Error loading win32com: java.lang.UnsatisfiedLinkError: no win32com in java.library.path

despite i'm already adding the RxTx(64-bit) jar file to the jdk and that supposed to avoid that error as mentioned by the SMSLib documentation.

解决方案

get the modem port form , control panel > Phone and Modem > Modems now you can find the "attached To" COM port try with that

这篇关于使用SMSLib运行java应用程序时NoSuchPortException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆