[sip-comm-dev] 3rd Party Jars - Sorry in advance


#1

I must apologise in advance because I know the answer to this is going
to be very stupid but I need to ask the question before I go on a
murderous rampage and start claiming that I am the highlander.

How, in very simple, heres an example build.xml, heres the manifest do
you get bundles to embed 3rd party jar files and actually work?

I've only successfully got this to work by modifying the felix global
class path which I don't really want to do. I've been through hours of
osgi pages, countless variations on manifests, build.xml parameters and
have had differing success.

I can currently get my bundle to launch but as soon as it tries to use
mysql from the 3rd party lib it dies with an error that translates to I
can't find this mysql class. I've tried bundling the mysql library by
itself which kind of worked but then it failed to instantiate the class
even though it seemed to know where and what it was.

I've attached my manifest file and the snippet from the build.xml.
Could someone please point out the obvious as I can't figure it out and
once again apologies for the stupid question.

NB: I changed the , to ; in the Bundle-Classpath attribute after
stumbling across a webpage that used this syntax... it still didn't
work. I've also had Bundle-Classpath at the bottom of the manifest
instead of where it is now.

manifestetc.txt (907 Bytes)

···

#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared
by NetIQ MailMarshal
#####################################################################################


#2

Hey Wayne,

Appologies for the late reply.

--inline

Wayne Merricks wrote:

How, in very simple, heres an example build.xml, heres the manifest do
you get bundles to embed 3^rd party jar files and actually work?

There are basically three ways to do this.

1. You make the jar available in the system classpath, then add it in
the system packages list in felix.client.run.properties and also add it
inside the import-packages clause of the manifest for the bundle that's
going to need it (I believe this is the option you tried). This is what
we do with most of the JRE packages.

2. You modify the target that builds the bundle which will be using your
3d party jar (usually called bundle-xxx) and you make it include all the
classes from your 3d party jar. This is probably the simplest way. You
can have a look at what we do with the oscar, jain-sip, and msn jars.

3. You modify/recreate the jar's manifest in order to make a bundle out
of it (have a look at any of the *manifest.mf manifests in our source
tree for an example).

I can currently get my bundle to launch but as soon as it tries to use
mysql from the 3^rd party lib it dies with an error that translates to I
can’t find this mysql class. I’ve tried bundling the mysql library by
itself

Yes that's probably the way to go.

which kind of worked but then it failed to instantiate the class
even though it seemed to know where and what it was.

Could be that it also had dependencies that you needed to take care of
in exactly the same way.

Hope this helps
Emil

···

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#3

Hi,Emil.
I have also wanna add 3rd party jar,and meet a question.I have know the 3
ways you said in mail.
Now, i have a puzzle! whether the 3 ways can not be use together?I have use
them together,and i get a terrible erro.
Thank you for your help!

···

2009/1/7 Emil Ivov <emcho@sip-communicator.org>

Hey Wayne,

Appologies for the late reply.

--inline

Wayne Merricks wrote:
> How, in very simple, heres an example build.xml, heres the manifest do
> you get bundles to embed 3^rd party jar files and actually work?

There are basically three ways to do this.

1. You make the jar available in the system classpath, then add it in
the system packages list in felix.client.run.properties and also add it
inside the import-packages clause of the manifest for the bundle that's
going to need it (I believe this is the option you tried). This is what
we do with most of the JRE packages.

2. You modify the target that builds the bundle which will be using your
3d party jar (usually called bundle-xxx) and you make it include all the
classes from your 3d party jar. This is probably the simplest way. You
can have a look at what we do with the oscar, jain-sip, and msn jars.

3. You modify/recreate the jar's manifest in order to make a bundle out
of it (have a look at any of the *manifest.mf manifests in our source
tree for an example).

> I can currently get my bundle to launch but as soon as it tries to use
> mysql from the 3^rd party lib it dies with an error that translates to I
> can't find this mysql class. I've tried bundling the mysql library by
> itself

Yes that's probably the way to go.

> which kind of worked but then it failed to instantiate the class
> even though it seemed to know where and what it was.

Could be that it also had dependencies that you needed to take care of
in exactly the same way.

Hope this helps
Emil

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

--
Thanks!
Dong Fengyu


#4

Hi,all.
I have resolve my trouble,the 3 ways will use together.thank you all the
same.

···

2009/1/8 fengyu dong <dongfengyu20032045@gmail.com>

Hi,Emil.
I have also wanna add 3rd party jar,and meet a question.I have know the 3
ways you said in mail.
Now, i have a puzzle! whether the 3 ways can not be use together?I have use
them together,and i get a terrible erro.
Thank you for your help!

2009/1/7 Emil Ivov <emcho@sip-communicator.org>

Hey Wayne,

Appologies for the late reply.

--inline

Wayne Merricks wrote:
> How, in very simple, heres an example build.xml, heres the manifest do
> you get bundles to embed 3^rd party jar files and actually work?

There are basically three ways to do this.

1. You make the jar available in the system classpath, then add it in
the system packages list in felix.client.run.properties and also add it
inside the import-packages clause of the manifest for the bundle that's
going to need it (I believe this is the option you tried). This is what
we do with most of the JRE packages.

2. You modify the target that builds the bundle which will be using your
3d party jar (usually called bundle-xxx) and you make it include all the
classes from your 3d party jar. This is probably the simplest way. You
can have a look at what we do with the oscar, jain-sip, and msn jars.

3. You modify/recreate the jar's manifest in order to make a bundle out
of it (have a look at any of the *manifest.mf manifests in our source
tree for an example).

> I can currently get my bundle to launch but as soon as it tries to use
> mysql from the 3^rd party lib it dies with an error that translates to I
> can't find this mysql class. I've tried bundling the mysql library by
> itself

Yes that's probably the way to go.

> which kind of worked but then it failed to instantiate the class
> even though it seemed to know where and what it was.

Could be that it also had dependencies that you needed to take care of
in exactly the same way.

Hope this helps
Emil

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

--
Thanks!
Dong Fengyu

--
Thanks!
Dong Fengyu


#5

Hey Fengyu,

Sorry for not replying earlier. Yes indeed there's no problem when using
the three approaches in the same application (as long as you are not
doing it for the same lib).

All three coexist happily in SIP Communicator.

Cheers
Emil

fengyu dong wrote:

···

Hi,all.
I have resolve my trouble,the 3 ways will use together.thank you all the
same.

2009/1/8 fengyu dong <dongfengyu20032045@gmail.com
<mailto:dongfengyu20032045@gmail.com>>

    Hi,Emil.
    I have also wanna add 3rd party jar,and meet a question.I have know
    the 3 ways you said in mail.
    Now, i have a puzzle! whether the 3 ways can not be use together?I
    have use them together,and i get a terrible erro.
    Thank you for your help!

    2009/1/7 Emil Ivov <emcho@sip-communicator.org
    <mailto:emcho@sip-communicator.org>>

        Hey Wayne,

        Appologies for the late reply.

        --inline

        Wayne Merricks wrote:
        > How, in very simple, heres an example build.xml, heres the
        manifest do
        > you get bundles to embed 3^rd party jar files and actually work?

        There are basically three ways to do this.

        1. You make the jar available in the system classpath, then add
        it in
        the system packages list in felix.client.run.properties and also
        add it
        inside the import-packages clause of the manifest for the bundle
        that's
        going to need it (I believe this is the option you tried). This
        is what
        we do with most of the JRE packages.

        2. You modify the target that builds the bundle which will be
        using your
        3d party jar (usually called bundle-xxx) and you make it include
        all the
        classes from your 3d party jar. This is probably the simplest
        way. You
        can have a look at what we do with the oscar, jain-sip, and msn
        jars.

        3. You modify/recreate the jar's manifest in order to make a
        bundle out
        of it (have a look at any of the *manifest.mf manifests in our
        source
        tree for an example).

        > I can currently get my bundle to launch but as soon as it
        tries to use
        > mysql from the 3^rd party lib it dies with an error that
        translates to I
        > can't find this mysql class. I've tried bundling the mysql
        library by
        > itself

        Yes that's probably the way to go.

        > which kind of worked but then it failed to instantiate the class
        > even though it seemed to know where and what it was.

        Could be that it also had dependencies that you needed to take
        care of
        in exactly the same way.

        Hope this helps
        Emil

        ---------------------------------------------------------------------
        To unsubscribe, e-mail:
        dev-unsubscribe@sip-communicator.dev.java.net
        <mailto:dev-unsubscribe@sip-communicator.dev.java.net>
        For additional commands, e-mail:
        dev-help@sip-communicator.dev.java.net
        <mailto:dev-help@sip-communicator.dev.java.net>

    --
    Thanks!
    Dong Fengyu

--
Thanks!
Dong Fengyu

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net