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
SROAP02016 ClassNotFoundException for public enums #1508
Comments
Hi @scutaru , the scanner is attempting to get the value using the method annotated with |
No, I'm not |
Thanks. Was it working without warnings in an earlier version of Wildfly or is this your first attempt at deploying on Wildfly? |
I'm migrating it from Wildfly 26 to Wildfly 28. But I just checked and the same warnings were displayed in Wildfly 26 too: 2023-07-05 14:29:34,638 WARN [MSC service thread 1-7] [exchangeID=, sessionID=] (io.smallrye.openapi.runtime.io) SROAP02016: Failed to read enumeration values from enum com.example.ErrorSourceEnum method toString with So it's not that urgent anymore, but I'd still like to know how to fix it. |
@pferraro , do you have any insight on what could be the issue? I assume Wildfly modules cannot reflect on the application classes? Is there any work-around? |
@scutaru Do you have a full stack trace? Smallrye is trying to load the enum class from its own module rather than the deployment module, which is certainly wrong. @MikeEdgar Do you know offhand where this might be happening? |
@pferraro , this is the site where the class is loaded: smallrye-open-api/core/src/main/java/io/smallrye/openapi/runtime/io/schema/SchemaFactory.java Line 570 in c728c55
The class loader that is used would have been set by the client, in this case the integration code in Wildfly. This call to |
@MikeEdgar Thanks. The problem, as I see it, is that the ClassLoader provided to OpenApiAnnotationScanner serves two different roles: loading AnnotationScanner instances (via AnnotationScannerFactory) and loading application classes. |
Yes, I agree that something needs to change with this. For the second option you gave to bypass the service loading, are you suggesting that the platform would provide pre-constructed |
Either that, or allow it to provide its own AnnotationScannerFactory implementation (assuming this was an interface, or even just a Supplier<Iterable>) |
I opened https://issues.redhat.com/browse/WFLY-18224 and submitted wildfly/wildfly@25dd6bd to fix the issue until given the limitations of the current SPIs. |
Unfortunately that's the only problem that I see in the logs, nothing else. |
When I deploy my application in Wildfly 28.0.1 I get the following type of warnings for all the enums:
2023-07-04 13:37:38,516 WARN [MSC service thread 1-8] [exchangeID=, sessionID=] (io.smallrye.openapi.runtime.io) SROAP02016: Failed to read enumeration values from enum com.example.ErrorSourceEnum method toString with
@JsonValue
: java.lang.ClassNotFoundException: com.example.ErrorSourceEnum from [Module "io.smallrye.openapi" version 3.3.2 from local module loader @21ba0741 (finder: local module finder @58ce9668 (roots: /opt/jboss/wildfly-28.0.1.Final/modules,/opt/jboss/wildfly-28.0.1.Final/modules/system/layers/base))]The enum looks like below:
Any idea what could be wrong ?
The text was updated successfully, but these errors were encountered: