日期:2014-05-20  浏览次数:20640 次

短信猫发不出消息 高手请进
62853 [main] WARN org.smslib - GTW: modem.com1: CMS Error 28: Retrying...
69556 [main] WARN org.smslib - GTW: modem.com1: CMS Error 28: Retrying...
76212 [main] ERROR org.smslib - GTW: modem.com1: CMS Error 28: Quit retrying, m
essage lost...
13564336335 == 0891683180461 
[main] WARN org.smslib - GTW: modem.com1: CMS Error 28: Retrying...
87304 [main] WARN org.smslib - GTW: modem.com1: CMS Error 28: Retrying...
94632 [main] ERROR org.smslib - GTW: modem.com1: CMS Error 28: Quit retrying, m
essage lost...
13564336335 == 0891683180462 

刚开始的时候能发出消息 运行几天后就发不出了 报上面的错 重启程序也没用 应该不是线程阻塞的问题 
我用一个主方法调的 没有多线程  
没重启计算机 这个问题很烦恼 请知道的兄弟解答一下 跪谢

------解决方案--------------------
贴段几年前写的程序片段
public class MessageHandler extends WorkThread{
private static Logger logger = Logger.getLogger(MessageHandler.class);
private Service srv;

public void beforeWork(){
try{
srv = new Service();
ModemGateway gateway = new ModemGateway("modem.com1", "COM1", 9600, "Siemens", "TC35", srv.getLogger());
gateway.setInbound(true);
gateway.setOutbound(true);
gateway.setSimPin("0000");
srv.addGateway(gateway);

srv.startService();
logger.info("Modem Information:");
logger.info(" Manufacturer: " + gateway.getManufacturer());
logger.info(" Model: " + gateway.getModel());
logger.info(" Serial No: " + gateway.getSerialNo());
logger.info(" SIM IMSI: " + gateway.getImsi());
logger.info(" Signal Level: " + gateway.getSignalLevel() + "%");
logger.info(" Battery Level: " + gateway.getBatteryLevel() + "%");
}catch(Exception e){
logger.error("连接短信猫出现异常 : "+e.getMessage());
e.printStackTrace();
}
}



public void work(){
try{ Thread.sleep(2000); }catch(InterruptedException ex){}
try{
LinkedList<InboundMessage> msgList = new LinkedList<InboundMessage>();
srv.readMessages(msgList, InboundMessage.MessageClass.ALL);
for(InboundMessage message: msgList){
try{
Readsms readsms = new Readsms();
readsms.setReadid(Readid.getReadid());
readsms.setText(message.getText());
readsms.setOriginator(message.getOriginator());
readsms.setRecipient(message.getRecipient());
readsms.setDate(message.getDate());
SqlMap.getSqlMapInstance().insert("insertReadsms",readsms);
srv.deleteMessage(message);
}catch(Exception e){
logger.error("insertReadsms Exception : "+e.toString());
continue;
}
}

@SuppressWarnings("unchecked")
List<Sendsms> messageList = SqlMap.getSqlMapInstance().queryForList("getSendsms");
for(Sendsms sendsms: messageList){
OutboundMessage msg = new OutboundMessage(sendsms.getTarget(), sendsms.getText());
msg.setEncoding(MessageEncoding.ENCUCS2);
try{
srv.sendMessage(msg);
sendsms.setStatus(Constant.STATUS_SUCCESS);
}catch(Exception e){
sendsms.setStatus(Constant.STATUS_FAIL);
logger.error("send message Exception : "+e.toString());
}
try{
SqlMap.getSqlMapInstance().update("updateSendsms",sendsms);
logger.info("send : "+msg.getText() + " target : " + msg.getRecipient());
}catch(Exception e){
logger.error("updateSendsms Exception : "+e.toString());
continue;