• 手机版

    扫码体验手机版

  • 微信公众号

    扫码关注公众号

国内首家协议开发

软芯音视解码保护平台

在线
客服

发布
需求

在线
聊天

天盟
APP

天盟APP下载

关注
微信

微信扫一扫访问
顶部

短信猫发送出现CommPortIdentifier class not found错误

Caused by: java.lang.RuntimeException: CommPortIdentifier class not found
at org.smslib.helper.CommPortIdentifier.(CommPortIdentifier.java:76)
... 4 more
但是这个类org.smslib.helper.CommPortIdentifier我是能找到的
private static String COM; //短信端口    private static Service srv;    private static OutboundMessage msg;    static OutboundNotification outboundNotification; // = new OutboundNotification();    static SerialModemGateway gateway;    public static int Send(String PhoneNumber, String Content) {        int successnumber = 0;        try {                         msg = new OutboundMessage(PhoneNumber, Content);          //  msg.setEncoding(MessageEncodings.ENCUCS2); // 中文            srv.sendMessage(msg);            //判断发送状态            if (msg.getMessageStatus().toString().trim().equals("SENT") || msg.getMessageStatus().toString().trim().equals("send")) {               ++ successnumber;            } else {                System.out.println("SendMessage-->第" + (successnumber + 1) + "条短信发送短信失败!");            }            System.out.println("SendMessage-->发送短信结束,成功条数:" + successnumber + "条,短信内容:" + Content);            //返回成功数量            return successnumber;        } catch (Exception e) {            e.printStackTrace();            System.out.println("SendMessage-->发送异常!!");            return 0;        }    }    public static void Close() {        try {            srv.stopService();            srv.removeGateway(gateway);            System.out.println("SendMessage-->关闭短信接口成功!");        } catch (GatewayException e) {            e.printStackTrace();            System.out.println("SendMessage-->关闭端口出错!");        } catch (SMSLibException e) {            e.printStackTrace();            System.out.println("SendMessage-->关闭SMSLib错误!");        } catch (IOException e) {            e.printStackTrace();        } catch (InterruptedException e) {            e.printStackTrace();        }    }    public class OutboundNotification implements IOutboundMessageNotification {        public void process(AGateway agateway, OutboundMessage outboundmessage) {            System.out.println("SendMessage-->Outbound handler called from Gateway: " + agateway);            System.out.println("SendMessage-->" + outboundmessage);        }    }    static {        COM = "COM3";        srv = Service.getInstance();        gateway = new SerialModemGateway("modem." + COM.toLowerCase(), COM, 9600, "wavecom", ""); // 设置端口与波特率        gateway.setInbound(true);        gateway.setOutbound(true);        gateway.setSimPin("1234");        //gateway.setOutboundNotification(outboundNotification);        srv.setOutboundMessageNotification(outboundNotification); //发送短信成功后的回调函方法        try {            srv.addGateway(gateway);                     srv.startService();            System.out.println("SendMessage-->服务启动成功");        } catch (TimeoutException e) {            e.printStackTrace();        } catch (GatewayException e) {            e.printStackTrace();        } catch (SMSLibException e) {            e.printStackTrace();        } catch (IOException e) {            e.printStackTrace();        } catch (InterruptedException e) {            e.printStackTrace();        }    }附上相关代码,不知道哪里设置错了

免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。

版权声明:作者保留权利,不代表天盟立场。

使用道具 举报

全部参与1

兄弟处理了吗问题,我也碰到这问题了。。。是不是因为jar包的版本问题?

使用道具 举报

发新帖

发布任务需求已有1031167位用户正在使用天盟网服务

发布分类: *
任务预算: *
需求内容: *
手机号码: *
任务商家报价为
  • 预算价 :
  • 成交价 :
  • 完工期 :
  • 质保期 :

* 最终任务项目以服务商报价、双方协商为准!