diff --git a/AGENTS.md b/AGENTS.md index 72abf222..5f3efc40 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -324,9 +324,10 @@ buildpacks (`bootBuildImage -Pnative`). Key configuration: - **Resources**: `logback-spring.xml` (see Logging Architecture above), and SolrJ's `EnvToSyspropMappings.properties` / `DeprecatedSystemPropertyMappings.properties`, which `EnvUtils` loads in its static initializer -- **Wire format:** `SolrConfig` uses `XMLRequestWriter` instead of the default - `JavaBinRequestWriter`. The JavaBin binary codec uses deep reflection that would - require extensive additional native image hints. +- **Wire format:** `SolrConfig` reads JSON responses (`JsonResponseParser`) and sends + updates with `XMLRequestWriter` instead of the default `JavaBinRequestWriter`. Neither + is a native-image requirement: SolrJ's `JavaBinCodec` uses no reflection, and + `JavaBinResponseParser` passes `nativeTest -Pnative` with no extra hints. - **Docker tags:** Jib JVM = `solr-mcp:` (`solr-mcp:latest`). Paketo native = `solr-mcp:-native-stdio` / `solr-mcp:-native-http` (with corresponding `:latest-native-*` tags). diff --git a/dev-docs/graalvm-native-image.md b/dev-docs/graalvm-native-image.md index de0b7b37..2f38e424 100644 --- a/dev-docs/graalvm-native-image.md +++ b/dev-docs/graalvm-native-image.md @@ -129,18 +129,13 @@ it and must be registered by hand. They live in reflective surface in one reviewable place. The class is registered unconditionally; on the JVM path it is simply a no-op. -### Wire format choice underpins the small hint surface +### Wire format -`SolrConfig` deliberately builds the client to **avoid SolrJ's JavaBin codec**, -which uses deep reflection that would otherwise demand extensive native -metadata: - -- Responses use the **JSON** parser (`JsonResponseParser` on - `HttpJdkSolrClient`), not JavaBin. -- Updates use `XMLRequestWriter`, not the default `JavaBinRequestWriter`. - -Because the JavaBin path is never taken, the hints reduce to a narrow set of -container and value types. +`SolrConfig` builds the client with JSON responses (`JsonResponseParser` on +`HttpJdkSolrClient`) and `XMLRequestWriter` for updates, in place of SolrJ's +JavaBin defaults. The native image does not need either choice. SolrJ's +`JavaBinCodec` uses no reflection, and with `JavaBinResponseParser` swapped in, +`./gradlew nativeTest -Pnative` passes without adding a hint. ### What's registered, and why diff --git a/src/main/java/org/apache/solr/mcp/server/config/SolrConfig.java b/src/main/java/org/apache/solr/mcp/server/config/SolrConfig.java index 48df20e6..3f7c1790 100644 --- a/src/main/java/org/apache/solr/mcp/server/config/SolrConfig.java +++ b/src/main/java/org/apache/solr/mcp/server/config/SolrConfig.java @@ -178,8 +178,9 @@ private static SolrClient buildSolrClient( String url = parsed.resolve(path).toString(); // JSON wire format for responses; XML wire format for update requests. - // The default JavaBin request writer uses a binary codec that requires - // additional reflection metadata in GraalVM native images. + // XMLRequestWriter replaced the JavaBin default when native-image support + // was added, but the native image does not need it: JavaBinCodec uses no + // reflection. // Force HTTP/1.1: the JDK HttpClient's HTTP/2 transport intermittently // closes reused connections with an EOFException against Solr/Jetty. HttpJdkSolrClient.Builder builder = diff --git a/src/main/java/org/apache/solr/mcp/server/config/SolrNativeHints.java b/src/main/java/org/apache/solr/mcp/server/config/SolrNativeHints.java index 7fc28178..b7826233 100644 --- a/src/main/java/org/apache/solr/mcp/server/config/SolrNativeHints.java +++ b/src/main/java/org/apache/solr/mcp/server/config/SolrNativeHints.java @@ -36,10 +36,9 @@ /** * GraalVM native image reachability hints for SolrJ types this project actually uses. * - *

The project uses the JSON wire format (SolrJ {@code JsonResponseParser} on {@code - * HttpJdkSolrClient}), avoiding the JavaBin/XML codec paths that historically drive most SolrJ - * native-image issues. The hints below cover the narrow remaining surface: response containers and - * the {@code NamedList} admin shape returned by the mbeans path. + *

The client reads JSON responses through {@link JsonResponseParser} on {@code + * HttpJdkSolrClient}. The hints below cover response containers and the {@code NamedList} admin + * shape returned by the mbeans path. * *

This class is registered unconditionally — on the JVM path it is a no-op because no runtime * reflection happens against these types at startup. It is only meaningful when running as a native