OpenAPI under TomEE 9 microprofile

Kean Erickson <[email protected]>
Newsgroups gmane.comp.java.openejb.user
Message-ID <CAPdwkmTQJPYx6af+LW3arFovKxMxfOZis9KbO=GX6Z4g=p58dA@mail.gmail.com>
Hello, I'm taking a stab at migrating my project to TomEE 9.0.0.RC. Tomcat
starts fine and logs are happy, but I'm receiving a 500 erorr with this
message when going to the /openapi URL. This is almost certainly a
configuration mistake on my part, but I was wondering if anyone could shed
some light on this. My setup worked properly under TomEE 8.

java.lang.NullPointerException: Cannot invoke
"org.eclipse.microprofile.openapi.models.OpenAPI.getOpenapi()" because
"model" is null
	io.smallrye.openapi.runtime.io.definition.DefinitionWriter.writeOpenAPI(DefinitionWriter.java:37)
	io.smallrye.openapi.runtime.io.OpenApiSerializer.serialize(OpenApiSerializer.java:37)
	org.apache.tomee.microprofile.openapi.MicroProfileOpenApiEndpoint.doGet(MicroProfileOpenApiEndpoint.java:50)
	jakarta.servlet.http.HttpServlet.service(HttpServlet.java:500)
	jakarta.servlet.http.HttpServlet.service(HttpServlet.java:587)
	org.apache.tomee.webservices.CXFJAXRSFilter.doFilter(CXFJAXRSFilter.java:88)
	io.smallrye.opentracing.contrib.jaxrs2.server.SpanFinishingFilter.doFilter(SpanFinishingFilter.java:69)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	org.apache.openejb.server.httpd.EEFilter.doFilter(EEFilter.java:67)
	io.smallrye.metrics.jaxrs.JaxRsMetricsServletFilter.doFilter(JaxRsMetricsServletFilter.java:53)


These are all the "provided" libraries in my pom. Am I including
microprofile.openapi correctly?

  <dependencies>
    <dependency>
      <groupId>jakarta.platform</groupId>
      <artifactId>jakarta.jakartaee-api</artifactId>
      <version>9.1.0</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>jakarta.platform</groupId>
      <artifactId>jakarta.jakartaee-web-api</artifactId>
      <version>9.1.0</version>
      cope>provided</scope>
    </dependency>
    <dependency>
      <groupId>jakarta.json.bind</groupId>
      <artifactId>jakarta.json.bind-api</artifactId>
      <version>3.0.0</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.microprofile.openapi</groupId>
      <artifactId>microprofile-openapi-api</artifactId>
      <version>3.0</version>
      <scope>provided</scope>
    </dependency>

This is the part in MicroProfileOpenApiRegistration that is failing. It
can't find the "model" from the serlvet context under a key called
"org.apache.tomee.microprofile.openapi.MicroProfileOpenApiRegistration.OpenAPI"

    public static OpenAPI getOpenApi(ServletContext servletContext) {
        Objects.requireNonNull(servletContext);
        return
(OpenAPI)servletContext.getAttribute(MicroProfileOpenApiRegistration.class.getName()
+ ".OpenAPI");
    }

Has the move to Smallrye impacted how I should include microprofile in my
project?

Thanks
-Kean
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.