quarkusio/quarkus · critical · IllegalStateException

You will very likely need support for Codepage Cp1252 to con

Error message

You will very likely need support for Codepage Cp1252 to connect to SQL Server

What it means

The MSSQL test endpoint requires the JVM to support the Cp1252 character set because the SQL Server JDBC driver/DB collation commonly needs it; if Charset.isSupported("Cp1252") is false it throws this IllegalStateException before running any test logic. On truncated JDK images or non-standard runtimes (e.g. some compact/native builds) the CPIK charset module may be absent.

Source

Thrown at integration-tests/jpa-mssql/src/main/java/io/quarkus/it/jpa/mssql/JPAFunctionalityTestEndpoint.java:35

import jakarta.ws.rs.core.MediaType;

import io.quarkus.narayana.jta.QuarkusTransaction;

/**
 * Basic test running JPA with the MS SQL database.
 * The application can work in either standard JVM or in native mode.
 */
@Path("/jpa-mssql/testfunctionality")
@Produces(MediaType.TEXT_PLAIN)
public class JPAFunctionalityTestEndpoint {

    @Inject
    EntityManager em;

    @GET
    public String test() throws IOException {
        if (!Charset.isSupported("Cp1252"))
            throw new IllegalStateException("You will very likely need support for Codepage Cp1252 to connect to SQL Server");

        cleanUpData();

        //Store some well known Person instances we can then test on:
        QuarkusTransaction.requiringNew().run(() -> {
            persistNewPerson("Gizmo");
            persistNewPerson("Quarkus");
            persistNewPerson("Hibernate ORM");
        });

        //Load all persons and run some checks on the query results:
        QuarkusTransaction.requiringNew().run(() -> {
            CriteriaBuilder cb = em.getCriteriaBuilder();

            CriteriaQuery<Person> cq = cb.createQuery(Person.class);
            Root<Person> from = cq.from(Person.class);
            cq.select(from).orderBy(cb.asc(from.get("name")));
            TypedQuery<Person> q = em.createQuery(cq);

View on GitHub (pinned to e1c734241f)

Solutions

  1. Use a full JDK that includes the jdk.charsets module (standard Temurin/Oracle/OpenJDK builds)
  2. Remove --limit-module restrictions that exclude jdk.charsets
  3. For native-image tests, ensure charsets are included (native-image.properties / -H:+AddAllCharsets or registering Cp1252)
  4. Verify with a quick program printing Charset.isSupported("Cp1252") before debugging further

Example fix

// before (jlink/custom runtime missing charsets)
jlink --add-modules java.se --output image  // ok, but custom limited lists drop jdk.charsets

// after
jlink --add-modules java.se,jdk.charsets --output image
Defensive patterns

Strategy: validation

Validate before calling

if (!Charset.isSupported("Cp1252")) {
    throw new IllegalStateException("Run on a full JDK including jdk.charsets");
}

Prevention

When it happens

Trigger: Running the jpa-mssql integration tests on a JVM lacking the jdk.charsets module or a minimized/limited charset build (e.g. custom runtime image, some GraalVM setups).

Common situations: Custom/jlink-trimmed JDK without jdk.charsets; unusual Linux distro JDK packages; running tests with a restricted --limit-modules list.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/77a133af51e32b39. Report an issue: GitHub.