Re: Custom interceptors with DOSGi

2012-01-17 Thread Sergey Beryozkin


On 17/01/12 19:00, gaygeek wrote:

I tried out the DOSGI change and it will work very well


great


--the only thing
missing is the ability to specify in.fault and out.fault interceptors to
cover all interceptor lifecycles. Also, I have a suggestion on the
implementation--in ClassUtils, I think the loadProviderClasses should also
check the serviceProviders class to see if it is a String for non-arrays as
well as arrays (as it does already) so you could provide a single bean
reference without having to create an array if you only have one
interceptor... so instead of (using spring-dm for activator creation):

 
 
 
 
 

it could be specified as:
 

This, of course, is not a big deal, but it was my first intuition to try it
the second way.

My suggested code change is:

public static List  loadProviderClasses(BundleContext
callingContext, Map sd, String propName) {

 Object serviceProviders = sd.get(propName);
 if (serviceProviders != null) {
 if (serviceProviders.getClass().isArray()) {
 if (serviceProviders.getClass().getComponentType() ==
String.class) {
 return loadProviders(callingContext,
(String[])serviceProviders);
 } else {
 return Arrays.asList((Object[])serviceProviders);
 }
 } else {
 if (serviceProviders.getClass() == String.class) {
 String[] classNames =
serviceProviders.toString().split(",");
 return loadProviders(callingContext, classNames);
 } else {
 return Arrays.asList(serviceProviders);
 }
 }
 } else {
 return Collections.emptyList();
 }
 }



Done, thanks for this suggestion. I think we are on something here, in 
time we can pass customized 'everything' that is required to build a 
given endpoint or consumer in DOSGi via OSGI properties


Cheers, Sergey


-Jeff


On Tue, Jan 17, 2012 at 10:07 AM, Jeff Melby  wrote:


Great--I see on the trunk code you have added the below for in and out
interceptors, but how about in.fault and out.fault interceptors? I'll be
trying this out today--thanks again for looking into this issue so quickly.

-Jeff


On Tue, Jan 17, 2012 at 7:55 AM, Sergey Beryozkin-5 [via CXF]<
ml-node+s547215n5151623...@n5.nabble.com>  wrote:


Hi
On 17/01/12 13:47, gaygeek wrote:

Sergey-

Can you explain how this will work for already-instantiated

interceptors

from DOSGi? I realized that there are some interceptors where I may

want to

inject spring beans, so the annotation approach won't work for those.

Will

there be a way to reference a spring-instantiated bean as the

interceptor?




for WS, you'd need to to register a List of Interceptor (or Feature)
instances as a service property, from the bundle Activator, example,

props.put("org.apache.cxf.ws.in.interceptors", listOfInInterceptors);
props.put("org.apache.cxf.ws.out.interceptors", listOfInInterceptors);
props.put("org.apache.cxf.ws.features", listOfFeatures);

and the context properties:

props.put("org.apache.cxf.ws.context.properties", mapOfProps);

and then pass them during the registration/lookup.
Same for RS;

For RS, it is also possible to register JAX-RS providers as OSGI
services but I thought having the same supported for CXF
interceptors/features is a bit early

Cheers, Sergey


Thanks,
Jeff

On Mon, Jan 16, 2012 at 5:22 PM, Sergey Beryozkin-5 [via CXF]<
[hidden email]>

  wrote:



Dan, thanks for the fix/enhancement, I also updated DOSGi
to check for custom interceptors&   features passed along during the
registration/lookup, possibly already instantiated, and also from
Declarative Services...for WS&   RS

Just stopped short of also starting the trackers, may be later :-)

Sergey
On 16/01/12 16:03, Daniel Kulp wrote:


On Monday, January 16, 2012 7:33:45 AM gaygeek wrote:

Yes--as you said, the export is there in my custom bundle, but the

cxf

bundle has no way to import it to create the interceptor instance.

Are you saying there is currently a way to do this, or that DOSGi

will

need

to be modified to allow custom interceptors? I think you are saying

it

is

not available currently, but that it would probably need to be a

property

on the osgi service export configuration.


One thing we COULD try doing is updating the Annotations we have to

actually

support using Class objects.  Right now, we have:

public @interface InInterceptors {
   String[] interceptors();
}

which means we need to do Class.forName things.   We could expand

this

to:


public @interface InInterceptors {
   String[] interceptors();
   Class[]  classes();
}

or similar so that you could annotate with the actual class objects

and

not

have to deal with the classloaders in OSGi.

Dan





Thanks,
Jeff

Re: Custom interceptors with DOSGi

2012-01-17 Thread gaygeek
I tried out the DOSGI change and it will work very well--the only thing
missing is the ability to specify in.fault and out.fault interceptors to
cover all interceptor lifecycles. Also, I have a suggestion on the
implementation--in ClassUtils, I think the loadProviderClasses should also
check the serviceProviders class to see if it is a String for non-arrays as
well as arrays (as it does already) so you could provide a single bean
reference without having to create an array if you only have one
interceptor... so instead of (using spring-dm for activator creation):







it could be specified as:


This, of course, is not a big deal, but it was my first intuition to try it
the second way.

My suggested code change is:

public static List loadProviderClasses(BundleContext
callingContext, Map sd, String propName) {

Object serviceProviders = sd.get(propName);
if (serviceProviders != null) {
if (serviceProviders.getClass().isArray()) {
if (serviceProviders.getClass().getComponentType() ==
String.class) {
return loadProviders(callingContext,
(String[])serviceProviders);
} else {
return Arrays.asList((Object[])serviceProviders);
}
} else {
if (serviceProviders.getClass() == String.class) {
String[] classNames =
serviceProviders.toString().split(",");
return loadProviders(callingContext, classNames);
} else {
return Arrays.asList(serviceProviders);
}
}
} else {
return Collections.emptyList();
}
}

-Jeff


On Tue, Jan 17, 2012 at 10:07 AM, Jeff Melby  wrote:

> Great--I see on the trunk code you have added the below for in and out
> interceptors, but how about in.fault and out.fault interceptors? I'll be
> trying this out today--thanks again for looking into this issue so quickly.
>
> -Jeff
>
>
> On Tue, Jan 17, 2012 at 7:55 AM, Sergey Beryozkin-5 [via CXF] <
> ml-node+s547215n5151623...@n5.nabble.com> wrote:
>
>> Hi
>> On 17/01/12 13:47, gaygeek wrote:
>> > Sergey-
>> >
>> > Can you explain how this will work for already-instantiated
>> interceptors
>> > from DOSGi? I realized that there are some interceptors where I may
>> want to
>> > inject spring beans, so the annotation approach won't work for those.
>> Will
>> > there be a way to reference a spring-instantiated bean as the
>> interceptor?
>> >
>>
>> for WS, you'd need to to register a List of Interceptor (or Feature)
>> instances as a service property, from the bundle Activator, example,
>>
>> props.put("org.apache.cxf.ws.in.interceptors", listOfInInterceptors);
>> props.put("org.apache.cxf.ws.out.interceptors", listOfInInterceptors);
>> props.put("org.apache.cxf.ws.features", listOfFeatures);
>>
>> and the context properties:
>>
>> props.put("org.apache.cxf.ws.context.properties", mapOfProps);
>>
>> and then pass them during the registration/lookup.
>> Same for RS;
>>
>> For RS, it is also possible to register JAX-RS providers as OSGI
>> services but I thought having the same supported for CXF
>> interceptors/features is a bit early
>>
>> Cheers, Sergey
>>
>> > Thanks,
>> > Jeff
>> >
>> > On Mon, Jan 16, 2012 at 5:22 PM, Sergey Beryozkin-5 [via CXF]<
>> > [hidden email] >
>>  wrote:
>> >
>> >> Dan, thanks for the fix/enhancement, I also updated DOSGi
>> >> to check for custom interceptors&  features passed along during the
>> >> registration/lookup, possibly already instantiated, and also from
>> >> Declarative Services...for WS&  RS
>> >>
>> >> Just stopped short of also starting the trackers, may be later :-)
>> >>
>> >> Sergey
>> >> On 16/01/12 16:03, Daniel Kulp wrote:
>> >>
>> >>> On Monday, January 16, 2012 7:33:45 AM gaygeek wrote:
>>  Yes--as you said, the export is there in my custom bundle, but the
>> cxf
>>  bundle has no way to import it to create the interceptor instance.
>> 
>>  Are you saying there is currently a way to do this, or that DOSGi
>> will
>> >> need
>>  to be modified to allow custom interceptors? I think you are saying
>> it
>> >> is
>>  not available currently, but that it would probably need to be a
>> >> property
>>  on the osgi service export configuration.
>> >>>
>> >>> One thing we COULD try doing is updating the Annotations we have to
>> >> actually
>> >>> support using Class objects.  Right now, we have:
>> >>>
>> >>> public @interface InInterceptors {
>> >>>   String[] interceptors();
>> >>> }
>> >>>
>> >>> which means we need to do Class.forName things.   We could expand
>> this
>> >> to:
>> >>>
>> >>> public @interface InInterceptors {
>> >>>   String[] interceptors();
>> >>>   Class[]  classes();
>> >>> }
>> >>>
>> >>> or similar so that you could annotate with the actual cla

Re: Custom interceptors with DOSGi

2012-01-17 Thread gaygeek
Great--I see on the trunk code you have added the below for in and out
interceptors, but how about in.fault and out.fault interceptors? I'll be
trying this out today--thanks again for looking into this issue so quickly.

-Jeff


On Tue, Jan 17, 2012 at 7:55 AM, Sergey Beryozkin-5 [via CXF] <
ml-node+s547215n5151623...@n5.nabble.com> wrote:

> Hi
> On 17/01/12 13:47, gaygeek wrote:
> > Sergey-
> >
> > Can you explain how this will work for already-instantiated interceptors
> > from DOSGi? I realized that there are some interceptors where I may want
> to
> > inject spring beans, so the annotation approach won't work for those.
> Will
> > there be a way to reference a spring-instantiated bean as the
> interceptor?
> >
>
> for WS, you'd need to to register a List of Interceptor (or Feature)
> instances as a service property, from the bundle Activator, example,
>
> props.put("org.apache.cxf.ws.in.interceptors", listOfInInterceptors);
> props.put("org.apache.cxf.ws.out.interceptors", listOfInInterceptors);
> props.put("org.apache.cxf.ws.features", listOfFeatures);
>
> and the context properties:
>
> props.put("org.apache.cxf.ws.context.properties", mapOfProps);
>
> and then pass them during the registration/lookup.
> Same for RS;
>
> For RS, it is also possible to register JAX-RS providers as OSGI
> services but I thought having the same supported for CXF
> interceptors/features is a bit early
>
> Cheers, Sergey
>
> > Thanks,
> > Jeff
> >
> > On Mon, Jan 16, 2012 at 5:22 PM, Sergey Beryozkin-5 [via CXF]<
> > [hidden email] >
>  wrote:
> >
> >> Dan, thanks for the fix/enhancement, I also updated DOSGi
> >> to check for custom interceptors&  features passed along during the
> >> registration/lookup, possibly already instantiated, and also from
> >> Declarative Services...for WS&  RS
> >>
> >> Just stopped short of also starting the trackers, may be later :-)
> >>
> >> Sergey
> >> On 16/01/12 16:03, Daniel Kulp wrote:
> >>
> >>> On Monday, January 16, 2012 7:33:45 AM gaygeek wrote:
>  Yes--as you said, the export is there in my custom bundle, but the
> cxf
>  bundle has no way to import it to create the interceptor instance.
> 
>  Are you saying there is currently a way to do this, or that DOSGi
> will
> >> need
>  to be modified to allow custom interceptors? I think you are saying
> it
> >> is
>  not available currently, but that it would probably need to be a
> >> property
>  on the osgi service export configuration.
> >>>
> >>> One thing we COULD try doing is updating the Annotations we have to
> >> actually
> >>> support using Class objects.  Right now, we have:
> >>>
> >>> public @interface InInterceptors {
> >>>   String[] interceptors();
> >>> }
> >>>
> >>> which means we need to do Class.forName things.   We could expand this
> >> to:
> >>>
> >>> public @interface InInterceptors {
> >>>   String[] interceptors();
> >>>   Class[]  classes();
> >>> }
> >>>
> >>> or similar so that you could annotate with the actual class objects
> and
> >> not
> >>> have to deal with the classloaders in OSGi.
> >>>
> >>> Dan
> >>>
> >>>
> >>>
> 
>  Thanks,
>  Jeff
> 
>  On Mon, Jan 16, 2012 at 8:37 AM, Sergey Beryozkin-5 [via CXF]<
> 
>  [hidden email]>
>
> >>   wrote:
> > Ignore that please, keeping forgetting the cxf bundle does not
> import
> > custom classes/
> >
> > I think in DOSGi case, a new property would have to be introduced in
> > time for custom CXF interceptors be picked up
> >
> > Cheers, Sergey
> >
> > On 16/01/12 12:25, Sergey Beryozkin wrote:
> >> Does the custom bundle export "com.uhg.upm.webservice.interceptor"
> ?
> >>
> >> Sergey
> >>
> >> On 13/01/12 22:36, gaygeek wrote:
> >>> I am trying to configure a custom interceptor for a web service
> >>> I'm
> >>> exposing
> >>> with DOSGi. However, it seems that the interceptor cannot be
> >>> initialized via
> >>> annotation, as the org.apache.cxf.bundle-minimal does not have
> >>> access
> >>> to my
> >>> custom interceptor class from its bundle classloader. I get the
> >
> > following
> >
> >>> error when starting my bundle with the service in it (which DOES
> >>> have
> >>> access
> >>> to the package that my SoapFaultInterceptor is in). It seems like
> >>> the
> >>> only
> >>> way to make it work would be to hack the MANIFEST.MF for the
> >>> org.apache.cxf.bundle-minimal to import my bundle with the custom
> >>> interceptor.
> >>>
> >>> Is there a different way to configure custom interceptors with
> >>> DOSGi?
> >>> Or am
> >>> I missing something in order to allow the annotations to work?
> >>>
> >>> Annotations for the WebService interface:
> >>> @WebService(name = "HelloService", targetNamespace =
> >>> "

Re: Custom interceptors with DOSGi

2012-01-17 Thread Sergey Beryozkin

Hi
On 17/01/12 13:47, gaygeek wrote:

Sergey-

Can you explain how this will work for already-instantiated interceptors
from DOSGi? I realized that there are some interceptors where I may want to
inject spring beans, so the annotation approach won't work for those. Will
there be a way to reference a spring-instantiated bean as the interceptor?



for WS, you'd need to to register a List of Interceptor (or Feature) 
instances as a service property, from the bundle Activator, example,


props.put("org.apache.cxf.ws.in.interceptors", listOfInInterceptors);
props.put("org.apache.cxf.ws.out.interceptors", listOfInInterceptors);
props.put("org.apache.cxf.ws.features", listOfFeatures);

and the context properties:

props.put("org.apache.cxf.ws.context.properties", mapOfProps);

and then pass them during the registration/lookup.
Same for RS;

For RS, it is also possible to register JAX-RS providers as OSGI 
services but I thought having the same supported for CXF 
interceptors/features is a bit early


Cheers, Sergey


Thanks,
Jeff

On Mon, Jan 16, 2012 at 5:22 PM, Sergey Beryozkin-5 [via CXF]<
ml-node+s547215n515016...@n5.nabble.com>  wrote:


Dan, thanks for the fix/enhancement, I also updated DOSGi
to check for custom interceptors&  features passed along during the
registration/lookup, possibly already instantiated, and also from
Declarative Services...for WS&  RS

Just stopped short of also starting the trackers, may be later :-)

Sergey
On 16/01/12 16:03, Daniel Kulp wrote:


On Monday, January 16, 2012 7:33:45 AM gaygeek wrote:

Yes--as you said, the export is there in my custom bundle, but the cxf
bundle has no way to import it to create the interceptor instance.

Are you saying there is currently a way to do this, or that DOSGi will

need

to be modified to allow custom interceptors? I think you are saying it

is

not available currently, but that it would probably need to be a

property

on the osgi service export configuration.


One thing we COULD try doing is updating the Annotations we have to

actually

support using Class objects.  Right now, we have:

public @interface InInterceptors {
  String[] interceptors();
}

which means we need to do Class.forName things.   We could expand this

to:


public @interface InInterceptors {
  String[] interceptors();
  Class[]  classes();
}

or similar so that you could annotate with the actual class objects and

not

have to deal with the classloaders in OSGi.

Dan





Thanks,
Jeff

On Mon, Jan 16, 2012 at 8:37 AM, Sergey Beryozkin-5 [via CXF]<

[hidden email]>

  wrote:

Ignore that please, keeping forgetting the cxf bundle does not import
custom classes/

I think in DOSGi case, a new property would have to be introduced in
time for custom CXF interceptors be picked up

Cheers, Sergey

On 16/01/12 12:25, Sergey Beryozkin wrote:

Does the custom bundle export "com.uhg.upm.webservice.interceptor" ?

Sergey

On 13/01/12 22:36, gaygeek wrote:

I am trying to configure a custom interceptor for a web service
I'm
exposing
with DOSGi. However, it seems that the interceptor cannot be
initialized via
annotation, as the org.apache.cxf.bundle-minimal does not have
access
to my
custom interceptor class from its bundle classloader. I get the


following


error when starting my bundle with the service in it (which DOES
have
access
to the package that my SoapFaultInterceptor is in). It seems like
the
only
way to make it work would be to hack the MANIFEST.MF for the
org.apache.cxf.bundle-minimal to import my bundle with the custom
interceptor.

Is there a different way to configure custom interceptors with
DOSGi?
Or am
I missing something in order to allow the annotations to work?

Annotations for the WebService interface:
@WebService(name = "HelloService", targetNamespace =
"http://upm.uhc.com/example/hello";)
@OutFaultInterceptors(interceptors =
{"com.uhg.upm.webservice.interceptor.SoapFaultInterceptor"})
public interface HelloService

Exception when starting my bundle with the HelloService in it:
Exception in thread "pool-1-thread-4"
org.apache.cxf.interceptor.Fault: Could not create annotation
object:
com.uhg.upm.webservice.interceptor.SoapFaultInterceptor
at




org.apache.cxf.interceptor.AnnotationInterceptors.initializeAnnotationOb

jects(AnnotationInterceptors.java:79)>

at




org.apache.cxf.interceptor.AnnotationInterceptors.getAnnotationObject(An

notationInterceptors.java:48)>

at




org.apache.cxf.interceptor.AnnotationInterceptors.getAnnotationIntercept

orList(AnnotationInterceptors.java:102)>

at




org.apache.cxf.interceptor.AnnotationInterceptors.getOutFaultInterceptor

s(AnnotationInterceptors.java:122)>

...
Caused by: java.lang.ClassNotFoundException:
com.uhg.upm.webservice.interceptor.SoapFaultInterceptor not found
by
org.apache.cxf.bundle-minimal [57]
at




org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(Mo

duleImpl.java:812)>

at
org.apache.felix.framework.Modu

Re: Custom interceptors with DOSGi

2012-01-17 Thread gaygeek
Thanks Freeman for the idea of another approach... I have not worked with
osgi fragments, so was not aware how they work. This sounds like an
approach that could work in many situations where other osgi classloader
issues arise in 3rd-party libraries.

-Jeff

On Mon, Jan 16, 2012 at 8:46 PM, Freeman-2 [via CXF] <
ml-node+s547215n515048...@n5.nabble.com> wrote:

> Hi,
>
> Another general solution to workaround this class.forname issue in
> OSGi world is create your customer bundle as a fragment bundle, and
> attach it to the cxf bundle(cxf bundle play the role as a host
> bundle), so that all fragment bundle resource is available for host
> bundle.
> We usually use it to resolve the issue in JDBC driver bundle,  which
> has similar situation you encountered here, some bundle(like spring-
> jdbc or commons-dbcp) need use class.forname to init  driver classes
> from JDBC driver bundle, but there's no way that can import such
> package beforehand(as jdbc driver can from any provider and there's no
> way to know the package name beforehand), so make jdbc driver as
> fragment bundle and attach it to spring-jdbc or commons-dbcp can
> resolve it.
> This is actually a legacy class.forname issue before we have OSGi
> concept and I totally agree that in CXF we should get rid of the
> class.forname as much as possible.
>
> Freeman
> On 2012-1-17, at 上午9:28, gaygeek wrote:
>
> > Dan and Sergey-
> >
> > Thanks for your responses. I locally modified the cxf 2.5.2-SNAPSHOT
> > AnnotationInterceptors class and the interceptor annotations to
> > allow class
> > objects to be set in the annotations as Dan suggested and that will
> > work
> > very well. Instead of needing the classloader to find the classes by
> > name,
> > you just need to do clazz.newInstance(). I prefer using annotations
> > for
> > setting the interceptors, but I also think having the option in DOSGi
> > configuration is also a great idea. Do you think this change could
> > make it
> > into the 2.5.2 cxf release?
> >
> > Thanks,
> > Jeff
> >
> > On Mon, Jan 16, 2012 at 5:22 PM, Sergey Beryozkin-5 [via CXF] <
> > [hidden email] >
> wrote:
> >
> >> Dan, thanks for the fix/enhancement, I also updated DOSGi
> >> to check for custom interceptors & features passed along during the
> >> registration/lookup, possibly already instantiated, and also from
> >> Declarative Services...for WS & RS
> >>
> >> Just stopped short of also starting the trackers, may be later :-)
> >>
> >> Sergey
> >> On 16/01/12 16:03, Daniel Kulp wrote:
> >>
> >>> On Monday, January 16, 2012 7:33:45 AM gaygeek wrote:
>  Yes--as you said, the export is there in my custom bundle, but
>  the cxf
>  bundle has no way to import it to create the interceptor instance.
> 
>  Are you saying there is currently a way to do this, or that DOSGi
>  will
> >> need
>  to be modified to allow custom interceptors? I think you are
>  saying it
> >> is
>  not available currently, but that it would probably need to be a
> >> property
>  on the osgi service export configuration.
> >>>
> >>> One thing we COULD try doing is updating the Annotations we have to
> >> actually
> >>> support using Class objects.  Right now, we have:
> >>>
> >>> public @interface InInterceptors {
> >>> String[] interceptors();
> >>> }
> >>>
> >>> which means we need to do Class.forName things.   We could expand
> >>> this
> >> to:
> >>>
> >>> public @interface InInterceptors {
> >>> String[] interceptors();
> >>> Class[]  classes();
> >>> }
> >>>
> >>> or similar so that you could annotate with the actual class
> >>> objects and
> >> not
> >>> have to deal with the classloaders in OSGi.
> >>>
> >>> Dan
> >>>
> >>>
> >>>
> 
>  Thanks,
>  Jeff
> 
>  On Mon, Jan 16, 2012 at 8:37 AM, Sergey Beryozkin-5 [via CXF]<
> 
>  [hidden email] 
>  >>
> >> wrote:
> > Ignore that please, keeping forgetting the cxf bundle does not
> > import
> > custom classes/
> >
> > I think in DOSGi case, a new property would have to be
> > introduced in
> > time for custom CXF interceptors be picked up
> >
> > Cheers, Sergey
> >
> > On 16/01/12 12:25, Sergey Beryozkin wrote:
> >> Does the custom bundle export
> >> "com.uhg.upm.webservice.interceptor" ?
> >>
> >> Sergey
> >>
> >> On 13/01/12 22:36, gaygeek wrote:
> >>> I am trying to configure a custom interceptor for a web service
> >>> I'm
> >>> exposing
> >>> with DOSGi. However, it seems that the interceptor cannot be
> >>> initialized via
> >>> annotation, as the org.apache.cxf.bundle-minimal does not have
> >>> access
> >>> to my
> >>> custom interceptor class from its bundle classloader. I get the
> >
> > following
> >
> >>> error when starting my bundle with the service in it (which DOES
> >>> have

Re: Custom interceptors with DOSGi

2012-01-17 Thread gaygeek
Sergey-

Can you explain how this will work for already-instantiated interceptors
from DOSGi? I realized that there are some interceptors where I may want to
inject spring beans, so the annotation approach won't work for those. Will
there be a way to reference a spring-instantiated bean as the interceptor?

Thanks,
Jeff

On Mon, Jan 16, 2012 at 5:22 PM, Sergey Beryozkin-5 [via CXF] <
ml-node+s547215n515016...@n5.nabble.com> wrote:

> Dan, thanks for the fix/enhancement, I also updated DOSGi
> to check for custom interceptors & features passed along during the
> registration/lookup, possibly already instantiated, and also from
> Declarative Services...for WS & RS
>
> Just stopped short of also starting the trackers, may be later :-)
>
> Sergey
> On 16/01/12 16:03, Daniel Kulp wrote:
>
> > On Monday, January 16, 2012 7:33:45 AM gaygeek wrote:
> >> Yes--as you said, the export is there in my custom bundle, but the cxf
> >> bundle has no way to import it to create the interceptor instance.
> >>
> >> Are you saying there is currently a way to do this, or that DOSGi will
> need
> >> to be modified to allow custom interceptors? I think you are saying it
> is
> >> not available currently, but that it would probably need to be a
> property
> >> on the osgi service export configuration.
> >
> > One thing we COULD try doing is updating the Annotations we have to
> actually
> > support using Class objects.  Right now, we have:
> >
> > public @interface InInterceptors {
> >  String[] interceptors();
> > }
> >
> > which means we need to do Class.forName things.   We could expand this
> to:
> >
> > public @interface InInterceptors {
> >  String[] interceptors();
> >  Class[]  classes();
> > }
> >
> > or similar so that you could annotate with the actual class objects and
> not
> > have to deal with the classloaders in OSGi.
> >
> > Dan
> >
> >
> >
> >>
> >> Thanks,
> >> Jeff
> >>
> >> On Mon, Jan 16, 2012 at 8:37 AM, Sergey Beryozkin-5 [via CXF]<
> >>
> >> [hidden email] >
>  wrote:
> >>> Ignore that please, keeping forgetting the cxf bundle does not import
> >>> custom classes/
> >>>
> >>> I think in DOSGi case, a new property would have to be introduced in
> >>> time for custom CXF interceptors be picked up
> >>>
> >>> Cheers, Sergey
> >>>
> >>> On 16/01/12 12:25, Sergey Beryozkin wrote:
>  Does the custom bundle export "com.uhg.upm.webservice.interceptor" ?
> 
>  Sergey
> 
>  On 13/01/12 22:36, gaygeek wrote:
> > I am trying to configure a custom interceptor for a web service
> > I'm
> > exposing
> > with DOSGi. However, it seems that the interceptor cannot be
> > initialized via
> > annotation, as the org.apache.cxf.bundle-minimal does not have
> > access
> > to my
> > custom interceptor class from its bundle classloader. I get the
> >>>
> >>> following
> >>>
> > error when starting my bundle with the service in it (which DOES
> > have
> > access
> > to the package that my SoapFaultInterceptor is in). It seems like
> > the
> > only
> > way to make it work would be to hack the MANIFEST.MF for the
> > org.apache.cxf.bundle-minimal to import my bundle with the custom
> > interceptor.
> >
> > Is there a different way to configure custom interceptors with
> > DOSGi?
> > Or am
> > I missing something in order to allow the annotations to work?
> >
> > Annotations for the WebService interface:
> > @WebService(name = "HelloService", targetNamespace =
> > "http://upm.uhc.com/example/hello";)
> > @OutFaultInterceptors(interceptors =
> > {"com.uhg.upm.webservice.interceptor.SoapFaultInterceptor"})
> > public interface HelloService
> >
> > Exception when starting my bundle with the HelloService in it:
> > Exception in thread "pool-1-thread-4"
> > org.apache.cxf.interceptor.Fault: Could not create annotation
> > object:
> > com.uhg.upm.webservice.interceptor.SoapFaultInterceptor
> > at
> >>>
> >>>
> org.apache.cxf.interceptor.AnnotationInterceptors.initializeAnnotationOb
> >>> jects(AnnotationInterceptors.java:79)>
> > at
> >>>
> >>>
> org.apache.cxf.interceptor.AnnotationInterceptors.getAnnotationObject(An
> >>> notationInterceptors.java:48)>
> > at
> >>>
> >>>
> org.apache.cxf.interceptor.AnnotationInterceptors.getAnnotationIntercept
> >>> orList(AnnotationInterceptors.java:102)>
> > at
> >>>
> >>>
> org.apache.cxf.interceptor.AnnotationInterceptors.getOutFaultInterceptor
> >>> s(AnnotationInterceptors.java:122)>
> > ...
> > Caused by: java.lang.ClassNotFoundException:
> > com.uhg.upm.webservice.interceptor.SoapFaultInterceptor not found
> > by
> > org.apache.cxf.bundle-minimal [57]
> > at
> >>>
> >>>
> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(Mo
> >>> duleImpl.java:812)>
> > at
> > org.apache.felix.framework.ModuleImpl.access$

Re: Custom interceptors with DOSGi

2012-01-16 Thread Freeman Fang

Hi,

Another general solution to workaround this class.forname issue in  
OSGi world is create your customer bundle as a fragment bundle, and  
attach it to the cxf bundle(cxf bundle play the role as a host  
bundle), so that all fragment bundle resource is available for host  
bundle.
We usually use it to resolve the issue in JDBC driver bundle,  which  
has similar situation you encountered here, some bundle(like spring- 
jdbc or commons-dbcp) need use class.forname to init  driver classes  
from JDBC driver bundle, but there's no way that can import such  
package beforehand(as jdbc driver can from any provider and there's no  
way to know the package name beforehand), so make jdbc driver as  
fragment bundle and attach it to spring-jdbc or commons-dbcp can  
resolve it.
This is actually a legacy class.forname issue before we have OSGi  
concept and I totally agree that in CXF we should get rid of the  
class.forname as much as possible.


Freeman
On 2012-1-17, at 上午9:28, gaygeek wrote:


Dan and Sergey-

Thanks for your responses. I locally modified the cxf 2.5.2-SNAPSHOT
AnnotationInterceptors class and the interceptor annotations to  
allow class
objects to be set in the annotations as Dan suggested and that will  
work
very well. Instead of needing the classloader to find the classes by  
name,
you just need to do clazz.newInstance(). I prefer using annotations  
for

setting the interceptors, but I also think having the option in DOSGi
configuration is also a great idea. Do you think this change could  
make it

into the 2.5.2 cxf release?

Thanks,
Jeff

On Mon, Jan 16, 2012 at 5:22 PM, Sergey Beryozkin-5 [via CXF] <
ml-node+s547215n515016...@n5.nabble.com> wrote:


Dan, thanks for the fix/enhancement, I also updated DOSGi
to check for custom interceptors & features passed along during the
registration/lookup, possibly already instantiated, and also from
Declarative Services...for WS & RS

Just stopped short of also starting the trackers, may be later :-)

Sergey
On 16/01/12 16:03, Daniel Kulp wrote:


On Monday, January 16, 2012 7:33:45 AM gaygeek wrote:
Yes--as you said, the export is there in my custom bundle, but  
the cxf

bundle has no way to import it to create the interceptor instance.

Are you saying there is currently a way to do this, or that DOSGi  
will

need
to be modified to allow custom interceptors? I think you are  
saying it

is

not available currently, but that it would probably need to be a

property

on the osgi service export configuration.


One thing we COULD try doing is updating the Annotations we have to

actually

support using Class objects.  Right now, we have:

public @interface InInterceptors {
String[] interceptors();
}

which means we need to do Class.forName things.   We could expand  
this

to:


public @interface InInterceptors {
String[] interceptors();
Class[]  classes();
}

or similar so that you could annotate with the actual class  
objects and

not

have to deal with the classloaders in OSGi.

Dan





Thanks,
Jeff

On Mon, Jan 16, 2012 at 8:37 AM, Sergey Beryozkin-5 [via CXF]<

[hidden email] >

wrote:
Ignore that please, keeping forgetting the cxf bundle does not  
import

custom classes/

I think in DOSGi case, a new property would have to be  
introduced in

time for custom CXF interceptors be picked up

Cheers, Sergey

On 16/01/12 12:25, Sergey Beryozkin wrote:
Does the custom bundle export  
"com.uhg.upm.webservice.interceptor" ?


Sergey

On 13/01/12 22:36, gaygeek wrote:

I am trying to configure a custom interceptor for a web service
I'm
exposing
with DOSGi. However, it seems that the interceptor cannot be
initialized via
annotation, as the org.apache.cxf.bundle-minimal does not have
access
to my
custom interceptor class from its bundle classloader. I get the


following


error when starting my bundle with the service in it (which DOES
have
access
to the package that my SoapFaultInterceptor is in). It seems  
like

the
only
way to make it work would be to hack the MANIFEST.MF for the
org.apache.cxf.bundle-minimal to import my bundle with the  
custom

interceptor.

Is there a different way to configure custom interceptors with
DOSGi?
Or am
I missing something in order to allow the annotations to work?

Annotations for the WebService interface:
@WebService(name = "HelloService", targetNamespace =
"http://upm.uhc.com/example/hello";)
@OutFaultInterceptors(interceptors =
{"com.uhg.upm.webservice.interceptor.SoapFaultInterceptor"})
public interface HelloService

Exception when starting my bundle with the HelloService in it:
Exception in thread "pool-1-thread-4"
org.apache.cxf.interceptor.Fault: Could not create annotation
object:
com.uhg.upm.webservice.interceptor.SoapFaultInterceptor
at



org 
.apache.cxf.interceptor.AnnotationInterceptors.initializeAnnotationOb

jects(AnnotationInterceptors.java:79)>

at



org 
.apache.cxf.interceptor.AnnotationInterceptors.getAnnotationObject

Re: Custom interceptors with DOSGi

2012-01-16 Thread gaygeek
Dan and Sergey-

Thanks for your responses. I locally modified the cxf 2.5.2-SNAPSHOT
AnnotationInterceptors class and the interceptor annotations to allow class
objects to be set in the annotations as Dan suggested and that will work
very well. Instead of needing the classloader to find the classes by name,
you just need to do clazz.newInstance(). I prefer using annotations for
setting the interceptors, but I also think having the option in DOSGi
configuration is also a great idea. Do you think this change could make it
into the 2.5.2 cxf release?

Thanks,
Jeff

On Mon, Jan 16, 2012 at 5:22 PM, Sergey Beryozkin-5 [via CXF] <
ml-node+s547215n515016...@n5.nabble.com> wrote:

> Dan, thanks for the fix/enhancement, I also updated DOSGi
> to check for custom interceptors & features passed along during the
> registration/lookup, possibly already instantiated, and also from
> Declarative Services...for WS & RS
>
> Just stopped short of also starting the trackers, may be later :-)
>
> Sergey
> On 16/01/12 16:03, Daniel Kulp wrote:
>
> > On Monday, January 16, 2012 7:33:45 AM gaygeek wrote:
> >> Yes--as you said, the export is there in my custom bundle, but the cxf
> >> bundle has no way to import it to create the interceptor instance.
> >>
> >> Are you saying there is currently a way to do this, or that DOSGi will
> need
> >> to be modified to allow custom interceptors? I think you are saying it
> is
> >> not available currently, but that it would probably need to be a
> property
> >> on the osgi service export configuration.
> >
> > One thing we COULD try doing is updating the Annotations we have to
> actually
> > support using Class objects.  Right now, we have:
> >
> > public @interface InInterceptors {
> >  String[] interceptors();
> > }
> >
> > which means we need to do Class.forName things.   We could expand this
> to:
> >
> > public @interface InInterceptors {
> >  String[] interceptors();
> >  Class[]  classes();
> > }
> >
> > or similar so that you could annotate with the actual class objects and
> not
> > have to deal with the classloaders in OSGi.
> >
> > Dan
> >
> >
> >
> >>
> >> Thanks,
> >> Jeff
> >>
> >> On Mon, Jan 16, 2012 at 8:37 AM, Sergey Beryozkin-5 [via CXF]<
> >>
> >> [hidden email] >
>  wrote:
> >>> Ignore that please, keeping forgetting the cxf bundle does not import
> >>> custom classes/
> >>>
> >>> I think in DOSGi case, a new property would have to be introduced in
> >>> time for custom CXF interceptors be picked up
> >>>
> >>> Cheers, Sergey
> >>>
> >>> On 16/01/12 12:25, Sergey Beryozkin wrote:
>  Does the custom bundle export "com.uhg.upm.webservice.interceptor" ?
> 
>  Sergey
> 
>  On 13/01/12 22:36, gaygeek wrote:
> > I am trying to configure a custom interceptor for a web service
> > I'm
> > exposing
> > with DOSGi. However, it seems that the interceptor cannot be
> > initialized via
> > annotation, as the org.apache.cxf.bundle-minimal does not have
> > access
> > to my
> > custom interceptor class from its bundle classloader. I get the
> >>>
> >>> following
> >>>
> > error when starting my bundle with the service in it (which DOES
> > have
> > access
> > to the package that my SoapFaultInterceptor is in). It seems like
> > the
> > only
> > way to make it work would be to hack the MANIFEST.MF for the
> > org.apache.cxf.bundle-minimal to import my bundle with the custom
> > interceptor.
> >
> > Is there a different way to configure custom interceptors with
> > DOSGi?
> > Or am
> > I missing something in order to allow the annotations to work?
> >
> > Annotations for the WebService interface:
> > @WebService(name = "HelloService", targetNamespace =
> > "http://upm.uhc.com/example/hello";)
> > @OutFaultInterceptors(interceptors =
> > {"com.uhg.upm.webservice.interceptor.SoapFaultInterceptor"})
> > public interface HelloService
> >
> > Exception when starting my bundle with the HelloService in it:
> > Exception in thread "pool-1-thread-4"
> > org.apache.cxf.interceptor.Fault: Could not create annotation
> > object:
> > com.uhg.upm.webservice.interceptor.SoapFaultInterceptor
> > at
> >>>
> >>>
> org.apache.cxf.interceptor.AnnotationInterceptors.initializeAnnotationOb
> >>> jects(AnnotationInterceptors.java:79)>
> > at
> >>>
> >>>
> org.apache.cxf.interceptor.AnnotationInterceptors.getAnnotationObject(An
> >>> notationInterceptors.java:48)>
> > at
> >>>
> >>>
> org.apache.cxf.interceptor.AnnotationInterceptors.getAnnotationIntercept
> >>> orList(AnnotationInterceptors.java:102)>
> > at
> >>>
> >>>
> org.apache.cxf.interceptor.AnnotationInterceptors.getOutFaultInterceptor
> >>> s(AnnotationInterceptors.java:122)>
> > ...
> > Caused by: java.lang.ClassNotFoundException:
> > com.uhg.upm.webservice.interceptor.SoapFaultInterceptor not f

Re: Custom interceptors with DOSGi

2012-01-16 Thread Sergey Beryozkin

Dan, thanks for the fix/enhancement, I also updated DOSGi
to check for custom interceptors & features passed along during the 
registration/lookup, possibly already instantiated, and also from 
Declarative Services...for WS & RS


Just stopped short of also starting the trackers, may be later :-)

Sergey
On 16/01/12 16:03, Daniel Kulp wrote:

On Monday, January 16, 2012 7:33:45 AM gaygeek wrote:

Yes--as you said, the export is there in my custom bundle, but the cxf
bundle has no way to import it to create the interceptor instance.

Are you saying there is currently a way to do this, or that DOSGi will need
to be modified to allow custom interceptors? I think you are saying it is
not available currently, but that it would probably need to be a property
on the osgi service export configuration.


One thing we COULD try doing is updating the Annotations we have to actually
support using Class objects.  Right now, we have:

public @interface InInterceptors {
 String[] interceptors();
}

which means we need to do Class.forName things.   We could expand this to:

public @interface InInterceptors {
 String[] interceptors();
 Class[]  classes();
}

or similar so that you could annotate with the actual class objects and not
have to deal with the classloaders in OSGi.

Dan





Thanks,
Jeff

On Mon, Jan 16, 2012 at 8:37 AM, Sergey Beryozkin-5 [via CXF]<

ml-node+s547215n5148873...@n5.nabble.com>  wrote:

Ignore that please, keeping forgetting the cxf bundle does not import
custom classes/

I think in DOSGi case, a new property would have to be introduced in
time for custom CXF interceptors be picked up

Cheers, Sergey

On 16/01/12 12:25, Sergey Beryozkin wrote:

Does the custom bundle export "com.uhg.upm.webservice.interceptor" ?

Sergey

On 13/01/12 22:36, gaygeek wrote:

I am trying to configure a custom interceptor for a web service
I'm
exposing
with DOSGi. However, it seems that the interceptor cannot be
initialized via
annotation, as the org.apache.cxf.bundle-minimal does not have
access
to my
custom interceptor class from its bundle classloader. I get the


following


error when starting my bundle with the service in it (which DOES
have
access
to the package that my SoapFaultInterceptor is in). It seems like
the
only
way to make it work would be to hack the MANIFEST.MF for the
org.apache.cxf.bundle-minimal to import my bundle with the custom
interceptor.

Is there a different way to configure custom interceptors with
DOSGi?
Or am
I missing something in order to allow the annotations to work?

Annotations for the WebService interface:
@WebService(name = "HelloService", targetNamespace =
"http://upm.uhc.com/example/hello";)
@OutFaultInterceptors(interceptors =
{"com.uhg.upm.webservice.interceptor.SoapFaultInterceptor"})
public interface HelloService

Exception when starting my bundle with the HelloService in it:
Exception in thread "pool-1-thread-4"
org.apache.cxf.interceptor.Fault: Could not create annotation
object:
com.uhg.upm.webservice.interceptor.SoapFaultInterceptor
at


org.apache.cxf.interceptor.AnnotationInterceptors.initializeAnnotationOb
jects(AnnotationInterceptors.java:79)>

at


org.apache.cxf.interceptor.AnnotationInterceptors.getAnnotationObject(An
notationInterceptors.java:48)>

at


org.apache.cxf.interceptor.AnnotationInterceptors.getAnnotationIntercept
orList(AnnotationInterceptors.java:102)>

at


org.apache.cxf.interceptor.AnnotationInterceptors.getOutFaultInterceptor
s(AnnotationInterceptors.java:122)>

...
Caused by: java.lang.ClassNotFoundException:
com.uhg.upm.webservice.interceptor.SoapFaultInterceptor not found
by
org.apache.cxf.bundle-minimal [57]
at


org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(Mo
duleImpl.java:812)>

at
org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:
72)

Thank you for any insight into this issue.

-Jeff

--



View this message in context:

http://cxf.547215.n5.nabble.com/Custom-interceptors-with-DOSGi-tp5143924
p5143924.html>

Sent from the cxf-user mailing list archive at Nabble.com.


--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com


--

  If you reply to this email, your message will be added to the
  discussion

below:

http://cxf.547215.n5.nabble.com/Custom-interceptors-with-DOSGi-tp5143924
p5148873.html>
  To unsubscribe from Custom interceptors with DOSGi, click
  here>
.
NAML

--
View 

Re: Custom interceptors with DOSGi

2012-01-16 Thread Daniel Kulp
On Monday, January 16, 2012 7:33:45 AM gaygeek wrote:
> Yes--as you said, the export is there in my custom bundle, but the cxf
> bundle has no way to import it to create the interceptor instance.
> 
> Are you saying there is currently a way to do this, or that DOSGi will need
> to be modified to allow custom interceptors? I think you are saying it is
> not available currently, but that it would probably need to be a property
> on the osgi service export configuration.

One thing we COULD try doing is updating the Annotations we have to actually 
support using Class objects.  Right now, we have:

public @interface InInterceptors {
String[] interceptors();
}

which means we need to do Class.forName things.   We could expand this to:

public @interface InInterceptors {
String[] interceptors();
Class[]  classes();
}

or similar so that you could annotate with the actual class objects and not 
have to deal with the classloaders in OSGi.

Dan



> 
> Thanks,
> Jeff
> 
> On Mon, Jan 16, 2012 at 8:37 AM, Sergey Beryozkin-5 [via CXF] <
> 
> ml-node+s547215n5148873...@n5.nabble.com> wrote:
> > Ignore that please, keeping forgetting the cxf bundle does not import
> > custom classes/
> > 
> > I think in DOSGi case, a new property would have to be introduced in
> > time for custom CXF interceptors be picked up
> > 
> > Cheers, Sergey
> > 
> > On 16/01/12 12:25, Sergey Beryozkin wrote:
> > > Does the custom bundle export "com.uhg.upm.webservice.interceptor" ?
> > > 
> > > Sergey
> > > 
> > > On 13/01/12 22:36, gaygeek wrote:
> > >> I am trying to configure a custom interceptor for a web service
> > >> I'm
> > >> exposing
> > >> with DOSGi. However, it seems that the interceptor cannot be
> > >> initialized via
> > >> annotation, as the org.apache.cxf.bundle-minimal does not have
> > >> access
> > >> to my
> > >> custom interceptor class from its bundle classloader. I get the
> > 
> > following
> > 
> > >> error when starting my bundle with the service in it (which DOES
> > >> have
> > >> access
> > >> to the package that my SoapFaultInterceptor is in). It seems like
> > >> the
> > >> only
> > >> way to make it work would be to hack the MANIFEST.MF for the
> > >> org.apache.cxf.bundle-minimal to import my bundle with the custom
> > >> interceptor.
> > >> 
> > >> Is there a different way to configure custom interceptors with
> > >> DOSGi?
> > >> Or am
> > >> I missing something in order to allow the annotations to work?
> > >> 
> > >> Annotations for the WebService interface:
> > >> @WebService(name = "HelloService", targetNamespace =
> > >> "http://upm.uhc.com/example/hello";)
> > >> @OutFaultInterceptors(interceptors =
> > >> {"com.uhg.upm.webservice.interceptor.SoapFaultInterceptor"})
> > >> public interface HelloService
> > >> 
> > >> Exception when starting my bundle with the HelloService in it:
> > >> Exception in thread "pool-1-thread-4"
> > >> org.apache.cxf.interceptor.Fault: Could not create annotation
> > >> object:
> > >> com.uhg.upm.webservice.interceptor.SoapFaultInterceptor
> > >> at
> > 
> > org.apache.cxf.interceptor.AnnotationInterceptors.initializeAnnotationOb
> > jects(AnnotationInterceptors.java:79)> 
> > >> at
> > 
> > org.apache.cxf.interceptor.AnnotationInterceptors.getAnnotationObject(An
> > notationInterceptors.java:48)> 
> > >> at
> > 
> > org.apache.cxf.interceptor.AnnotationInterceptors.getAnnotationIntercept
> > orList(AnnotationInterceptors.java:102)> 
> > >> at
> > 
> > org.apache.cxf.interceptor.AnnotationInterceptors.getOutFaultInterceptor
> > s(AnnotationInterceptors.java:122)> 
> > >> ...
> > >> Caused by: java.lang.ClassNotFoundException:
> > >> com.uhg.upm.webservice.interceptor.SoapFaultInterceptor not found
> > >> by
> > >> org.apache.cxf.bundle-minimal [57]
> > >> at
> > 
> > org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(Mo
> > duleImpl.java:812)> 
> > >> at
> > >> org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:
> > >> 72)
> > >> 
> > >> Thank you for any insight into this issue.
> > >> 
> > >> -Jeff
> > >> 
> > >> --
> > 
> > >> View this message in context:
> > http://cxf.547215.n5.nabble.com/Custom-interceptors-with-DOSGi-tp5143924
> > p5143924.html> 
> > >> Sent from the cxf-user mailing list archive at Nabble.com.
> > 
> > --
> > Sergey Beryozkin
> > 
> > Talend Community Coders
> > http://coders.talend.com/
> > 
> > Blog: http://sberyozkin.blogspot.com
> > 
> > 
> > --
> > 
> >  If you reply to this email, your message will be added to the
> >  discussion
> > 
> > below:
> > 
> > http://cxf.547215.n5.nabble.com/Custom-interceptors-with-DOSGi-tp5143924
> > p5148873.html> 
> >  To unsubscribe from Custom interceptors with DOSGi, click
> >  here >  nsubscribe_by_code&node=5143924&code=am1lbGJ5QGdtYWlsLmNvbXw1MTQzOTI0f
> >  C02NTQzMjczNTA=>> 
> > .
> > NAML > o_vie

Re: Custom interceptors with DOSGi

2012-01-16 Thread gaygeek
Yes--as you said, the export is there in my custom bundle, but the cxf
bundle has no way to import it to create the interceptor instance.

Are you saying there is currently a way to do this, or that DOSGi will need
to be modified to allow custom interceptors? I think you are saying it is
not available currently, but that it would probably need to be a property
on the osgi service export configuration.

Thanks,
Jeff

On Mon, Jan 16, 2012 at 8:37 AM, Sergey Beryozkin-5 [via CXF] <
ml-node+s547215n5148873...@n5.nabble.com> wrote:

> Ignore that please, keeping forgetting the cxf bundle does not import
> custom classes/
>
> I think in DOSGi case, a new property would have to be introduced in
> time for custom CXF interceptors be picked up
>
> Cheers, Sergey
>
> On 16/01/12 12:25, Sergey Beryozkin wrote:
>
> > Does the custom bundle export "com.uhg.upm.webservice.interceptor" ?
> >
> > Sergey
> >
> > On 13/01/12 22:36, gaygeek wrote:
> >> I am trying to configure a custom interceptor for a web service I'm
> >> exposing
> >> with DOSGi. However, it seems that the interceptor cannot be
> >> initialized via
> >> annotation, as the org.apache.cxf.bundle-minimal does not have access
> >> to my
> >> custom interceptor class from its bundle classloader. I get the
> following
> >> error when starting my bundle with the service in it (which DOES have
> >> access
> >> to the package that my SoapFaultInterceptor is in). It seems like the
> >> only
> >> way to make it work would be to hack the MANIFEST.MF for the
> >> org.apache.cxf.bundle-minimal to import my bundle with the custom
> >> interceptor.
> >>
> >> Is there a different way to configure custom interceptors with DOSGi?
> >> Or am
> >> I missing something in order to allow the annotations to work?
> >>
> >> Annotations for the WebService interface:
> >> @WebService(name = "HelloService", targetNamespace =
> >> "http://upm.uhc.com/example/hello";)
> >> @OutFaultInterceptors(interceptors =
> >> {"com.uhg.upm.webservice.interceptor.SoapFaultInterceptor"})
> >> public interface HelloService
> >>
> >> Exception when starting my bundle with the HelloService in it:
> >> Exception in thread "pool-1-thread-4" org.apache.cxf.interceptor.Fault:
> >> Could not create annotation object:
> >> com.uhg.upm.webservice.interceptor.SoapFaultInterceptor
> >> at
> >>
> org.apache.cxf.interceptor.AnnotationInterceptors.initializeAnnotationObjects(AnnotationInterceptors.java:79)
>
> >>
> >> at
> >>
> org.apache.cxf.interceptor.AnnotationInterceptors.getAnnotationObject(AnnotationInterceptors.java:48)
>
> >>
> >> at
> >>
> org.apache.cxf.interceptor.AnnotationInterceptors.getAnnotationInterceptorList(AnnotationInterceptors.java:102)
>
> >>
> >> at
> >>
> org.apache.cxf.interceptor.AnnotationInterceptors.getOutFaultInterceptors(AnnotationInterceptors.java:122)
>
> >>
> >> ...
> >> Caused by: java.lang.ClassNotFoundException:
> >> com.uhg.upm.webservice.interceptor.SoapFaultInterceptor not found by
> >> org.apache.cxf.bundle-minimal [57]
> >> at
> >>
> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:812)
>
> >>
> >> at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:72)
> >>
> >> Thank you for any insight into this issue.
> >>
> >> -Jeff
> >>
> >> --
> >> View this message in context:
> >>
> http://cxf.547215.n5.nabble.com/Custom-interceptors-with-DOSGi-tp5143924p5143924.html
> >>
> >> Sent from the cxf-user mailing list archive at Nabble.com.
> >
> >
>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
> Blog: http://sberyozkin.blogspot.com
>
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://cxf.547215.n5.nabble.com/Custom-interceptors-with-DOSGi-tp5143924p5148873.html
>  To unsubscribe from Custom interceptors with DOSGi, click 
> here
> .
> NAML
>


--
View this message in context: 
http://cxf.547215.n5.nabble.com/Custom-interceptors-with-DOSGi-tp5143924p5149014.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Custom interceptors with DOSGi

2012-01-16 Thread Sergey Beryozkin
Ignore that please, keeping forgetting the cxf bundle does not import 
custom classes/


I think in DOSGi case, a new property would have to be introduced in 
time for custom CXF interceptors be picked up


Cheers, Sergey

On 16/01/12 12:25, Sergey Beryozkin wrote:

Does the custom bundle export "com.uhg.upm.webservice.interceptor" ?

Sergey

On 13/01/12 22:36, gaygeek wrote:

I am trying to configure a custom interceptor for a web service I'm
exposing
with DOSGi. However, it seems that the interceptor cannot be
initialized via
annotation, as the org.apache.cxf.bundle-minimal does not have access
to my
custom interceptor class from its bundle classloader. I get the following
error when starting my bundle with the service in it (which DOES have
access
to the package that my SoapFaultInterceptor is in). It seems like the
only
way to make it work would be to hack the MANIFEST.MF for the
org.apache.cxf.bundle-minimal to import my bundle with the custom
interceptor.

Is there a different way to configure custom interceptors with DOSGi?
Or am
I missing something in order to allow the annotations to work?

Annotations for the WebService interface:
@WebService(name = "HelloService", targetNamespace =
"http://upm.uhc.com/example/hello";)
@OutFaultInterceptors(interceptors =
{"com.uhg.upm.webservice.interceptor.SoapFaultInterceptor"})
public interface HelloService

Exception when starting my bundle with the HelloService in it:
Exception in thread "pool-1-thread-4" org.apache.cxf.interceptor.Fault:
Could not create annotation object:
com.uhg.upm.webservice.interceptor.SoapFaultInterceptor
at
org.apache.cxf.interceptor.AnnotationInterceptors.initializeAnnotationObjects(AnnotationInterceptors.java:79)

at
org.apache.cxf.interceptor.AnnotationInterceptors.getAnnotationObject(AnnotationInterceptors.java:48)

at
org.apache.cxf.interceptor.AnnotationInterceptors.getAnnotationInterceptorList(AnnotationInterceptors.java:102)

at
org.apache.cxf.interceptor.AnnotationInterceptors.getOutFaultInterceptors(AnnotationInterceptors.java:122)

...
Caused by: java.lang.ClassNotFoundException:
com.uhg.upm.webservice.interceptor.SoapFaultInterceptor not found by
org.apache.cxf.bundle-minimal [57]
at
org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:812)

at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:72)

Thank you for any insight into this issue.

-Jeff

--
View this message in context:
http://cxf.547215.n5.nabble.com/Custom-interceptors-with-DOSGi-tp5143924p5143924.html

Sent from the cxf-user mailing list archive at Nabble.com.






--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com


Re: Custom interceptors with DOSGi

2012-01-16 Thread Sergey Beryozkin

Does the custom bundle export "com.uhg.upm.webservice.interceptor" ?

Sergey

On 13/01/12 22:36, gaygeek wrote:

I am trying to configure a custom interceptor for a web service I'm exposing
with DOSGi. However, it seems that the interceptor cannot be initialized via
annotation, as the org.apache.cxf.bundle-minimal does not have access to my
custom interceptor class from its bundle classloader. I get the following
error when starting my bundle with the service in it (which DOES have access
to the package that my SoapFaultInterceptor is in). It seems like the only
way to make it work would be to hack the MANIFEST.MF for the
org.apache.cxf.bundle-minimal to import my bundle with the custom
interceptor.

Is there a different way to configure custom interceptors with DOSGi? Or am
I missing something in order to allow the annotations to work?

Annotations for the WebService interface:
@WebService(name = "HelloService", targetNamespace =
"http://upm.uhc.com/example/hello";)
@OutFaultInterceptors(interceptors =
{"com.uhg.upm.webservice.interceptor.SoapFaultInterceptor"})
public interface HelloService

Exception when starting my bundle with the HelloService in it:
Exception in thread "pool-1-thread-4" org.apache.cxf.interceptor.Fault:
Could not create annotation object:
com.uhg.upm.webservice.interceptor.SoapFaultInterceptor
at
org.apache.cxf.interceptor.AnnotationInterceptors.initializeAnnotationObjects(AnnotationInterceptors.java:79)
at
org.apache.cxf.interceptor.AnnotationInterceptors.getAnnotationObject(AnnotationInterceptors.java:48)
at
org.apache.cxf.interceptor.AnnotationInterceptors.getAnnotationInterceptorList(AnnotationInterceptors.java:102)
at
org.apache.cxf.interceptor.AnnotationInterceptors.getOutFaultInterceptors(AnnotationInterceptors.java:122)
...
Caused by: java.lang.ClassNotFoundException:
com.uhg.upm.webservice.interceptor.SoapFaultInterceptor not found by
org.apache.cxf.bundle-minimal [57]
at
org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:812)
at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:72)

Thank you for any insight into this issue.

-Jeff

--
View this message in context: 
http://cxf.547215.n5.nabble.com/Custom-interceptors-with-DOSGi-tp5143924p5143924.html
Sent from the cxf-user mailing list archive at Nabble.com.



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com