Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7794869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:54:08+00:00 2026-06-01T22:54:08+00:00

I’m trying to build a simple SIP application using JAIN SIP 1.2 and the

  • 0

I’m trying to build a simple SIP application using JAIN SIP 1.2 and the NIST implementation. I’m using JavaSE1.7 with Eclipse as my IDE.
The problem: I am getting javax.sip.PeerUnavailableException when trying to construct a SipStack object.

My main class:

package net.bezeqint.sip.enp;

public class ListenerMain {

    public static void main(String[] args) {

        try {
            System.out.println("Creating ExampleListener...");
            ExampleListener listener = new ExampleListener();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }
}

My problematic class (the one from which I construct the SIP Stack object):

package net.bezeqint.sip.enp;

import javax.sip.*;
import javax.sip.message.*;
import javax.sip.header.*;
import javax.sip.address.*;
import javax.sip.address.URI;

import java.net.*;
import java.util.*;

public class ExampleListener implements SipListener {

    private SipFactory mySipFactory;
    private SipStack mySipStack;
    private ListeningPoint myListeningPoint;
    private SipProvider mySipProvider;
    private MessageFactory myMessageFacory;
    private HeaderFactory myHeaderFactory;
    private AddressFactory myAddressFactory;
    private Properties myProperties;
    private String myIP;
    private int myPort = 5060;

    public ExampleListener() throws Exception {

        mySipFactory = SipFactory.getInstance();
        mySipFactory.setPathName("gov.nist");

        // create factories
        myMessageFacory = mySipFactory.createMessageFactory();
        myHeaderFactory = mySipFactory.createHeaderFactory();
        myAddressFactory = mySipFactory.createAddressFactory();
        // create a Properties object to pass as an argument to the createSipStack() method
        myProperties = new Properties();
        myProperties.setProperty("javax.sip.STACK_NAME","myStack");
        // test
        // myProperties.setProperty("javax.sip.IP_ADDRESS","192.168.1.1");

        System.out.println("Creating SipStack...");
        mySipStack = mySipFactory.createSipStack(myProperties);
        System.out.println("SipStack created!");

        // get our IP address to be used when creating the ListeningPoint
        myIP = InetAddress.getLocalHost().getHostAddress();

        myListeningPoint = mySipStack.createListeningPoint(myIP, myPort, "udp");

        mySipProvider = mySipStack.createSipProvider(myListeningPoint);

        mySipProvider.addSipListener(this);


        // begin building a request
        Address destAddress = myAddressFactory.createAddress("sip:registrar.ocean.com");
        Address addressOfRecord = myAddressFactory.createAddress("sip:peter@ocean.com");
        Address contactAddress = myAddressFactory.createAddress("sip:peter@169.254.153.60");

        // convert address to URI object
        URI myRequestURI = destAddress.getURI();

        // create headers
        ArrayList viaHeaders = new ArrayList();
        ViaHeader myViaHeader = myHeaderFactory.createViaHeader("Peterpc.ocean.com"
                , 5060, "udp", "z9hG4bKnashds7");
        viaHeaders.add(myViaHeader);

        MaxForwardsHeader myMaxForwardsHeader =
                myHeaderFactory.createMaxForwardsHeader(70);

        ToHeader myToHeader = myHeaderFactory.createToHeader(addressOfRecord, null);

        FromHeader myFromHeader = myHeaderFactory.createFromHeader(addressOfRecord, "456248");

        CallIdHeader myCallIDHeader = myHeaderFactory.createCallIdHeader("843817637684230@998sdasdh09");

        CSeqHeader myCseqHeader = myHeaderFactory.createCSeqHeader(1826, "REGISTER");

        // create message
        Request myRequest = myMessageFacory.createRequest(myRequestURI, "REGISTER", myCallIDHeader, myCseqHeader, myFromHeader, myToHeader, viaHeaders, myMaxForwardsHeader);

        // add missing headers
        ContactHeader myContactHeader = myHeaderFactory.createContactHeader(contactAddress);
        myRequest.addHeader(myContactHeader);

        // print the message
        System.out.println(myRequest);

    }

    @Override
    public void processDialogTerminated(DialogTerminatedEvent arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void processIOException(IOExceptionEvent arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void processRequest(RequestEvent arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void processResponse(ResponseEvent arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void processTimeout(TimeoutEvent arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void processTransactionTerminated(TransactionTerminatedEvent arg0) {
        // TODO Auto-generated method stub

    }
}

The console output:

Creating ExampleListener…
Creating SipStack…
javax.sip.PeerUnavailableException: The Peer SIP Stack: gov.nist.javax.sip.SipStackImpl could not be instantiated. Ensure the Path Name has been set.
at javax.sip.SipFactory.createStack(SipFactory.java:324)
at javax.sip.SipFactory.createSipStack(SipFactory.java:152)
at net.bezeqint.sip.enp.ExampleListener.(ExampleListener.java:41)
at net.bezeqint.sip.enp.ListenerMain.main(ListenerMain.java:9)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at javax.sip.SipFactory.createStack(SipFactory.java:314)
… 3 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Priority
at gov.nist.javax.sip.SipStackImpl.(SipStackImpl.java:387)
… 8 more
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Priority
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
… 9 more

I have double checked the path name used by mySipFactory.createSipStack() and made sure it is properly imported to my build path.

What’s the problem with the javax.sip.PeerUnavailableException?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T22:54:10+00:00Added an answer on June 1, 2026 at 10:54 pm

    Solved! I had to import the org.apache.log4j package and this did the trick.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I'm making a simple page using Google Maps API 3. My first. One marker
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.