You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Mike Edwards <mi...@gmail.com> on 2009/01/03 08:26:03 UTC

Using Axis2 Java with OSGi - some help appreciated

Folks,

I am writing as a developer on the Apache Tuscany project.

We are building a version of Tuscany that runs on OSGi - and we use Axis2 in our codebase.

We're experiencing some problems associated with running Axis2 with Tuscany under OSGi and I'd
appreciate any help you can give us.

The problem we've run into relates to user-provided Message Receiver classes that are part of the
Tuscany code and which are configured into axis2.xml as follows:

     <messageReceivers>

        <!-- Added by Tuscany -->
         <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"

class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInMessageReceiver"/>

         <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
                          class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
         <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
                          class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>

        <!-- Added by Tuscany -->
         <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"

class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageReceiver"/>

        <!-- Added by Tuscany -->
         <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"

class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInMessageReceiver"/>

         <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
                          class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
         <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
                          class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>

        <!-- Added by Tuscany -->
         <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"

class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageReceiver"/>

     </messageReceivers>

When we run the code using OSGi, we get class loading exceptions for those Tuscany message receiver
classes, since the code that loads those classes is in the Axis2 code (AxisConfigBuilder) - but that
code has no declared dependencies on the Tuscany packages containing the message receivers - so that
we get class not found exceptions.

Do you have a solution for this problem?

I got the code working with the Eclipse/Equinox version of OSGi by patching the following into the
manifest for the axis2-kernel jar:

Eclipse-BuddyPolicy: dependent

...and then declaring the relevant Tuscany jar files as being buddies of the axis2-kernel bundle in
thier manifests.

However, I know that this is really a sticking-plaster solution and will only currently work for the
Equinox version of OSGi.  Do you have a nice neat solution that will work for all the OSGi
implementations?


Yours,  Mike.


Re: Using Axis2 Java with OSGi - some help appreciated

Posted by Saminda Abeyruwan <sa...@gmail.com>.
Hi,

I am sorry not being able to reply soon.

There is a undergoing work on fully supporting Axis2 in OSGi environment.
You will be able to get more information from (
https://svn.apache.org/repos/asf/webservices/axis2/scratch/java/saminda/osgi_test/axis2_osgi_integration.pdf).
Axis2 comes as a bundle and all you have to is to install and start
org.apache.axis2.osgi bundle.

In prior work, it shows how to create a bundle which mimics Axis2 service
archive. You can you this in your work as well.

IMHO, all you have to do is to create a Tuscany bundle which export
necessary classes and another bundle for the  web service which imports
Tuscan classes that mimics Axis2 service archive and install and start 'em.

Thank you!

Saminda

On Sat, Jan 3, 2009 at 2:26 AM, Mike Edwards <
mike.edwards.inglenook@gmail.com> wrote:

> Folks,
>
> I am writing as a developer on the Apache Tuscany project.
>
> We are building a version of Tuscany that runs on OSGi - and we use Axis2
> in our codebase.
>
> We're experiencing some problems associated with running Axis2 with Tuscany
> under OSGi and I'd
> appreciate any help you can give us.
>
> The problem we've run into relates to user-provided Message Receiver
> classes that are part of the
> Tuscany code and which are configured into axis2.xml as follows:
>
>    <messageReceivers>
>
>       <!-- Added by Tuscany -->
>        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
>
>
> class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInMessageReceiver"/>
>
>        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
>
> class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
>        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
>
> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
>
>       <!-- Added by Tuscany -->
>        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
>
>
> class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageReceiver"/>
>
>       <!-- Added by Tuscany -->
>        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
>
>
> class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInMessageReceiver"/>
>
>        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
>
> class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
>        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
>
> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
>
>       <!-- Added by Tuscany -->
>        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
>
>
> class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageReceiver"/>
>
>    </messageReceivers>
>
> When we run the code using OSGi, we get class loading exceptions for those
> Tuscany message receiver
> classes, since the code that loads those classes is in the Axis2 code
> (AxisConfigBuilder) - but that
> code has no declared dependencies on the Tuscany packages containing the
> message receivers - so that
> we get class not found exceptions.
>
> Do you have a solution for this problem?
>
> I got the code working with the Eclipse/Equinox version of OSGi by patching
> the following into the
> manifest for the axis2-kernel jar:
>
> Eclipse-BuddyPolicy: dependent
>
> ...and then declaring the relevant Tuscany jar files as being buddies of
> the axis2-kernel bundle in
> thier manifests.
>
> However, I know that this is really a sticking-plaster solution and will
> only currently work for the
> Equinox version of OSGi.  Do you have a nice neat solution that will work
> for all the OSGi
> implementations?
>
>
> Yours,  Mike.
>
>

Re: Using Axis2 Java with OSGi - some help appreciated

Posted by Sanjiva Weerawarana <sa...@opensource.lk>.
Sameera, isn't the right thing to do to stub out the axis2 class loading 
stuff to be behind an interface? And then if axis2 is in an OSGi 
environment, the interface would be implemented by code that loads classes 
using OSGi calls instead of plain Java.

Sanjiva.

Sameera Jayasoma wrote:
> Yeah I also agree with the point "DynamicImport-Package: * is pretty 
> evil". You cannot get some of the benefits of OSGi. But if you are 
> working with Axis2-1.4.1, and you need your bundles work properly in 
> other OSGi framework implemetations, you may have to use it at some point.
> 
> Another solutions would be to implement a layer on top of Axis2, which 
> handles all these dynamic configurations.  We have done this kind of an 
> implementation in WSO2 Carbon to add deployers dynamically, without 
> putting deployer entries in Axis2.xml. These deployers are in seperate 
> bundles. When the bundle is activated, it registers Deployer service 
> with required service properties. Then the correspoinding service 
> listener adds the deployer.
> 
> --
> Sameera
> 
> 
> On Mon, Jan 5, 2009 at 11:11 PM, David Illsley <davidillsley@gmail.com 
> <ma...@gmail.com>> wrote:
> 
>     Urgh, DynamicImport-Package: * is pretty evil. It is a pretty simple
>     way to retrofit existing code into OSGI, but using it essentially
>     throws away the potential benefits. I *think* the best way is for the
>     Tuscany MessageReceiver objects to be registered as OSGI services. It
>     looks like the existing Axis2 osgi module hooks up registered
>     MessageReceiver services to act as the default message receiver for a
>     given MEP. I don't know if that would be enough for you? If not, I'd
>     think that it wouldn't be too hard to extend the existing code in the
>     osgi module to register in non-default MessageReceiver objects.
> 
>     David
> 
>     On Mon, Jan 5, 2009 at 4:06 AM, Sameera Jayasoma
>     <sameera.madushan@gmail.com <ma...@gmail.com>> wrote:
>      >
>      >
>      > On Sat, Jan 3, 2009 at 12:56 PM, Mike Edwards
>      > <mike.edwards.inglenook@gmail.com
>     <ma...@gmail.com>> wrote:
>      >>
>      >> Folks,
>      >>
>      >> I am writing as a developer on the Apache Tuscany project.
>      >>
>      >> We are building a version of Tuscany that runs on OSGi - and we
>     use Axis2
>      >> in our codebase.
>      >>
>      >> We're experiencing some problems associated with running Axis2 with
>      >> Tuscany under OSGi and I'd
>      >> appreciate any help you can give us.
>      >>
>      >> The problem we've run into relates to user-provided Message Receiver
>      >> classes that are part of the
>      >> Tuscany code and which are configured into axis2.xml as follows:
>      >>
>      >>    <messageReceivers>
>      >>
>      >>       <!-- Added by Tuscany -->
>      >>        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
>      >>
>      >>
>      >>
>     class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInMessageReceiver"/>
>      >>
>      >>        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
>      >>
>      >> class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
>      >>        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
>      >>
>      >> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
>      >>
>      >>       <!-- Added by Tuscany -->
>      >>        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
>      >>
>      >>
>      >>
>     class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageReceiver"/>
>      >>
>      >>       <!-- Added by Tuscany -->
>      >>        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
>      >>
>      >>
>      >>
>     class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInMessageReceiver"/>
>      >>
>      >>        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
>      >>
>      >> class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
>      >>        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
>      >>
>      >> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
>      >>
>      >>       <!-- Added by Tuscany -->
>      >>        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
>      >>
>      >>
>      >>
>     class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageReceiver"/>
>      >>
>      >>    </messageReceivers>
>      >>
>      >> When we run the code using OSGi, we get class loading exceptions
>     for those
>      >> Tuscany message receiver
>      >> classes, since the code that loads those classes is in the Axis2
>     code
>      >> (AxisConfigBuilder) - but that
>      >> code has no declared dependencies on the Tuscany packages
>     containing the
>      >> message receivers - so that
>      >> we get class not found exceptions.
>      >>
>      >> Do you have a solution for this problem?
>      >
>      > Yes.  As you have mentioned the problem here is, The class loader
>     which
>      > loads Axis2 classes does not see the Tuscany classes.  You can use
>      > DynamicaImport-Package OSGi manifest header for the Axis2 bundle.
>      >
>      > DynamicImport-Package: *
>      >
>      > This allows Axis2 bundle to dynamically load classes from other
>     bundles
>      > which are not wired during the Resolving process performed by the
>     OSGi
>      > framework implementation. At the same time, you need to export
>     the package
>      > in which message receiver classes reside.
>      >
>      >
>      >>
>      >>
>      >> I got the code working with the Eclipse/Equinox version of OSGi by
>      >> patching the following into the
>      >> manifest for the axis2-kernel jar:
>      >>
>      >> Eclipse-BuddyPolicy: dependent
>      >>
>      >> ...and then declaring the relevant Tuscany jar files as being
>     buddies of
>      >> the axis2-kernel bundle in
>      >> thier manifests.
>      >
>      > Seems like your implementation works only with Equinox, since you
>     have used
>      > Equinox specific constructs.
>      >
>      >>
>      >>
>      >> However, I know that this is really a sticking-plaster solution
>     and will
>      >> only currently work for the
>      >> Equinox version of OSGi.  Do you have a nice neat solution that
>     will work
>      >> for all the OSGi
>      >> implementations?
>      >
>      > Yes.  We, in WSO2 have built WSO2 Carbon [1]  which runs on OSGi.
>     WSO2
>      > Carbon is the base platform for all the WSO2 java projects.
>     Carbon uses
>      > Axis2 and we have solved most of these problems.
>      >
>      >>
>      >>
>      >>
>      >> Yours,  Mike.
>      >>
>      >
>      > [1] http://wso2.org/projects/carbon
>      >
>      > --
>      > Sameera Jayasoma
>      > Software Engineer
>      > WSO2 Inc.
>      > Oxygenating the Web Service Platform.
>      > http://wso2.org/
>      >
>      > blog:http://tech.jayasoma.org/
>      >
> 
> 
> 
> 
> -- 
> Sameera
> http://sameera-jayasoma.blogspot.com/
> http://www.flickr.com/photos/sameera-jayasoma


-- 
Sanjiva Weerawarana, Ph.D.
Founder & Director; Lanka Software Foundation; http://www.opensource.lk/
Founder, Chairman & CEO; WSO2, Inc.; http://www.wso2.com/
Member; Apache Software Foundation; http://www.apache.org/
Visiting Lecturer; University of Moratuwa; http://www.cse.mrt.ac.lk/

Blog: http://sanjiva.weerawarana.org/


Re: Using Axis2 Java with OSGi - some help appreciated

Posted by Sameera Jayasoma <sa...@gmail.com>.
Yeah I also agree with the point "DynamicImport-Package: * is pretty evil".
You cannot get some of the benefits of OSGi. But if you are working with
Axis2-1.4.1, and you need your bundles work properly in other OSGi framework
implemetations, you may have to use it at some point.

Another solutions would be to implement a layer on top of Axis2, which
handles all these dynamic configurations.  We have done this kind of an
implementation in WSO2 Carbon to add deployers dynamically, without putting
deployer entries in Axis2.xml. These deployers are in seperate bundles. When
the bundle is activated, it registers Deployer service with required service
properties. Then the correspoinding service listener adds the deployer.

--
Sameera


On Mon, Jan 5, 2009 at 11:11 PM, David Illsley <da...@gmail.com>wrote:

> Urgh, DynamicImport-Package: * is pretty evil. It is a pretty simple
> way to retrofit existing code into OSGI, but using it essentially
> throws away the potential benefits. I *think* the best way is for the
> Tuscany MessageReceiver objects to be registered as OSGI services. It
> looks like the existing Axis2 osgi module hooks up registered
> MessageReceiver services to act as the default message receiver for a
> given MEP. I don't know if that would be enough for you? If not, I'd
> think that it wouldn't be too hard to extend the existing code in the
> osgi module to register in non-default MessageReceiver objects.
>
> David
>
> On Mon, Jan 5, 2009 at 4:06 AM, Sameera Jayasoma
> <sa...@gmail.com> wrote:
> >
> >
> > On Sat, Jan 3, 2009 at 12:56 PM, Mike Edwards
> > <mi...@gmail.com> wrote:
> >>
> >> Folks,
> >>
> >> I am writing as a developer on the Apache Tuscany project.
> >>
> >> We are building a version of Tuscany that runs on OSGi - and we use
> Axis2
> >> in our codebase.
> >>
> >> We're experiencing some problems associated with running Axis2 with
> >> Tuscany under OSGi and I'd
> >> appreciate any help you can give us.
> >>
> >> The problem we've run into relates to user-provided Message Receiver
> >> classes that are part of the
> >> Tuscany code and which are configured into axis2.xml as follows:
> >>
> >>    <messageReceivers>
> >>
> >>       <!-- Added by Tuscany -->
> >>        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
> >>
> >>
> >>
> class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInMessageReceiver"/>
> >>
> >>        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
> >>
> >> class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
> >>        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
> >>
> >> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
> >>
> >>       <!-- Added by Tuscany -->
> >>        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
> >>
> >>
> >>
> class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageReceiver"/>
> >>
> >>       <!-- Added by Tuscany -->
> >>        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
> >>
> >>
> >>
> class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInMessageReceiver"/>
> >>
> >>        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
> >>
> >> class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
> >>        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
> >>
> >> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
> >>
> >>       <!-- Added by Tuscany -->
> >>        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
> >>
> >>
> >>
> class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageReceiver"/>
> >>
> >>    </messageReceivers>
> >>
> >> When we run the code using OSGi, we get class loading exceptions for
> those
> >> Tuscany message receiver
> >> classes, since the code that loads those classes is in the Axis2 code
> >> (AxisConfigBuilder) - but that
> >> code has no declared dependencies on the Tuscany packages containing the
> >> message receivers - so that
> >> we get class not found exceptions.
> >>
> >> Do you have a solution for this problem?
> >
> > Yes.  As you have mentioned the problem here is, The class loader which
> > loads Axis2 classes does not see the Tuscany classes.  You can use
> > DynamicaImport-Package OSGi manifest header for the Axis2 bundle.
> >
> > DynamicImport-Package: *
> >
> > This allows Axis2 bundle to dynamically load classes from other bundles
> > which are not wired during the Resolving process performed by the OSGi
> > framework implementation. At the same time, you need to export the
> package
> > in which message receiver classes reside.
> >
> >
> >>
> >>
> >> I got the code working with the Eclipse/Equinox version of OSGi by
> >> patching the following into the
> >> manifest for the axis2-kernel jar:
> >>
> >> Eclipse-BuddyPolicy: dependent
> >>
> >> ...and then declaring the relevant Tuscany jar files as being buddies of
> >> the axis2-kernel bundle in
> >> thier manifests.
> >
> > Seems like your implementation works only with Equinox, since you have
> used
> > Equinox specific constructs.
> >
> >>
> >>
> >> However, I know that this is really a sticking-plaster solution and will
> >> only currently work for the
> >> Equinox version of OSGi.  Do you have a nice neat solution that will
> work
> >> for all the OSGi
> >> implementations?
> >
> > Yes.  We, in WSO2 have built WSO2 Carbon [1]  which runs on OSGi. WSO2
> > Carbon is the base platform for all the WSO2 java projects. Carbon uses
> > Axis2 and we have solved most of these problems.
> >
> >>
> >>
> >>
> >> Yours,  Mike.
> >>
> >
> > [1] http://wso2.org/projects/carbon
> >
> > --
> > Sameera Jayasoma
> > Software Engineer
> > WSO2 Inc.
> > Oxygenating the Web Service Platform.
> > http://wso2.org/
> >
> > blog:http://tech.jayasoma.org/
> >
>



-- 
Sameera
http://sameera-jayasoma.blogspot.com/
http://www.flickr.com/photos/sameera-jayasoma

Re: Using Axis2 Java with OSGi - some help appreciated

Posted by Raymond Feng <en...@gmail.com>.
I agree that DynamicImport-Package: * is evil :-).

In Tuscany, we adopt the extension/extension point pattern (inspired by 
Eclipse) to solve similar problems without a hard dependency on the OSGi 
service registry APIs [1]. We register implementation classes of a service 
provider interface in a file named as META-INF/services/<service provider 
interface name>. The content of the file is the name of the implementation 
class.

If the code is executed without OSGi, we use the classloader to discover the 
META-INF/services/<service provider interface name> resources and then load 
the implementation class by name. With OSGi, we discover bundles that 
contain the META-INF/services/<service provider interface name> resources 
and use the owning bundle to load the implementation class. This way, we 
don't have to export the implementation classes and they are accessed via 
service provider interfaces and the extension points.

There is also an interesting article that compares the Eclipse 
extension/extension point pattern and the OSGi service registry. See [2].

[1] https://svn.apache.org/repos/asf/tuscany/java/sca/modules/extensibility/
[2] http://www.eclipsezone.com/articles/extensions-vs-services/

Thanks,
Raymond
--------------------------------------------------
From: "David Illsley" <da...@gmail.com>
Sent: Monday, January 05, 2009 9:41 AM
To: <ax...@ws.apache.org>
Subject: Re: Using Axis2 Java with OSGi - some help appreciated

> Urgh, DynamicImport-Package: * is pretty evil. It is a pretty simple
> way to retrofit existing code into OSGI, but using it essentially
> throws away the potential benefits. I *think* the best way is for the
> Tuscany MessageReceiver objects to be registered as OSGI services. It
> looks like the existing Axis2 osgi module hooks up registered
> MessageReceiver services to act as the default message receiver for a
> given MEP. I don't know if that would be enough for you? If not, I'd
> think that it wouldn't be too hard to extend the existing code in the
> osgi module to register in non-default MessageReceiver objects.
>
> David
>
> On Mon, Jan 5, 2009 at 4:06 AM, Sameera Jayasoma
> <sa...@gmail.com> wrote:
>>
>>
>> On Sat, Jan 3, 2009 at 12:56 PM, Mike Edwards
>> <mi...@gmail.com> wrote:
>>>
>>> Folks,
>>>
>>> I am writing as a developer on the Apache Tuscany project.
>>>
>>> We are building a version of Tuscany that runs on OSGi - and we use 
>>> Axis2
>>> in our codebase.
>>>
>>> We're experiencing some problems associated with running Axis2 with
>>> Tuscany under OSGi and I'd
>>> appreciate any help you can give us.
>>>
>>> The problem we've run into relates to user-provided Message Receiver
>>> classes that are part of the
>>> Tuscany code and which are configured into axis2.xml as follows:
>>>
>>>    <messageReceivers>
>>>
>>>       <!-- Added by Tuscany -->
>>>        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
>>>
>>>
>>> class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInMessageReceiver"/>
>>>
>>>        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
>>>
>>> class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
>>>        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
>>>
>>> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
>>>
>>>       <!-- Added by Tuscany -->
>>>        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
>>>
>>>
>>> class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageReceiver"/>
>>>
>>>       <!-- Added by Tuscany -->
>>>        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
>>>
>>>
>>> class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInMessageReceiver"/>
>>>
>>>        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
>>>
>>> class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
>>>        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
>>>
>>> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
>>>
>>>       <!-- Added by Tuscany -->
>>>        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
>>>
>>>
>>> class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageReceiver"/>
>>>
>>>    </messageReceivers>
>>>
>>> When we run the code using OSGi, we get class loading exceptions for 
>>> those
>>> Tuscany message receiver
>>> classes, since the code that loads those classes is in the Axis2 code
>>> (AxisConfigBuilder) - but that
>>> code has no declared dependencies on the Tuscany packages containing the
>>> message receivers - so that
>>> we get class not found exceptions.
>>>
>>> Do you have a solution for this problem?
>>
>> Yes.  As you have mentioned the problem here is, The class loader which
>> loads Axis2 classes does not see the Tuscany classes.  You can use
>> DynamicaImport-Package OSGi manifest header for the Axis2 bundle.
>>
>> DynamicImport-Package: *
>>
>> This allows Axis2 bundle to dynamically load classes from other bundles
>> which are not wired during the Resolving process performed by the OSGi
>> framework implementation. At the same time, you need to export the 
>> package
>> in which message receiver classes reside.
>>
>>
>>>
>>>
>>> I got the code working with the Eclipse/Equinox version of OSGi by
>>> patching the following into the
>>> manifest for the axis2-kernel jar:
>>>
>>> Eclipse-BuddyPolicy: dependent
>>>
>>> ...and then declaring the relevant Tuscany jar files as being buddies of
>>> the axis2-kernel bundle in
>>> thier manifests.
>>
>> Seems like your implementation works only with Equinox, since you have 
>> used
>> Equinox specific constructs.
>>
>>>
>>>
>>> However, I know that this is really a sticking-plaster solution and will
>>> only currently work for the
>>> Equinox version of OSGi.  Do you have a nice neat solution that will 
>>> work
>>> for all the OSGi
>>> implementations?
>>
>> Yes.  We, in WSO2 have built WSO2 Carbon [1]  which runs on OSGi. WSO2
>> Carbon is the base platform for all the WSO2 java projects. Carbon uses
>> Axis2 and we have solved most of these problems.
>>
>>>
>>>
>>>
>>> Yours,  Mike.
>>>
>>
>> [1] http://wso2.org/projects/carbon
>>
>> --
>> Sameera Jayasoma
>> Software Engineer
>> WSO2 Inc.
>> Oxygenating the Web Service Platform.
>> http://wso2.org/
>>
>> blog:http://tech.jayasoma.org/
>> 

Re: Using Axis2 Java with OSGi - some help appreciated

Posted by David Illsley <da...@gmail.com>.
Urgh, DynamicImport-Package: * is pretty evil. It is a pretty simple
way to retrofit existing code into OSGI, but using it essentially
throws away the potential benefits. I *think* the best way is for the
Tuscany MessageReceiver objects to be registered as OSGI services. It
looks like the existing Axis2 osgi module hooks up registered
MessageReceiver services to act as the default message receiver for a
given MEP. I don't know if that would be enough for you? If not, I'd
think that it wouldn't be too hard to extend the existing code in the
osgi module to register in non-default MessageReceiver objects.

David

On Mon, Jan 5, 2009 at 4:06 AM, Sameera Jayasoma
<sa...@gmail.com> wrote:
>
>
> On Sat, Jan 3, 2009 at 12:56 PM, Mike Edwards
> <mi...@gmail.com> wrote:
>>
>> Folks,
>>
>> I am writing as a developer on the Apache Tuscany project.
>>
>> We are building a version of Tuscany that runs on OSGi - and we use Axis2
>> in our codebase.
>>
>> We're experiencing some problems associated with running Axis2 with
>> Tuscany under OSGi and I'd
>> appreciate any help you can give us.
>>
>> The problem we've run into relates to user-provided Message Receiver
>> classes that are part of the
>> Tuscany code and which are configured into axis2.xml as follows:
>>
>>    <messageReceivers>
>>
>>       <!-- Added by Tuscany -->
>>        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
>>
>>
>> class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInMessageReceiver"/>
>>
>>        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
>>
>> class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
>>        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
>>
>> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
>>
>>       <!-- Added by Tuscany -->
>>        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
>>
>>
>> class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageReceiver"/>
>>
>>       <!-- Added by Tuscany -->
>>        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
>>
>>
>> class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInMessageReceiver"/>
>>
>>        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
>>
>> class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
>>        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
>>
>> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
>>
>>       <!-- Added by Tuscany -->
>>        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
>>
>>
>> class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageReceiver"/>
>>
>>    </messageReceivers>
>>
>> When we run the code using OSGi, we get class loading exceptions for those
>> Tuscany message receiver
>> classes, since the code that loads those classes is in the Axis2 code
>> (AxisConfigBuilder) - but that
>> code has no declared dependencies on the Tuscany packages containing the
>> message receivers - so that
>> we get class not found exceptions.
>>
>> Do you have a solution for this problem?
>
> Yes.  As you have mentioned the problem here is, The class loader which
> loads Axis2 classes does not see the Tuscany classes.  You can use
> DynamicaImport-Package OSGi manifest header for the Axis2 bundle.
>
> DynamicImport-Package: *
>
> This allows Axis2 bundle to dynamically load classes from other bundles
> which are not wired during the Resolving process performed by the OSGi
> framework implementation. At the same time, you need to export the package
> in which message receiver classes reside.
>
>
>>
>>
>> I got the code working with the Eclipse/Equinox version of OSGi by
>> patching the following into the
>> manifest for the axis2-kernel jar:
>>
>> Eclipse-BuddyPolicy: dependent
>>
>> ...and then declaring the relevant Tuscany jar files as being buddies of
>> the axis2-kernel bundle in
>> thier manifests.
>
> Seems like your implementation works only with Equinox, since you have used
> Equinox specific constructs.
>
>>
>>
>> However, I know that this is really a sticking-plaster solution and will
>> only currently work for the
>> Equinox version of OSGi.  Do you have a nice neat solution that will work
>> for all the OSGi
>> implementations?
>
> Yes.  We, in WSO2 have built WSO2 Carbon [1]  which runs on OSGi. WSO2
> Carbon is the base platform for all the WSO2 java projects. Carbon uses
> Axis2 and we have solved most of these problems.
>
>>
>>
>>
>> Yours,  Mike.
>>
>
> [1] http://wso2.org/projects/carbon
>
> --
> Sameera Jayasoma
> Software Engineer
> WSO2 Inc.
> Oxygenating the Web Service Platform.
> http://wso2.org/
>
> blog:http://tech.jayasoma.org/
>

Re: Using Axis2 Java with OSGi - some help appreciated

Posted by Mike Edwards <mi...@gmail.com>.
Sameera Jayasoma wrote:
> 
> 
> On Sat, Jan 3, 2009 at 12:56 PM, Mike Edwards 
> <mike.edwards.inglenook@gmail.com 
> <ma...@gmail.com>> wrote:
> 
>     Folks,
> 
>     I am writing as a developer on the Apache Tuscany project.
> 
>     We are building a version of Tuscany that runs on OSGi - and we use
>     Axis2 in our codebase.
> 
>     We're experiencing some problems associated with running Axis2 with
>     Tuscany under OSGi and I'd
>     appreciate any help you can give us.
> 
>     The problem we've run into relates to user-provided Message Receiver
>     classes that are part of the
>     Tuscany code and which are configured into axis2.xml as follows:
> 
>        <messageReceivers>
> 
>           <!-- Added by Tuscany -->
>            <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
> 
>     class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInMessageReceiver"/>
> 
>            <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
>                            
>     class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
>            <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
>                            
>     class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
> 
>           <!-- Added by Tuscany -->
>            <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
> 
>     class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageReceiver"/>
> 
>           <!-- Added by Tuscany -->
>            <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
> 
>     class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInMessageReceiver"/>
> 
>            <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
>                            
>     class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
>            <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
>                            
>     class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
> 
>           <!-- Added by Tuscany -->
>            <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
> 
>     class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageReceiver"/>
> 
>        </messageReceivers>
> 
>     When we run the code using OSGi, we get class loading exceptions for
>     those Tuscany message receiver
>     classes, since the code that loads those classes is in the Axis2
>     code (AxisConfigBuilder) - but that
>     code has no declared dependencies on the Tuscany packages containing
>     the message receivers - so that
>     we get class not found exceptions.
> 
>     Do you have a solution for this problem?
> 
> 
> 
> Yes.  As you have mentioned the problem here is, The class loader which 
> loads Axis2 classes does not see the Tuscany classes.  You can use 
> DynamicaImport-Package OSGi manifest header for the Axis2 bundle.
> 
> DynamicImport-Package: *
> 
> This allows Axis2 bundle to dynamically load classes from other bundles 
> which are not wired during the Resolving process performed by the OSGi 
> framework implementation. At the same time, you need to export the 
> package in which message receiver classes reside.
> 
> 
> 
> 
>     I got the code working with the Eclipse/Equinox version of OSGi by
>     patching the following into the
>     manifest for the axis2-kernel jar:
> 
>     Eclipse-BuddyPolicy: dependent
> 
>     ...and then declaring the relevant Tuscany jar files as being
>     buddies of the axis2-kernel bundle in
>     thier manifests.
> 
> 
> Seems like your implementation works only with Equinox, since you have 
> used Equinox specific constructs.  
> 
> 
> 
>     However, I know that this is really a sticking-plaster solution and
>     will only currently work for the
>     Equinox version of OSGi.  Do you have a nice neat solution that will
>     work for all the OSGi
>     implementations?
> 
> 
> Yes.  We, in WSO2 have built WSO2 Carbon [1]  which runs on OSGi. WSO2 
> Carbon is the base platform for all the WSO2 java projects. Carbon uses 
> Axis2 and we have solved most of these problems. 

Sameera,

Thanks for responding to my email.

Would you be able to say more about how you solved these OSGi problems with Axis2 in the Carbon 
project?  Are your solutions of general applicability - and do they involve changes to the Axis2 
codebase?


Yours,  Mike.

> 
> 
> 
> 
>     Yours,  Mike.
> 
> 
> [1] http://wso2.org/projects/carbon
> 
> --
> Sameera Jayasoma
> Software Engineer
> WSO2 Inc.
> Oxygenating the Web Service Platform.
> http://wso2.org/
> 
> blog:http://tech.jayasoma.org/


Re: Using Axis2 Java with OSGi - some help appreciated

Posted by Sameera Jayasoma <sa...@gmail.com>.
On Sat, Jan 3, 2009 at 12:56 PM, Mike Edwards <
mike.edwards.inglenook@gmail.com> wrote:

> Folks,
>
> I am writing as a developer on the Apache Tuscany project.
>
> We are building a version of Tuscany that runs on OSGi - and we use Axis2
> in our codebase.
>
> We're experiencing some problems associated with running Axis2 with Tuscany
> under OSGi and I'd
> appreciate any help you can give us.
>
> The problem we've run into relates to user-provided Message Receiver
> classes that are part of the
> Tuscany code and which are configured into axis2.xml as follows:
>
>    <messageReceivers>
>
>       <!-- Added by Tuscany -->
>        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
>
>
> class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInMessageReceiver"/>
>
>        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
>
> class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
>        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
>
> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
>
>       <!-- Added by Tuscany -->
>        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
>
>
> class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageReceiver"/>
>
>       <!-- Added by Tuscany -->
>        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
>
>
> class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInMessageReceiver"/>
>
>        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
>
> class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
>        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
>
> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
>
>       <!-- Added by Tuscany -->
>        <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
>
>
> class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageReceiver"/>
>
>    </messageReceivers>
>
> When we run the code using OSGi, we get class loading exceptions for those
> Tuscany message receiver
> classes, since the code that loads those classes is in the Axis2 code
> (AxisConfigBuilder) - but that
> code has no declared dependencies on the Tuscany packages containing the
> message receivers - so that
> we get class not found exceptions.
>
> Do you have a solution for this problem?



Yes.  As you have mentioned the problem here is, The class loader which
loads Axis2 classes does not see the Tuscany classes.  You can use
DynamicaImport-Package OSGi manifest header for the Axis2 bundle.

DynamicImport-Package: *

This allows Axis2 bundle to dynamically load classes from other bundles
which are not wired during the Resolving process performed by the OSGi
framework implementation. At the same time, you need to export the package
in which message receiver classes reside.



>
> I got the code working with the Eclipse/Equinox version of OSGi by patching
> the following into the
> manifest for the axis2-kernel jar:
>
> Eclipse-BuddyPolicy: dependent
>
> ...and then declaring the relevant Tuscany jar files as being buddies of
> the axis2-kernel bundle in
> thier manifests.


Seems like your implementation works only with Equinox, since you have used
Equinox specific constructs.


>
> However, I know that this is really a sticking-plaster solution and will
> only currently work for the
> Equinox version of OSGi.  Do you have a nice neat solution that will work
> for all the OSGi
> implementations?


Yes.  We, in WSO2 have built WSO2 Carbon [1]  which runs on OSGi. WSO2
Carbon is the base platform for all the WSO2 java projects. Carbon uses
Axis2 and we have solved most of these problems.


>
>
> Yours,  Mike.
>
>
[1] http://wso2.org/projects/carbon

--
Sameera Jayasoma
Software Engineer
WSO2 Inc.
Oxygenating the Web Service Platform.
http://wso2.org/

blog:http://tech.jayasoma.org/