THausherr commented on PR #2894:
URL: https://github.com/apache/tika/pull/2894#issuecomment-4717672436
here's what copilot wrote about the fail:
===
The failure is in **`tika-pipes-solr-integration-tests`**, specifically:
- **Test:**
`org.apache.tika.pipes.solr.tests.TikaPipesSolr8ZkTest.testPipesIteratorWithSolrUrls`
- **Error:** `ClassNotFoundException:
org.apache.solr.client.solrj.impl.ZkClientClusterStateProvider`
- **Job:** `81576009080`
- **Ref:** `a8f8898752453ea5ccbbbcb264f1915159cc15c5`
- **Workflow:** `.github/workflows/main-jdk17-build.yml`
### Root cause
The test/runtime code expects SolrJ class `ZkClientClusterStateProvider`,
which is not available in the SolrJ version resolved on classpath (API
moved/removed across Solr versions). This is a **version compatibility break**
between test code and dependency set for this PR/job.
### Solution
Update the ZK-based Solr client initialization to use the newer SolrJ API
(`CloudSolrClient.Builder`) and avoid direct dependency on
`ZkClientClusterStateProvider`.
#### Code suggestion (replace reflective/direct usage of
`ZkClientClusterStateProvider`)
```java
import org.apache.solr.client.solrj.impl.CloudSolrClient;
// old (fails when class removed):
// new ZkClientClusterStateProvider(zkHosts, zkChroot)
List<String> zkHosts = List.of(zkHostString); // e.g. "127.0.0.1:2181"
Optional<String> zkChroot = Optional.empty(); // or Optional.of("/solr") if
used
CloudSolrClient solrClient = new CloudSolrClient.Builder(zkHosts, zkChroot)
.build();
solrClient.setDefaultCollection(collection);
```
If your code currently creates a `ClusterStateProvider` explicitly, refactor
to obtain it through `CloudSolrClient` rather than constructing
`ZkClientClusterStateProvider` directly.
---
### Dependency alignment fix (if needed)
In `tika-integration-tests/tika-pipes-solr-integration-tests/pom.xml`,
ensure Solr test dependencies are version-aligned and explicit for the Solr 8
test path. If both Solr 8 and 9 tests coexist, isolate classpaths by profile or
module so Solr 8 tests don’t run with Solr 9-only artifacts.
Example pattern:
```xml
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
<version>${solr8.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
```
And for Solr8-specific tests, force that version in the module/profile
running `TikaPipesSolr8ZkTest`.
---
### Why this is the correct fix
The build fails only when running the Solr8 ZK test and errors at runtime on
a missing SolrJ class. Replacing direct usage of that removed/relocated class
with `CloudSolrClient.Builder` makes the code resilient across SolrJ versions
and matches supported APIs.
==
PS about the other fail related to the timeout, that isn't related to your
change. It may be because of a problem with gson.version. I remember that I
reverted this once a few weeks ago to 2.13.2 because of that same problem, then
forgot about it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]