Jaap, In my environment I do not use DS for the JaxrsApplication, thus my application class just extends Application with no additional methods for fields.
The application snippet below accepts a web form and produces plain text from the URL /foo/api/webhook and demonstrates a non-default context. karaf@root()> web:context-list Bundle ID │ Symbolic Name │ Context Path │ Context Name │ Rank │ Service ID │ Type │ Scope │ Registration Properties ──────────┼───────────────────────────────────────────────┼──────────────┼───────────────────────┼──────┼────────────┼─────────────┼───────────┼──────────────────────────────────────────────────────── 108 │ org.apache.cxf.cxf-rt-transports-http │ / │ default │ MAX │ 0 │ HttpService │ static* │ httpContext.id <http://httpcontext.id/>=default │ │ │ │ │ │ │ │ httpContext.path=/ │ │ │ │ │ │ │ │ osgi.http.whiteboard.context.httpservice=default │ │ │ │ │ │ │ │ osgi.http.whiteboard.context.path=/ 122 │ org.ops4j.pax.web.pax-web-extender-whiteboard │ / │ default │ 0 │ 0 │ Whiteboard │ static* │ osgi.http.whiteboard.context.name=default │ │ │ │ │ │ │ │ osgi.http.whiteboard.context.path=/ 97 │ org.apache.aries.jax.rs.whiteboard │ /foo/api │ context.forfooApi │ 0 │ 163 │ Whiteboard │ singleton │ osgi.http.whiteboard.context.name=context.forfooApi │ │ │ │ │ │ │ │ osgi.http.whiteboard.context.path=/foo/api karaf@root()> web:servlet-list Bundle ID │ Name │ Class │ Context Path(s) │ URLs │ Type │ Context Filter ──────────┼────────────────────────────┼──────────────────────────────────────────────────────────┼─────────────────┼────────┼─────────────┼────────────────────────────────────────────────────────── 97 │ cxf-servlet │ org.apache.aries.jax.rs.whiteboard.internal.Whiteboard$1 │ / │ /* │ Whiteboard │ (osgi.http.whiteboard.context.name=default) 97 │ cxf-servlet │ org.apache.aries.jax.rs.whiteboard.internal.Whiteboard$1 │ /foo/api │ /* │ Whiteboard │ (osgi.http.whiteboard.context.name=context.forfooApi) 108 │ cxf-osgi-transport-servlet │ org.apache.cxf.transport.servlet.CXFNonSpringServlet │ / │ /cxf/* │ HttpService │ - karaf@root()> *** * Rest application defining context /foo/api *** package com.example.foo.restapp; import javax.ws.rs.core.Application; import org.osgi.service.component.annotations.Component; import org.osgi.service.jaxrs.whiteboard.propertytypes.JaxrsApplicationBase; import org.osgi.service.jaxrs.whiteboard.propertytypes.JaxrsName; @Component(service=Application.class) @JaxrsName("fooApi") @JaxrsApplicationBase("/foo/api") public class FooApplication extends Application{ } *** * Rest endpoint for /foo/api/webhook *** ... @Path("/webhook") @Component( scope = PROTOTYPE) @JaxrsResource @JaxrsApplicationSelect("(osgi.jaxrs.name=fooApi)") public class IncommingWebHook { ... @POST @Produces(MediaType.TEXT_PLAIN) @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Path("/incommingMessage") public Response receiveWebHook(@FormParam(MESSAGE_SID) String messageSid) { ... } ... } > On Jan 23, 2023, at 10:05 AM, Jaap Gordijn <f...@gordijn.org> wrote: > > Paul, > > I have extended the Application class as follows: > > public class MyApplication extends Application { > > public Set<Class<?>> getClasses() { > HashSet<Class<?>> set = new HashSet<Class<?>>(); > set.add(Rest.class); > return set; > } > > } > > Now the endpoint resolves. > > But DS dependency injection does not work. > Is there something needed to switch this on? > > -- Jaap > >> -----Original Message----- >> From: Paul Spencer <paulspen...@mindspring.com> >> Sent: maandag 23 januari 2023 15:16 >> To: user@karaf.apache.org >> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect and >> @JSONRequired result in 404 >> >> Jaap, >> JaxrsApplicationBase is used with JaxrsApplicationSelect to is required to >> use >> a non-default context, so your results confirm the default context is >> working. >> >> Paul Spencer >> >>> On Jan 23, 2023, at 9:08 AM, Jaap Gordijn <f...@gordijn.org> wrote: >>> >>> Paul, >>> >>> I did the following to create the application. >>> >>> @Component(service=Application.class, property = >>> {"servlet.init.hide-service-list-page=true"} ) >>> @JaxrsApplicationBase("example") >>> @JaxrsName("MyApplication") >>> public class MyApplication extends Application { >>> >>> } >>> >>> The strange thing is at that if I remove the @JaxrsApplicationSelect in the >> Rest service class, then it works. But not with the Application class. >>> >>> -- Jaap >>> >>>> -----Original Message----- >>>> From: Paul Spencer <paulspen...@mindspring.com> >>>> Sent: maandag 23 januari 2023 14:11 >>>> To: user@karaf.apache.org >>>> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect and >>>> @JSONRequired result in 404 >>>> >>>> Jaap, >>>> Have you created the Jaxrs application? >>>> >>>> @Component(service=Application.class) >>>> @JaxrsName("MyApplication") >>>> @JaxrsApplicationBase("/example") >>>> public class MyApp extends Application{ >>>> >>>> } >>>> >>>> Paul Spencer >>>> >>>>>> On Jan 23, 2023, at 7:39 AM, Jaap Gordijn <f...@gordijn.org> wrote: >>>>> >>>>> Paul, >>>>> >>>>> I used the features as you suggested. >>>>> >>>>> In the log, I see that the Jetty container starts. >>>>> Also the context path is registered: >>>>> Registering >>>>> OsgiServletContext{model=OsgiContextModel{WB,id=OCM- >>>> 5,name='context.fo >>>>> rMyApplication',path='/example',bundle=org.apache.aries.jax.rs.white >>>>> bo ard,ref=[org.osgi.service.http.context.ServletContextHelper]}} as >>>>> OSGi service for "/example" context pat >>>>> >>>>> But then I get this: >>>>> org.apache.cxf.cxf-rt-transports-http - 3.5.5 | Can't find the >>>>> request for http://172.20.116.137:8181/example/person's Observer >>>>> >>>>> Best, >>>>> >>>>> -- Jaap >>>>> >>>>>> -----Original Message----- >>>>>> From: Paul Spencer <paulspen...@mindspring.com> >>>>>> Sent: maandag 23 januari 2023 13:13 >>>>>> To: user@karaf.apache.org >>>>>> Subject: Re: aries-jax-rs-whiteboard with @JaxrsApplicationSelect >>>>>> and @JSONRequired result in 404 >>>>>> >>>>>> Jaap, >>>>>> 1) You can use the web: commands to verify the expected context >>>>>> exists >>>>>> 2) Review karaf.log to verify the the bundle startup and post >>>>>> relevant errors >>>>>> 3) I use the following features: >>>>>> <feature>jackson</feature> >>>>>> <feature>pax-web-http-whiteboard</feature> >>>>>> <feature>aries-jax-rs-whiteboard</feature> >>>>>> <feature>aries-jax-rs-whiteboard-jackson</feature> >>>>>> >>>>>> Paul Spencer >>>>>> >>>>>>>> On Jan 23, 2023, at 4:49 AM, Jaap Gordijn <f...@gordijn.org> wrote: >>>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> I have a problem with aries-jax-rs-whiteboard and the use of >>>>>>> @JaxrsApplicationSelect and @JSONRequired in combination. >>>>>>> That results in an inaccessible service (404). >>>>>>> If I disable the JSON annotations, the /test service works (via >>>>>>> /example/text >>>>>>> >>>>>>> Code: >>>>>>> >>>>>>> @Component(service = Rest.class, scope = ServiceScope.PROTOTYPE) >>>>>>> @JaxrsResource @JaxrsApplicationSelect("(" + >>>>>>> JaxrsWhiteboardConstants.JAX_RS_NAME + >>>>>>> "=MyApplication)") >>>>>>> @JSONRequired >>>>>>> @Produces(MediaType.APPLICATION_JSON) >>>>>>> public class Rest { >>>>>>> >>>>>>> @Reference(scope=ReferenceScope.PROTOTYPE_REQUIRED) >>>>>>> private volatile PersonService personService; >>>>>>> >>>>>>> @GET >>>>>>> @Path("/person") >>>>>>> public List<PersonDto> listPersons() { >>>>>>> return personService.select(); } >>>>>>> >>>>>>> @GET >>>>>>> @Path("/test") >>>>>>> public String test() { >>>>>>> return "test"; >>>>>>> } >>>>>>> } >>>>>>> >>>>>>> @Component(service=Application.class, property = >>>>>>> {"servlet.init.hide-service-list-page=true"} ) >>>>>>> @JaxrsApplicationBase("example") >>>>>>> @JaxrsName("MyApplication") >>>>>>> public class MyApplication extends Application { >>>>>>> >>>>>>> } >>>>>>> >>>>>>> >>>>>>> <repository>mvn:org.apache.cxf.karaf/apache- >> cxf/3.5.5/xml/features >>>>>>> </ >>>>>>> re >>>>>>> posito >>>>>>> ry> >>>>>>> >>>>>>> <repository>mvn:org.apache.aries.jax.rs/org.apache.aries.jax.rs.fe >>>>>>> at >>>>>>> ur >>>>>>> es/2.0 >>>>>>> .2/xml</repositor >>>>>>> .... >>>>>>> <feature>hibernate</feature> >>>>>>> <feature>hibernate-validator</feature> >>>>>>> ... >>>>>>> >>>>>>> I use Karaf 4.4.3 >>>>>>> >>>>>>> Any ideas? >>>>>>> >>>>>>> Best, >>>>>>> >>>>>>> -- Jaap >>>>>>> >>>>> >>> >