java - Getting error javax.sip.PeerUnavailableException: The Peer SIP Stack: gov.nist.javax.sip.SipStackImpl could not be instantiated -


i getting error following code.

i have included jars necessary sip; but, still not getting why error occurring. can explain me?

my code class is:

import java.net.inetaddress;  import java.util.arraylist;  import java.util.properties;  import java.util.random;   import javax.sip.dialogterminatedevent; import javax.sip.ioexceptionevent; import javax.sip.listeningpoint; import javax.sip.requestevent; import javax.sip.responseevent; import javax.sip.sipfactory; import javax.sip.siplistener; import javax.sip.sipprovider; import javax.sip.sipstack; import javax.sip.timeoutevent; import javax.sip.transactionterminatedevent; import javax.sip.address.address; import javax.sip.address.addressfactory; import javax.sip.header.cseqheader; import javax.sip.header.callidheader; import javax.sip.header.contactheader; import javax.sip.header.fromheader; import javax.sip.header.headerfactory; import javax.sip.header.maxforwardsheader; import javax.sip.header.toheader; import javax.sip.header.viaheader; import javax.sip.message.messagefactory; import javax.sip.message.request; import javax.swing.jframe;  public class sipclient extends jframe implements siplistener { sipfactory sipfactory;          // used access sip api. sipstack sipstack;              // sip stack. sipprovider sipprovider;        // used send sip messages. messagefactory messagefactory;  // used create sip message factory. headerfactory headerfactory;    // used create sip headers. addressfactory addressfactory;  // used create sip uris. listeningpoint listeningpoint;  // sip listening ip address/port. properties properties;          // other properties.  string ip;                      // local ip address. int port = 6060;                // local port. string protocol = "udp";        // local protocol (udp). int tag = (new random()).nextint(); // local tag. address contactaddress;         // contact address. contactheader contactheader;    // contact header. public sipclient()  {     initcomponents(); }  /**  * method called within constructor initialize     form.  * warning: not modify code. content of method  * regenerated form editor.  */  // <editor-fold defaultstate="collapsed" desc="generated code">//gen-  begin:initcomponents private void initcomponents() {      scrollpane = new javax.swing.jscrollpane();     textarea = new javax.swing.jtextarea();     buttonregisterstateless = new javax.swing.jbutton();     buttonregisterstatefull = new javax.swing.jbutton();     buttoninvite = new javax.swing.jbutton();     buttonbye = new javax.swing.jbutton();     textfield = new javax.swing.jtextfield(); this.setdefaultcloseoperation(javax.swing.windowconstants.exit_on_close);     settitle("sip client");     setlocationbyplatform(true);     addwindowlistener(new java.awt.event.windowadapter() {         public void windowopened(java.awt.event.windowevent evt) {             onopen(evt);         }     });      textarea.seteditable(false);     textarea.setcolumns(20);     textarea.setrows(5);     scrollpane.setviewportview(textarea);      buttonregisterstateless.settext("reg (sl)");     buttonregisterstateless.setenabled(true);     buttonregisterstateless.addactionlistener(new java.awt.event.actionlistener() {         public void actionperformed(java.awt.event.actionevent evt) {             onregisterstateless(evt);         }     });      buttonregisterstatefull.settext("reg (sf)");     buttonregisterstatefull.setenabled(true);     buttonregisterstatefull.addactionlistener(new java.awt.event.actionlistener() {         public void actionperformed(java.awt.event.actionevent evt) {             onregisterstatefull(evt);         }     });      buttoninvite.settext("invite");     buttoninvite.setenabled(true);     buttoninvite.addactionlistener(new java.awt.event.actionlistener() {         public void actionperformed(java.awt.event.actionevent evt) {             oninvite(evt);         }     });      buttonbye.settext("bye");     buttonbye.setenabled(true);     buttonbye.addactionlistener(new java.awt.event.actionlistener() {         public void actionperformed(java.awt.event.actionevent evt) {             onbye(evt);         }     });      textfield.settext("");      javax.swing.grouplayout layout = new javax.swing.grouplayout(getcontentpane());     getcontentpane().setlayout(layout);     layout.sethorizontalgroup(          layout.createparallelgroup(javax.swing.grouplayout.alignment.leading).addgroup(layout.createsequentialgroup().addcontainergap().addgroup(layout.createparallelgroup(javax.swing.grouplayout.alignment.leadin       g)                 .addcomponent(scrollpane)                 .addgroup(layout.createsequentialgroup()                     .addcomponent(buttonregisterstateless, javax.swing.grouplayout.preferred_size, 90, javax.swing.grouplayout.preferred_size)                     .addpreferredgap(javax.swing.layoutstyle.componentplacement.related)                     .addcomponent(buttonregisterstatefull, javax.swing.grouplayout.preferred_size, 90, javax.swing.grouplayout.preferred_size)                     .addpreferredgap(javax.swing.layoutstyle.componentplacement.related)                     .addcomponent(buttoninvite, javax.swing.grouplayout.preferred_size, 90, javax.swing.grouplayout.preferred_size)                     .addpreferredgap(javax.swing.layoutstyle.componentplacement.related)                     .addcomponent(buttonbye, javax.swing.grouplayout.preferred_size, 90, javax.swing.grouplayout.preferred_size)                     .addgap(0, 2, short.max_value))                 .addcomponent(textfield))             .addcontainergap())     );     layout.setverticalgroup(         layout.createparallelgroup(javax.swing.grouplayout.alignment.leading)         .addgroup(javax.swing.grouplayout.alignment.trailing, layout.createsequentialgroup()             .addcontainergap()             .addcomponent(textfield, javax.swing.grouplayout.preferred_size, javax.swing.grouplayout.default_size, javax.swing.grouplayout.preferred_size)             .addpreferredgap(javax.swing.layoutstyle.componentplacement.related)             .addcomponent(scrollpane, javax.swing.grouplayout.default_size, 230, short.max_value)             .addpreferredgap(javax.swing.layoutstyle.componentplacement.related)             .addgroup(layout.createparallelgroup(javax.swing.grouplayout.alignment.baseline)                 .addcomponent(buttonregisterstateless)                 .addcomponent(buttoninvite)                 .addcomponent(buttonbye)                 .addcomponent(buttonregisterstatefull))             .addcontainergap())     );      pack(); }// </editor-fold>//gen-end:initcomponents  private void onopen(java.awt.event.windowevent evt) {//gen-first:event_onopen     try     {         this.ip=inetaddress.getlocalhost().gethostaddress();         system.out.println(ip);         this.sipfactory=sipfactory.getinstance();         this.sipfactory.setpathname("gov.nist");         this.properties=new properties();         this.properties.setproperty("javax.sip.stack_name", "mystack");         // create sip stack.         this.sipstack = this.sipfactory.createsipstack(this.properties);         // create sip message factory.         this.messagefactory = this.sipfactory.createmessagefactory();         // create sip header factory.         this.headerfactory = this.sipfactory.createheaderfactory();         // create sip address factory.         this.addressfactory = this.sipfactory.createaddressfactory();         // create sip listening point , bind local ip address, port , protocol.         this.listeningpoint = this.sipstack.createlisteningpoint(this.ip, this.port, this.protocol);         // create sip provider.         this.sipprovider = this.sipstack.createsipprovider(this.listeningpoint);         // add our application sip listener.         this.sipprovider.addsiplistener(this);         // create contact address used sip messages.         system.out.println("local address: " + this.ip +" : "+ this.port + "\n");         this.contactaddress = this.addressfactory.createaddress("sip: "+ this.ip +" : "+ this.port);         // create contact header used sip messages.         this.contactheader = this.headerfactory.createcontactheader(contactaddress);          // display local ip address , port in text area.         system.out.println("local address: " + this.ip +" : "+ this.port + "\n");     }     catch(exception e)     {         e.printstacktrace();     } }//gen-last:event_onopen  private void onregisterstateless(java.awt.event.actionevent evt) {//gen-first:event_onregisterstateless     try {         // destination address text field.         address addressto = addressfactory.createaddress(textfield.gettext());         // create request uri sip message.         javax.sip.address.uri requesturi = addressto.geturi();         // create sip message headers.         // "via" headers.         arraylist viaheaders = new arraylist();         viaheader viaheader = headerfactory.createviaheader(ip, port, "udp", null);         viaheaders.add(viaheader);         // "max-forwards" header.         maxforwardsheader maxforwardsheader = headerfactory.createmaxforwardsheader(70);         // "call-id" header.         callidheader callidheader = sipprovider.getnewcallid();         // "cseq" header.         cseqheader cseqheader = headerfactory.createcseqheader(1l,"register");         // "from" header.         fromheader fromheader = headerfactory.createfromheader(contactaddress, string.valueof(tag));         // "to" header.         toheader toheader = headerfactory.createtoheader(addressto, null);          // create register request.         request request = messagefactory.createrequest(             requesturi,             "register",             callidheader,             cseqheader,             fromheader,             toheader,             viaheaders,             maxforwardsheader);         // add "contact" header request.         request.addheader(contactheader);          // send request statelessly through sip provider.         sipprovider.sendrequest(request);          // display message in text area.       textarea.append(             "request sent:\n" + request.tostring() + "\n\n");     }     catch(exception e) {         // if error occurred, display error.         textarea.append("request sent failed: " + e.getmessage() + "\n");     } }//gen-last:event_onregisterstateless  private void onregisterstatefull(java.awt.event.actionevent evt) {//gen-first:event_onregisterstatefull     // method called when click on "reg (sf)" button. }//gen-last:event_onregisterstatefull  private void oninvite(java.awt.event.actionevent evt) {//gen-first:event_oninvite     // method called when click on "invite" button. }//gen-last:event_oninvite  private void onbye(java.awt.event.actionevent evt) {//gen-first:event_onbye     // method called when click on "bye" button. }//gen-last:event_onbye  /**  * @param args command line arguments  */ public static void main(string args[]) {     /* set nimbus , feel */     //<editor-fold defaultstate="collapsed" desc=" , feel setting code (optional) ">     /* if nimbus (introduced in java se 6) not available, stay default , feel.      * details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html       */     try {         (javax.swing.uimanager.lookandfeelinfo info : javax.swing.uimanager.getinstalledlookandfeels()) {             if ("nimbus".equals(info.getname())) {                 javax.swing.uimanager.setlookandfeel(info.getclassname());                 break;             }         }     } catch (classnotfoundexception ex) {         java.util.logging.logger.getlogger(sipclient.class.getname()).log(java.util.logging.level.severe, null, ex);     } catch (instantiationexception ex) {         java.util.logging.logger.getlogger(sipclient.class.getname()).log(java.util.logging.level.severe, null, ex);     } catch (illegalaccessexception ex) {         java.util.logging.logger.getlogger(sipclient.class.getname()).log(java.util.logging.level.severe, null, ex);     } catch (javax.swing.unsupportedlookandfeelexception ex) {         java.util.logging.logger.getlogger(sipclient.class.getname()).log(java.util.logging.level.severe, null, ex);     }     //</editor-fold>      /* create , display form */     java.awt.eventqueue.invokelater(new runnable() {         @override         public void run() {             new sipclient().setvisible(true);         }     }); } // variables declaration - not modify//gen-begin:variables private javax.swing.jbutton buttonbye; private javax.swing.jbutton buttoninvite; private javax.swing.jbutton buttonregisterstatefull; private javax.swing.jbutton buttonregisterstateless; private javax.swing.jscrollpane scrollpane; private javax.swing.jtextarea textarea; private javax.swing.jtextfield textfield; // end of variables declaration//gen-end:variables public void processrequest(requestevent requestevent) {     // method called when receive sip request. }  public void processresponse(responseevent responseevent) {     // method called when receive sip request. }  public void processtimeout(timeoutevent timeoutevent) {     // method called when sip operation times out. }  public void processioexception(ioexceptionevent exceptionevent) {     // method called when sip operation results in i/o error. }  public void processtransactionterminated(transactionterminatedevent transactionterminatedevent) {     // method called when sip transaction terminates. }  public void processdialogterminated(dialogterminatedevent dialogterminatedevent) {     // method called when sip dialog terminates.   } } 

i have included org.apache.log4j jar getting following error nonetheless:

javax.sip.peerunavailableexception: peer sip stack:   gov.nist.javax.sip.sipstackimpl not instantiated. ensure path name has been set. @ javax.sip.sipfactory.createstack(sipfactory.java:324) @ javax.sip.sipfactory.createsipstack(sipfactory.java:152) @ serverclasses.sc.sipclient.onopen(sipclient.java:169) @ serverclasses.sc.sipclient.access$0(sipclient.java:159) @ serverclasses.sc.sipclient$1.windowopened(sipclient.java:77) @ java.awt.window.processwindowevent(unknown source) @ javax.swing.jframe.processwindowevent(unknown source) @ java.awt.window.processevent(unknown source) @ java.awt.component.dispatcheventimpl(unknown source) @ java.awt.container.dispatcheventimpl(unknown source) @ java.awt.window.dispatcheventimpl(unknown source) @ java.awt.component.dispatchevent(unknown source) @ java.awt.eventqueue.dispatcheventimpl(unknown source) @ java.awt.eventqueue.access$500(unknown source) @ java.awt.eventqueue$3.run(unknown source) @ java.awt.eventqueue$3.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.security.protectiondomain$1.dointersectionprivilege(unknown  source) @ java.security.protectiondomain$1.dointersectionprivilege(unknown source) @ java.awt.eventqueue$4.run(unknown source) @ java.awt.eventqueue$4.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.security.protectiondomain$1.dointersectionprivilege(unknown source) @ java.awt.eventqueue.dispatchevent(unknown source) @ java.awt.eventdispatchthread.pumponeeventforfilters(unknown source) @ java.awt.eventdispatchthread.pumpeventsforfilter(unknown source) @ java.awt.eventdispatchthread.pumpeventsforhierarchy(unknown source) @ java.awt.eventdispatchthread.pumpevents(unknown source) @ java.awt.eventdispatchthread.pumpevents(unknown source) @ java.awt.eventdispatchthread.run(unknown source) caused by: java.lang.classnotfoundexception: gov.nist.javax.sip.sipstackimpl @ java.net.urlclassloader.findclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ sun.misc.launcher$appclassloader.loadclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ java.lang.class.forname0(native method) @ java.lang.class.forname(unknown source) @ javax.sip.sipfactory.createstack(sipfactory.java:305) ... 29 more 

please me out this. new sip programming.

you need jain-sip-api , jain-sip-ri jars. looking @ error missing ri jar. can jars archive here https://jsip.ci.cloudbees.com/job/jsip/lastsuccessfulbuild/artifact/trunk/jain-sip-1.2.2370.tar.gz


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -