Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:<version>` (`solr-mcp:latest`).
Paketo native = `solr-mcp:<version>-native-stdio` /
`solr-mcp:<version>-native-http` (with corresponding `:latest-native-*` tags).
Expand Down
17 changes: 6 additions & 11 deletions dev-docs/graalvm-native-image.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@
/**
* GraalVM native image reachability hints for SolrJ types this project actually uses.
*
* <p>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.
* <p>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.
*
* <p>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
Expand Down
Loading