quarkusio/quarkus · error · RuntimeException
principal was null
Error message
principal was null
What it means
Sentinel check in an elytron-undertow integration-test servlet: after authenticated access, req.getUserPrincipal() (or its name) came back null, i.e. the security context did not carry the authenticated principal the test expects. This is a test-app assertion guard, not production code — the input at fault is the servlet request's security context.
Source
Thrown at integration-tests/elytron-undertow/src/main/java/io/quarkus/it/undertow/elytron/GreetingServlet.java:16
package io.quarkus.it.undertow.elytron;
import java.io.IOException;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@WebServlet(name = "ServletGreeting", urlPatterns = "/*")
public class GreetingServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
if (req.getUserPrincipal().getName() == null) {
throw new RuntimeException("principal was null");
}
resp.setStatus(200);
resp.addHeader("Content-Type", "text/plain");
resp.getWriter().write("hello");
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
if (req.getUserPrincipal().getName() == null) {
throw new RuntimeException("principal was null");
}
String name = req.getReader().readLine();
resp.setStatus(200);
resp.addHeader("Content-Type", "text/plain");
resp.getWriter().write("hello " + name);
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Authenticate the request before invoking the endpoint
- Verify the elytron/undertow security configuration secures the servlet url-pattern
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at integration-tests/elytron-undertow/src/main/java/io/quarkus/it/undertow/elytron/GreetingServlet.java:16 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/c868e43aaf4112d0.
Report an issue: GitHub.