Я не могу создать библиотеку SipProvider- MjSip
Я новичок в MjSip и хочу создать экземпляр класса SipProvider. поэтому я испортил этот маленький код, но получил ошибку:
sip_provider = new SipProvider("192.168.0.254",5060);
и вот стек ошибок:
java.io.FileNotFoundException: log\192.168.0.254.5060_events.log (The system cannot find the path specified)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at org.zoolu.tools.Log.<init>(Log.java:112)
at org.zoolu.tools.RotatingLog.<init>(RotatingLog.java:73)
at org.zoolu.sip.provider.SipProvider.initLog(SipProvider.java:295)
at org.zoolu.sip.provider.SipProvider.<init>(SipProvider.java:224)
at local.ua.UA.main(UA.java:539)
java.io.FileNotFoundException: log\192.168.0.254.5060_messages.log (The system cannot find the path specified)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at org.zoolu.tools.Log.<init>(Log.java:112)
at org.zoolu.tools.RotatingLog.<init>(RotatingLog.java:73)
at org.zoolu.sip.provider.SipProvider.initLog(SipProvider.java:296)
at org.zoolu.sip.provider.SipProvider.<init>(SipProvider.java:224)
at local.ua.UA.main(UA.java:539)
Exception in thread "main" java.lang.NullPointerException
at org.zoolu.tools.Log.flush(Log.java:147)
at org.zoolu.tools.Log.println(Log.java:177)
at org.zoolu.sip.provider.SipProvider.printLog(SipProvider.java:1161)
at org.zoolu.sip.provider.SipProvider.initLog(SipProvider.java:298)
at org.zoolu.sip.provider.SipProvider.<init>(SipProvider.java:224)
at local.ua.UA.main(UA.java:539)
Я использую локальную сеть, и IP-адрес действителен. почему это случилось?? Помогите мне, пожалуйста!!!
1 ответ
Нет папки журнала. Вам нужно создать папку. Или вы должны дать конкретный каталог.
String home = System.getProperty("user.home");
File f = new File(home +"//"+SipStack.log_path);
try {
if (!f.exists() || !f.isDirectory())
{
JOptionPane.showMessageDialog(null,home +"//"+SipStack.log_path + " dosyası oluşturulacak");
File dir = new File(home +"//"+SipStack.log_path);
dir.mkdir();
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null,"Log klasörü oluşturulamadı");
}
} catch (Exception ex) {
}
if (SipStack.debug_level>0)
{
String home = System.getProperty("user.home");
String filename=home+"//"+SipStack.log_path+"//"+via_addr+"."+host_port;
log=new RotatingLog(filename+"_events.log",SipStack.debug_level,SipStack.max_logsize*1024,SipStack.log_rotations,SipStack.rotation_scale,SipStack.rotation_time);
message_log=new RotatingLog(filename+"_messages.log",SipStack.debug_level,SipStack.max_logsize*1024,SipStack.log_rotations,SipStack.rotation_scale,SipStack.rotation_time);
}