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 <[email protected]> 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.forMyApplication',path='/example',bundle=org.apache.aries.jax.rs.whiteboard,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 <[email protected]>
>> Sent: maandag 23 januari 2023 13:13
>> To: [email protected]
>> 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 <[email protected]> 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.featur
>>> es/2.0
>>> .2/xml</repositor
>>> ....
>>> <feature>hibernate</feature>
>>> <feature>hibernate-validator</feature>
>>> ...
>>>
>>> I use Karaf 4.4.3
>>>
>>> Any ideas?
>>>
>>> Best,
>>>
>>> -- Jaap
>>>
>