NoSuchPortException in smslib

385 views Asked by At

Here is my code part for sending SMS,

 public void sendMessage() throws Exception {
        SerialModemGateway gateway = new SerialModemGateway("modem.com1", "COM7", 9600, "STC", "");
        gateway.setInbound(true);
        gateway.setOutbound(true);
        //gateway.setSimPin("0000");
        //gateway.setSmscNumber("+9477000003");

        OutboundNotification outboundNotification = new OutboundNotification();
        InboundNotification inboundNotification = new InboundNotification();

        Service service = Service.getInstance();
        service.setOutboundMessageNotification(outboundNotification);
        service.setInboundMessageNotification(inboundNotification);
        service.addGateway(gateway);
        service.startService();

But this gave me following log output.

`2016-12-18 21:52:55 INFO  smslib:114 - Version: 3.5.4
2016-12-18 21:52:55 INFO  smslib:115 - JRE Version: 1.8.0_51
2016-12-18 21:52:55 INFO  smslib:116 - JRE Impl Version: 25.51-b03
2016-12-18 21:52:55 INFO  smslib:117 - O/S: Windows 8.1 / amd64 / 6.3
2016-12-18 21:52:55 INFO  smslib:92 - Queue directory not defined. Queued messages will not be saved to filesystem.
2016-12-18 21:52:55 INFO  smslib:188 - GTW: modem.com1: Starting gateway, using Generic AT Handler.
2016-12-18 21:52:55 INFO  smslib:68 - GTW: modem.com1: Opening: COM7 @9600
2016-12-18 21:52:55 INFO  smslib:120 - GTW: modem.com1: Closing: COM7 @9600
2016-12-18 21:52:56 INFO  smslib:200 - GTW: modem.com1: Stopping gateway...
2016-12-18 21:52:56 INFO  smslib:120 - GTW: modem.com1: Closing: COM7 @9600
2016-12-18 21:52:56 INFO  smslib:204 - GTW: modem.com1: Gateway stopped.
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)`

In Device Manager,

In Device Manager

In modem properties,

In modem properties

In port properties,

In port properties

For both above ports (COM7, COM8), I got above exception in my logs.

0

There are 0 answers