Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Payara Micro 5.2020.5: OpenAPI document creation failed / FISH-760 #4955

Closed
Herr-Sepp opened this issue Oct 16, 2020 · 13 comments · Fixed by #5065
Closed

Payara Micro 5.2020.5: OpenAPI document creation failed / FISH-760 #4955

Herr-Sepp opened this issue Oct 16, 2020 · 13 comments · Fixed by #5065
Assignees
Labels
Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev Type: Bug Label issue as a bug defect

Comments

@Herr-Sepp
Copy link

Description


I was hoping that in 5.2020.5 the OpenAPI bugs are fixed(#4832) , unfortunately I still get the null pointer exception on first call of /openapi.

Maybe it's the old problem again that the micro-docker container doesn't contain the right version?
Because:

java -jar .\payara-micro-5.2020.5.jar --version
Payara Micro 5.2020.4-SNAPSHOT. Build Number 942

Expected Outcome

Response 200 with OpenAPI-Document

Current Outcome

404 Not Found

[2020-10-16T14:44:55.187+0200] [] [WARNING] [] [fish.payara.microprofile.openapi.impl.rest.app.service.OpenApiResource] [tid: _ThreadID=86 _ThreadName=http-thread-pool::http-listener(4)] [timeMillis: 1602852295187] [levelValue: 900] [[
  OpenAPI document creation failed.
fish.payara.microprofile.openapi.api.OpenAPIBuildException: java.lang.NullPointerException
        at fish.payara.microprofile.openapi.impl.OpenApiService$OpenApiMapping.buildDocument(OpenApiService.java:304)
        at fish.payara.microprofile.openapi.impl.OpenApiService$OpenApiMapping.access$200(OpenApiService.java:257)
        at fish.payara.microprofile.openapi.impl.OpenApiService.getDocument(OpenApiService.java:212)
        at fish.payara.microprofile.openapi.impl.rest.app.service.OpenApiResource.getResponse(OpenApiResource.java:80)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)
        at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$$Lambda$297/000000009E82B4B0.invoke(Unknown Source)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:124)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:167)
        at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:176)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:79)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:469)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:391)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:80)
        at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:253)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265)
        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:232)
        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:680)
        at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:394)
        at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:346)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:366)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:319)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:205)
        at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1636)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:331)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:211)
        at org.glassfish.tyrus.servlet.TyrusServletFilter.doFilter(TyrusServletFilter.java:282)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:253)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:211)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:757)
        at org.apache.catalina.core.StandardPipeline.doChainInvoke(StandardPipeline.java:581)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:158)
        at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:371)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:238)
        at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:520)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:217)
        at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:182)
        at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:156)
        at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:218)
        at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:95)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:260)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:177)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:109)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:88)
        at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:53)
        at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:524)
        at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:89)
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:94)
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:33)
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:114)
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569)
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549)
        at java.lang.Thread.run(Thread.java:823)
Caused by: java.lang.NullPointerException
        at fish.payara.microprofile.openapi.impl.model.OperationImpl.merge(OperationImpl.java:304)
        at fish.payara.microprofile.openapi.impl.processor.ApplicationProcessor.visitOperation(ApplicationProcessor.java:677)
        at fish.payara.microprofile.openapi.impl.visitor.OpenApiWalker$$Lambda$823/0000000044157810.apply(Unknown Source)
        at fish.payara.microprofile.openapi.impl.visitor.OpenApiWalker.processAnnotation(OpenApiWalker.java:168)
        at fish.payara.microprofile.openapi.impl.visitor.OpenApiWalker.processAnnotation(OpenApiWalker.java:131)
        at fish.payara.microprofile.openapi.impl.visitor.OpenApiWalker.accept(OpenApiWalker.java:120)
        at fish.payara.microprofile.openapi.impl.processor.ApplicationProcessor.process(ApplicationProcessor.java:153)
        at fish.payara.microprofile.openapi.impl.OpenApiService$OpenApiMapping.buildDocument(OpenApiService.java:300)
        ... 63 more
]]

[2020-10-16T14:44:55.191+0200] [] [INFO] [] [fish.payara.microprofile.openapi.impl.rest.app.service.OpenApiResource] [tid: _ThreadID=86 _ThreadName=http-thread-pool::http-listener(4)] [timeMillis: 1602852295191] [levelValue: 800] No OpenAPI document found.

If i request /openapi again then i get the document back, but many endpoints are missing.

Environment

  • Payara Version: 5.2020.5
  • Edition: Micro
  • JDK Version: adoptjdk: jre8u265-b01_openj9-0.21.0
  • Operating System: Linux (Alpine)
  • Database: SQL-Server
@VeitWeber
Copy link

In my case this works in 5.2020.4 but not in 5.2020.5.

@rdebusscher
Copy link

Hi,

Can you link to a reproducer that shows this behavior so that we can investigate this further.

Best Regards
Rudy

@AlanRoth AlanRoth added the Status: Abandoned User has not supplied reproducers for bug report, soon to be closed if user doesn’t come back label Nov 11, 2020
@AlanRoth
Copy link

Hi @Herr-Sepp, can you provide a simple to follow scenario how to reproduce this on the latest release of Payara Community Edition? A reproducer should ideally follow the SSCCE rules: http://www.sscce.org/. It will greatly help us to find the cause and fix it.

@ThomasPr
Copy link

I get the very same exception since upgrading from 5.2020.4 to 5.2020.6. Will try to provide a reproducer in the next couple of days.

@fturizo fturizo added Status: Pending Waiting on the issue requester to give more details or share a reproducer and removed status:reproducer-needed labels Nov 11, 2020
@fturizo fturizo assigned AlanRoth and unassigned rdebusscher Nov 11, 2020
@fturizo fturizo added Type: Bug Label issue as a bug defect and removed Status: Abandoned User has not supplied reproducers for bug report, soon to be closed if user doesn’t come back labels Nov 11, 2020
@VeitWeber
Copy link

It does not seem to be very easy to reproduce. I tried to build a simple example with only one REST resource two response and two response objects and the OpenAPI document is created. Our full application with > 15 resources and many request and response objects fails on 2020.5 & 2020.6

Maybe @ThomasPr has more luck.

@AlanRoth
Copy link

Hi @ThomasPr, have you had any luck with a reproducer? I'm keeping this issue open longer than usual incase you have came up with a reproducer - otherwise we will have to close this issue soon due to lack of reproducer.

@Herr-Sepp
Copy link
Author

I have the same problem.
Some relative easy example that I build for this issue work fine but not our full project.
Unfortunately I haven't found the time yet to investigate further what the problem might be.

@VeitWeber
Copy link

VeitWeber commented Nov 16, 2020

I think I found a way to reproduce it. In my case it's an enum in an @Schema annotated object.

@Schema(
		name = "UserImportRequest",
		description = "User import as base64 encoded CSV file",
		type = SchemaType.OBJECT
)
@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
@EqualsAndHashCode
public class UserImportRequest {
	@Schema(description = "Import action 'INS'->Insert, 'UPD'->Update, 'DEL'-> Delete")
	CsvAction action;
}
public enum CsvAction {
	INS("ins"),
	UPD("upd"),
	DEL("del");

	private final String literal;

	private static final Map<String, CsvAction> ENUM_MAP;

	CsvAction(String literal) {
		this.literal = literal;
	}

	public String getLiteral() {
		return this.literal;
	}


	static {
		Map<String, CsvAction> map = new ConcurrentHashMap<>();
		for (CsvAction instance : CsvAction.values()) {
			map.put(instance.getLiteral(), instance);
		}
		ENUM_MAP = Collections.unmodifiableMap(map);
	}

	public static CsvAction get(String literal) {
		return ENUM_MAP.get(literal);
	}
}

Works in 2020.4 but not in 2020.6

I'm going to create a repo for this reproducer.

@hei1233212000
Copy link

I created a quick demo to show the issue
https://github.com/hei1233212000/payara-micro-openapi-broken

I found that the issue would be occurred when there is an endpoint require a request body and the request body contains an Enum field

@hei1233212000
Copy link

@VeitWeber also spotted on the Enum, so it may be really the root cause :)

@VeitWeber
Copy link

Just for the records, because the use case is slightly different than @hei1233212000 's one.

https://github.com/VeitWeber/pay4955

I don't even use the Enum in the request.

@AlanRoth
Copy link

Hi All,

Thank you for the quick responses, I have been able to reproduce this issue with both @VeitWeber and @hei1233212000's reproducer with the latest version. I have created an internal issue FISH-760.

Thank you,
Alan

@AlanRoth AlanRoth added Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev and removed Status: Pending Waiting on the issue requester to give more details or share a reproducer labels Nov 16, 2020
@AlanRoth AlanRoth changed the title Payara Micro 5.2020.5: OpenAPI document creation failed Payara Micro 5.2020.5: OpenAPI document creation failed / FISH-760 Nov 16, 2020
@MattGill98
Copy link
Contributor

Hi,

I closed this issue as it is solved by the OpenAPI 2.0 upgrade which included a patch to correctly handle Enums. To be clear, this issue was caused by the presence of the Enum (regardless of whether it's used by endpoints).

You may also be interested in #5130, as OpenAPI applications without @Path annotated endpoints weren't being discovered, so an empty OpenAPI document would be returned.

Best regards,

Matt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev Type: Bug Label issue as a bug defect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants