仅在导入“org.apache.log4j.Logger;”时弹出错误是“导入无法解析” ....这是 Main.java 和其他 java 类有同样的错误......任何人都可以修复或帮助?这是发送短信
package com.dbs.epodsms;
import com.dbs.epodsms.business.logic.ConfigureModem;
import com.dbs.epodsms.business.logic.SmsProcessor;
import com.dbs.epodsms.business.object.Log;
import com.dbs.epodsms.business.object.Outgoing;
import com.dbs.epodsms.misc.Network;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
public class Main
{
private static Logger logger = Logger.getLogger(Main.class);
public static void main(String[] args)
{
logger.info("Application started.");
List<Outgoing> outgoingList = new ArrayList<Outgoing>();
SmsProcessor smsProcessor = new SmsProcessor();
try
{
ConfigureModem cfgModem = ConfigureModem.getInstance();
if (!cfgModem.configure())
{
logger.error(cfgModem.getMessage());
logger.error("An error occured while configuring your modem. Please check that your modem is properly installed and that the hw is not defective.");
logger.info("The application will now exit.");
System.exit(0);
}
List<Outgoing> oldOutgoingList = smsProcessor.getOutgoingList(Network.GLOBE);
if (oldOutgoingList.size() > 0)
{
outgoingList.addAll(oldOutgoingList);
}
outgoingList.addAll(smsProcessor.getNewSMS(cfgModem.getGateway()));
logger.info("Processing a total of " + outgoingList.size() + " sms...");
for (Outgoing o : outgoingList)
{
if (o.getRetries() > 3)
{
smsProcessor.sendEmail(o);
}
else if (smsProcessor.sendSMS(o))
{
logger.info("SMS was sent successfully.");
Log log = new Log();
log.setRemarks("REPLY SENT");
log.setSenderNumber(o.getRecipient());
log.setSms(o.getMessage());
smsProcessor.saveToLog(log);
smsProcessor.deleteOutging(o.getId());
}
else
{
logger.error("Error sending message to " + o.getRecipient());
o.setRetries(o.getRetries() + 1);
smsProcessor.addOrUpdateOutgoing(o);
}
}
logger.info("Stopping service...");
cfgModem.stopService();
smsProcessor.closeDBConnection();
System.exit(0);
}
catch (Exception e)
{
logger.error(e.toString());
}
}
}