Skip to content

Commit

Permalink
Require io.vertx.auth.common module (#2716)
Browse files Browse the repository at this point in the history
Currently, io.vertx.auth.common is required only for compilation.

However, it contains the io.vertx.ext.auth.audit.SecurityAudit class, that is used in io.vertx.ext.web.impl.RoutingContextImplBase.

Consequently, if users don't add the module requirement in their application, it fails when the first request is sent with:

Feb 07, 2025 10:54:29 AM io.vertx.core.impl.ContextImpl
SEVERE: Unhandled exception
java.lang.NoClassDefFoundError: Lio/vertx/ext/auth/audit/SecurityAudit;
        at java.base/java.lang.Class.getDeclaredFields0(Native Method)
        at java.base/java.lang.Class.privateGetDeclaredFields(Class.java:3061)
        at java.base/java.lang.Class.getDeclaredField(Class.java:2409)
        at java.base/java.util.concurrent.atomic.AtomicIntegerFieldUpdater$AtomicIntegerFieldUpdaterImpl$1.run(AtomicIntegerFieldUpdater.java:398)
        at java.base/java.util.concurrent.atomic.AtomicIntegerFieldUpdater$AtomicIntegerFieldUpdaterImpl$1.run(AtomicIntegerFieldUpdater.java:396)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/java.util.concurrent.atomic.AtomicIntegerFieldUpdater$AtomicIntegerFieldUpdaterImpl.<init>(AtomicIntegerFieldUpdater.java:395)
        at java.base/java.util.concurrent.atomic.AtomicIntegerFieldUpdater.newUpdater(AtomicIntegerFieldUpdater.java:94)
        at [email protected]/io.vertx.ext.web.impl.RoutingContextImplBase.<clinit>(RoutingContextImplBase.java:43)

So this is a buggy module declaration, because Auth Common is not only required by Vert.x Web during compilation, it's required at runtime.

Signed-off-by: Thomas Segismont <[email protected]>
  • Loading branch information
tsegismont authored Feb 10, 2025
1 parent 2fe3a35 commit 94d4175
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
1 change: 0 additions & 1 deletion vertx-web-openapi-router/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
requires static io.vertx.codegen.json;
requires static io.vertx.docgen;

requires static io.vertx.auth.common; // Examples
requires static io.vertx.auth.oauth2; // Examples
requires static io.vertx.auth.jwt; // Examples

Expand Down
1 change: 0 additions & 1 deletion vertx-web-openapi-router/src/test/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
requires org.junit.jupiter.params;
requires truth;
requires org.mockito;
requires io.vertx.auth.common;
requires static io.vertx.auth.oauth2;
requires static io.vertx.auth.jwt;
exports io.vertx.router.test.base;
Expand Down
4 changes: 3 additions & 1 deletion vertx-web/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
requires io.netty.codec.http;
requires com.fasterxml.jackson.core;

requires static io.vertx.auth.common;
// Required by Vert.x Web even when no Vert.x Auth handler is used
requires io.vertx.auth.common;

requires static io.vertx.auth.htdigest;
requires static io.vertx.auth.jwt;
requires static io.vertx.auth.otp;
Expand Down

0 comments on commit 94d4175

Please sign in to comment.