I am trying to create web application to send sms by gsm modem in Spring 
first I put destination mobile number and sms text in url and get by 
request.getparameter and first message sent with no problem but when send a 
message again by referenshing the same page i get this exception

org.smslib.GatewayException: Comm library exception: 
java.lang.RuntimeException: gnu.io.PortInUseException: org.smslib
    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:276)

my code is:



public class SendMessage {

    public  void doIt(String mobileNumber,String message) throws Exception
    {
        OutboundNotification outboundNotification = new 
OutboundNotification();        
        SerialModemGateway gateway = new SerialModemGateway("modem.com1", 
"COM11", 115200, "Huawei", "E1550");
        gateway.setInbound(false);
        gateway.setOutbound(true);
        gateway.setSimPin("0000");
       
        gateway.setSmscNumber("+919032055002");
        
Service.getInstance().setOutboundMessageNotification(outboundNotification);
        Service.getInstance().addGateway(gateway);
        Service.getInstance().startService();        
        // Send a message synchronously.
        OutboundMessage msg = new OutboundMessage(mobileNumber, 
message);        
        Service.getInstance().sendMessage(msg);        
        System.out.println(msg);
        Service.getInstance().stopService();
        
    }

    public  class OutboundNotification implements 
IOutboundMessageNotification
    {
        public void process(AGateway gateway, OutboundMessage msg)
        {
            System.out.println("Outbound handler called from Gateway: " + 
gateway.getGatewayId());
            System.out.println(msg);
        }
    }

    
}


Any Body please help me out this problem 


-- 
You received this message because you are subscribed to the Google Groups 
"SMSLib Discussion Group" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/smslib/94097bc5-e4ef-4ddc-8b76-4d2b5ef80ffd%40googlegroups.com.

Reply via email to