Hello Francois, One thing I noticed when switching to microprofile is that openapi became more strict and wouldn't document resources unless they have a @Produces and @Consumes at class level. So I set json as the default for both on each of those classes, and override where needed.
@Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) That was a while ago but it still seems like removing those class level annotations results in the APIs not being included by openapI. On Tue, Apr 2, 2024, 3:51 AM COURTAULT Francois <francois.courta...@thalesgroup.com.invalid> wrote: > THALES GROUP LIMITED DISTRIBUTION to email recipients > > Hello everyone, > > Context: TomEE 9.1.2 micro-profile flavor. > > I have raised an issue in another POST (Some issues with simple rest > application). > > This time: > > * I add a new class which extends Application. > @ApplicationPath("myapp") > > public class MyApp extends Application { > } > > * The previous Root resource is still there > @Path("myresource") > public class MyResource { > > @GET > public Response test() { > > return Response.ok().build(); > > } > > } > > * I remove web.xml from the war or the web.xml is empty (eg no servlet > declared) > > By doing so, I think I am still compliant to the spec: > > * “If an Application subclass is present…”: this the case > * “If no servlet handles this application”: web.xml removed: this is > the case > * “When an Application subclass is present in the archive, if both > Application.getClasses > and Application.getSingletons return an empty collection (default > implementation so this is the case) then > all root resource classes and providers packaged in the web application > MUST be included > and the JAX-RS implementation is REQUIRED to discover them automatically > by scanning a .war as described above” > > But when I startup TomEE micro-profile, I got: > 02-Apr-2024 12:04:57.650 INFO [main] > org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints REST > Application: http://localhost:8080/JAXRS/ -> > org.apache.openejb.server.rest.InternalApplication@19f9287a<mailto: > org.apache.openejb.server.rest.InternalApplication@19f9287a> > 02-Apr-2024 12:04:57.654 INFO [main] > org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints > Service URI: http://localhost:8080/JAXRS/health -> Pojo > org.apache.tomee.microprofile.health.MicroProfileHealthChecksEndpoint > 02-Apr-2024 12:04:57.654 INFO [main] > org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints > GET http://localhost:8080/JAXRS/health -> Response > getChecks() > 02-Apr-2024 12:04:57.654 INFO [main] > org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints > GET http://localhost:8080/JAXRS/health/live -> Response > getLiveChecks() > 02-Apr-2024 12:04:57.654 INFO [main] > org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints > GET http://localhost:8080/JAXRS/health/ready -> Response > getReadyChecks() > 02-Apr-2024 12:04:57.654 INFO [main] > org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints > GET http://localhost:8080/JAXRS/health/started -> Response > getStartedChecks() > > No GET on a path with myresource or myapp ☹ > What’s wrong in my understanding of the spec ? > > For curiosity, I deployed the very same war on TomEE 8.0.16 micro-profile. > This time I got: > 02-Apr-2024 12:44:37.179 INFO [main] > org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints REST > Application: http://localhost:8080/JAXRS/myapp > -> jaxrs.skeleton.MyApp@7c39193f<mailto:jaxrs.skeleton.MyApp@7c39193f> > 02-Apr-2024 12:44:37.181 INFO [main] > org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints > Service URI: http://localhost:8080/JAXRS/myapp/health > -> Pojo > org.apache.geronimo.microprofile.impl.health.cdi.CdiHealthChecksEndpoint > 02-Apr-2024 12:44:37.182 INFO [main] > org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints > GET http://localhost:8080/JAXRS/myapp/health -> > Response getChecks() > 02-Apr-2024 12:44:37.185 INFO [main] > org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints > Service URI: http://localhost:8080/JAXRS/myapp/metrics > -> Pojo org.apache.geronimo.microprofile.metrics.jaxrs.CdiMetricsEndpoints > 02-Apr-2024 12:44:37.185 INFO [main] > org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints > GET http://localhost:8080/JAXRS/myapp/metrics -> > Object getJson(SecurityContext, UriInfo) > 02-Apr-2024 12:44:37.185 INFO [main] > org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints > GET http://localhost:8080/JAXRS/myapp/metrics -> > String getText(SecurityContext, UriInfo) > 02-Apr-2024 12:44:37.185 INFO [main] > org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints > GET http://localhost:8080/JAXRS/myapp/metrics/{registry}< > http://localhost:8080/JAXRS/myapp/metrics/%7bregistry%7d> -> > Object getJson(String, SecurityContext, UriInfo) > 02-Apr-2024 12:44:37.186 INFO [main] > org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints > GET http://localhost:8080/JAXRS/myapp/metrics/{registry}< > http://localhost:8080/JAXRS/myapp/metrics/%7bregistry%7d> -> > String getText(String, SecurityContext, UriInfo) > 02-Apr-2024 12:44:37.186 INFO [main] > org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints > GET http://localhost:8080/JAXRS/myapp/metrics/{registry}/{metric}< > http://localhost:8080/JAXRS/myapp/metrics/%7bregistry%7d/%7bmetric%7d> > -> Object getJson(String, String, SecurityContext, UriInfo) > 02-Apr-2024 12:44:37.186 INFO [main] > org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints > GET http://localhost:8080/JAXRS/myapp/metrics/{registry}/{metric}< > http://localhost:8080/JAXRS/myapp/metrics/%7bregistry%7d/%7bmetric%7d> > -> String getText(String, String, SecurityContext, UriInfo) > 02-Apr-2024 12:44:37.186 INFO [main] > org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints > OPTIONS http://localhost:8080/JAXRS/myapp/metrics/{registry}< > http://localhost:8080/JAXRS/myapp/metrics/%7bregistry%7d> -> > Object getMetadata(String, SecurityContext, UriInfo) > 02-Apr-2024 12:44:37.186 INFO [main] > org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints > OPTIONS http://localhost:8080/JAXRS/myapp/metrics/{registry}/{metric}< > http://localhost:8080/JAXRS/myapp/metrics/%7bregistry%7d/%7bmetric%7d> > -> Object getMetadata(String, String, SecurityContext, UriInfo) > 02-Apr-2024 12:44:37.186 INFO [main] > org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints > Service URI: http://localhost:8080/JAXRS/myapp/myresource > -> Pojo jaxrs.skeleton.MyResource > 02-Apr-2024 12:44:37.186 INFO [main] > org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints > GET http://localhost:8080/JAXRS/myapp/myresource -> > Response test() > 02-Apr-2024 12:44:37.186 INFO [main] > org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints > Service URI: http://localhost:8080/JAXRS/myapp/openapi > -> Pojo org.apache.geronimo.microprofile.openapi.jaxrs.OpenAPIEndpoint > 02-Apr-2024 12:44:37.186 INFO [main] > org.apache.openejb.server.cxf.rs.CxfRsHttpListener.logEndpoints > GET http://localhost:8080/JAXRS/myapp/openapi -> > OpenAPI get() > > which is fine. > > Big issue on TomEE 9.1.2 micro-profile ? > > Best Regards. > > > >