[jitsi-dev] Jitsi Android - SIP stack no class def found


#1

Hi,

I have the following exception while trying to establish a call between
Jitsi desktop and Android version. I am using sip2sip.info and ippi.frproviders.

It seems that Max-Forwards header field is not included at some point and
the stack crashes while trying to create the HeaderFactoryImpl at
SipStackSharing.java:1141

java.lang.ClassNotFoundException:
org.jitsi.gov.nist.org.jitsi.javax.sip.header.HeaderFactoryImpl

I belive that it's related to renaming done in build.xml:

<!-- rename class that were just compiled -->
        <package-rename>
            <fileset dir="${out.classes.absolute.dir}"/>
            <rule pattern="java.awt.**"
                  result="org.jitsi.android.util.java.awt.@1"/>
            <rule pattern="javax.swing.**"
                  result="org.jitsi.android.util.javax.swing.@1"/>
            <!--rule pattern="java.beans.**"
                  result="org.jitsi.android.util.java.beans.@1"/-->

            <rule pattern="org.xmlpull.v1.**"
                  result="org.jitsi.org.xmlpull.v1.@1"/>

            <rule pattern="javax.sip.**"
                  result="org.jitsi.javax.sip.@1"/>
            <rule pattern="gov.nist.core.**"
                  result="org.jitsi.gov.nist.core.@1"/>
            <rule pattern="gov.nist.javax.sip.**"
                  result="org.jitsi.gov.nist.javax.sip.@1"/>
        </package-rename>

Here's the code from SipFactory class:

public HeaderFactory createHeaderFactory() throws PeerUnavailableException
{
    if (headerFactory == null) {
        headerFactory = (HeaderFactory)
createSipFactory("javax.sip.header.HeaderFactoryImpl");
    }
    return headerFactory;
}

As a result of renaming that string we probably get:

from -> javax.sip.header.HeaderFactoryImpl

to -> org.jitsi.javax.sip.header.HeaderFactoryImpl

Because there is a line sipFactory.setPathName("org.jitsi.gov.nist"); in
108 in SipStackSharing

so we get for the request as it's listed in the exception:
org.jitsi.gov.nist.+ org.jitsi.javax.sip.header.HeaderFactoryImpl

The problem is that the stack is created properly while the factories are
not. It looks like the string for header factory is renamed while for the
stack it isn't.

Here's the link to SipFactory code:

The factories classes are resolved by(SipFactory:278):

Class peerObjectClass = Class.forName(getPathName() + "."+objectClassName);

The "objectClassName" is passed as an argument. The value is:
"javax.sip.header.HeaderFactoryImpl"

For the stack(SipFactory:305):

Constructor sipStackConstructor = Class.forName(getPathName() +
".javax.sip.SipStackImpl").getConstructor(paramTypes);

So the reason why it works different is that there is the dot in
".javax.sip.SipStackImpl" and for the factories there isn't and these
strings are renamed.

Any ideas for solving this ? Currently I don't have in mind any not "hacky"
solutions for this problem.

JitsiAndroidSIPNoClassDefFound.txt (10.9 KB)

···

--
Regards,
Pawel


#2

How does the package renamer work ? Is there any source for it ? Maybe it
shouldn't replace constants in classes ?

Hi,

I have the following exception while trying to establish a call between

Jitsi desktop and Android version. I am using sip2sip.info and ippi.frproviders.

It seems that Max-Forwards header field is not included at some point and

the stack crashes while trying to create the HeaderFactoryImpl at
SipStackSharing.java:1141

java.lang.ClassNotFoundException:

org.jitsi.gov.nist.org.jitsi.javax.sip.header.HeaderFactoryImpl

I belive that it's related to renaming done in build.xml:

<!-- rename class that were just compiled -->
        <package-rename>
            <fileset dir="${out.classes.absolute.dir}"/>
            <rule pattern="java.awt.**"
                  result="org.jitsi.android.util.java.awt.@1"/>
            <rule pattern="javax.swing.**"
                  result="org.jitsi.android.util.javax.swing.@1"/>
            <!--rule pattern="java.beans.**"
                  result="org.jitsi.android.util.java.beans.@1"/-->

            <rule pattern="org.xmlpull.v1.**"
                  result="org.jitsi.org.xmlpull.v1.@1"/>

            <rule pattern="javax.sip.**"
                  result="org.jitsi.javax.sip.@1"/>
            <rule pattern="gov.nist.core.**"
                  result="org.jitsi.gov.nist.core.@1"/>
            <rule pattern="gov.nist.javax.sip.**"
                  result="org.jitsi.gov.nist.javax.sip.@1"/>
        </package-rename>

Here's the code from SipFactory class:

public HeaderFactory createHeaderFactory() throws PeerUnavailableException
{
    if (headerFactory == null) {
        headerFactory = (HeaderFactory)

createSipFactory("javax.sip.header.HeaderFactoryImpl");

    }
    return headerFactory;
}

As a result of renaming that string we probably get:

from -> javax.sip.header.HeaderFactoryImpl

to -> org.jitsi.javax.sip.header.HeaderFactoryImpl

Because there is a line sipFactory.setPathName("org.jitsi.gov.nist"); in

108 in SipStackSharing

so we get for the request as it's listed in the exception:
org.jitsi.gov.nist.+ org.jitsi.javax.sip.header.HeaderFactoryImpl

The problem is that the stack is created properly while the factories are

not. It looks like the string for header factory is renamed while for the
stack it isn't.

Here's the link to SipFactory code:

The factories classes are resolved by(SipFactory:278):

Class peerObjectClass = Class.forName(getPathName() +

"."+objectClassName);

The "objectClassName" is passed as an argument. The value is:
"javax.sip.header.HeaderFactoryImpl"

For the stack(SipFactory:305):

Constructor sipStackConstructor = Class.forName(getPathName() +

".javax.sip.SipStackImpl").getConstructor(paramTypes);

So the reason why it works different is that there is the dot in

".javax.sip.SipStackImpl" and for the factories there isn't and these
strings are renamed.

Any ideas for solving this ? Currently I don't have in mind any not

"hacky" solutions for this problem.

···

2013/3/7 Paweł Domas <paweldomas@gmail.com>

--
Regards,
Pawel

--
Regards,
Pawel


#3

Hey,

I've just committed the fix for this. Thanks for the report and for
the offline explain, discuss and helping find the solution.

Regards
damencho

···

On Thu, Mar 7, 2013 at 2:33 PM, Paweł Domas <paweldomas@gmail.com> wrote:

How does the package renamer work ? Is there any source for it ? Maybe it
shouldn't replace constants in classes ?

2013/3/7 Paweł Domas <paweldomas@gmail.com>

Hi,

I have the following exception while trying to establish a call between
Jitsi desktop and Android version. I am using sip2sip.info and ippi.fr
providers.

It seems that Max-Forwards header field is not included at some point and
the stack crashes while trying to create the HeaderFactoryImpl at
SipStackSharing.java:1141

java.lang.ClassNotFoundException:
org.jitsi.gov.nist.org.jitsi.javax.sip.header.HeaderFactoryImpl

I belive that it's related to renaming done in build.xml:

<!-- rename class that were just compiled -->
        <package-rename>
            <fileset dir="${out.classes.absolute.dir}"/>
            <rule pattern="java.awt.**"
                  result="org.jitsi.android.util.java.awt.@1"/>
            <rule pattern="javax.swing.**"
                  result="org.jitsi.android.util.javax.swing.@1"/>
            <!--rule pattern="java.beans.**"
                  result="org.jitsi.android.util.java.beans.@1"/-->

            <rule pattern="org.xmlpull.v1.**"
                  result="org.jitsi.org.xmlpull.v1.@1"/>

            <rule pattern="javax.sip.**"
                  result="org.jitsi.javax.sip.@1"/>
            <rule pattern="gov.nist.core.**"
                  result="org.jitsi.gov.nist.core.@1"/>
            <rule pattern="gov.nist.javax.sip.**"
                  result="org.jitsi.gov.nist.javax.sip.@1"/>
        </package-rename>

Here's the code from SipFactory class:

public HeaderFactory createHeaderFactory() throws PeerUnavailableException
{
    if (headerFactory == null) {
        headerFactory = (HeaderFactory)
createSipFactory("javax.sip.header.HeaderFactoryImpl");
    }
    return headerFactory;
}

As a result of renaming that string we probably get:

from -> javax.sip.header.HeaderFactoryImpl

to -> org.jitsi.javax.sip.header.HeaderFactoryImpl

Because there is a line sipFactory.setPathName("org.jitsi.gov.nist"); in
108 in SipStackSharing

so we get for the request as it's listed in the exception:
org.jitsi.gov.nist.+ org.jitsi.javax.sip.header.HeaderFactoryImpl

The problem is that the stack is created properly while the factories are
not. It looks like the string for header factory is renamed while for the
stack it isn't.

Here's the link to SipFactory code:

http://java.net/projects/jsip/sources/svn/content/trunk/src/javax/sip/SipFactory.java?rev=2273

The factories classes are resolved by(SipFactory:278):

Class peerObjectClass = Class.forName(getPathName() +
"."+objectClassName);

The "objectClassName" is passed as an argument. The value is:
"javax.sip.header.HeaderFactoryImpl"

For the stack(SipFactory:305):

Constructor sipStackConstructor = Class.forName(getPathName() +
".javax.sip.SipStackImpl").getConstructor(paramTypes);

So the reason why it works different is that there is the dot in
".javax.sip.SipStackImpl" and for the factories there isn't and these
strings are renamed.

Any ideas for solving this ? Currently I don't have in mind any not
"hacky" solutions for this problem.

--
Regards,
Pawel

--
Regards,
Pawel