Hi all,

I've written an internal library that uses SolrJ for uploading documents to a (remote) Solr server and query them. The project is a Maven multi-module project consisting of several parts: - a common module that represents the bridge to Solr (by using SolrJ) to upload new documents, query them etc. - one module responsible for parsing documents via Apache Tika; basically used to extract text and a few metadata
- one that implements JUnit tests and an integration test

The IT itself uses jetty-maven-plugin for starting a local Solr server with an empty database. The IT creates a new core, uploads some documents, queries them etc., and at the end the core is deleted and the local Solr server stopped.

This is my pom (packaging type is "war"; unnecessary parts omitted):

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>10.0.26</version>
             <configuration>
                <httpConnector>
                    <port>8983</port>
                </httpConnector>
                <stopKey>quit</stopKey>
                <stopPort>9000</stopPort>
                <webApp>
                    <contextPath>/solr</contextPath>
                </webApp>
                <systemProperties>
                    <solr.log.dir>${project.basedir}/solr</solr.log.dir>
<solr.install.dir>${project.basedir}/solr</solr.install.dir> <solr.solr.home>${project.basedir}/solr/data</solr.solr.home>
                    <jetty.testMode>true</jetty.testMode>
                </systemProperties>
            </configuration>
            <executions>
                <execution>
                    <id>start-jetty</id>
                    <phase>pre-integration-test</phase>
                    <goals>
                        <goal>start</goal>
                    </goals>
                </execution>
                <execution>
                    <id>stop-jetty</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>stop</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <configuration>
                <!--<debugForkedProcess>true</debugForkedProcess>-->
                <systemPropertyVariables>
<solr.solr.home>${project.basedir}/solr/data</solr.solr.home>
                </systemPropertyVariables>
            </configuration>
        </plugin>
    </plugins>
</build>


<dependencies>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
    </dependency>
    <dependency>
        <groupId>${project.groupId}</groupId>
        <!-- bridge to Solr: -->
        <artifactId>solr-connector-common</artifactId>
        <version>${project.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.solr</groupId>
        <artifactId>solr-core</artifactId>
        <version>${solr.version}</version>
    </dependency>

    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-params</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

The property "solr.version" is defined in the aggregator pom as "9.10.0".

The "solr/" directory contains:
* solr/server/solr/configsets
  the configsets directory copied from Solr
* solr/data/solr.xml
  copied from <solr>/server/solr/solr.xml
* solr/data/security.json
  for basic auth
* solr/data/test/conf
preconfigured configuration for the core; contains only those fields that I'm using in our Solr bridge code
* solr/data/test/data
  empty directory

So far I'm using Solr 9.10.0, everything works well.

Now I've tried to upgrade the code base to SolrJ 10.0.0; I to change a couple of lines in the bridge code, but no big deal.

Additionally I had to replace the jetty-maven-plugin part by:

<plugin>
    <groupId>org.eclipse.jetty.ee10</groupId>
    <artifactId>jetty-ee10-maven-plugin</artifactId>
    <version>12.0.27</version>
</plugin>


Unfortunately the integration test doesn't work anymore. When Jetty starts the Solr server a ClassNotFoundException is shown in the console:

(...)
[INFO] jetty-12.0.27; built: 2025-09-10T23:47:49.595Z; git: 3569a3e83ad136ee44e26b370b74c1c5e9f33e61; jvm 25.0.2+10-LTS [WARNING] Invalid Resource Reference: (...)/maven/boot/plexus-classworlds-2.9.0.jar [WARNING] The XML schema [XMLSchema.dtd] could not be found. This is very likely to break XML validation if XML validation is enabled. [WARNING] The XML schema [datatypes.dtd] could not be found. This is very likely to break XML validation if XML validation is enabled. [WARNING] The XML schema [xml.xsd] could not be found. This is very likely to break XML validation if XML validation is enabled. [WARNING] Failed startup of context oeje10mp.MavenWebAppContext@54bd2345{/solr,/solr,b=file:///(...)/solr-connector-tests/src/main/webapp/,a=STOPPED,h=oeje10s.SessionHandler@10897221{STOPPED}}{file:///(...)/solr-connector-tests/src/main/webapp/} java.lang.NoClassDefFoundError: org/apache/solr/common/cloud/ClusterPropertiesListener
    at java.lang.Class.getDeclaredConstructors0 (Native Method)
    at java.lang.Class.privateGetDeclaredConstructors (Class.java:2985)
    at java.lang.Class.getConstructor0 (Class.java:3180)
    at java.lang.Class.getDeclaredConstructor (Class.java:2491)
at org.eclipse.jetty.ee10.servlet.ServletContextHandler$ServletScopedContext.createInstance (ServletContextHandler.java:2023) at org.eclipse.jetty.ee10.servlet.BaseHolder.createInstance (BaseHolder.java:203)
(...)


Trying to find the root cause of this it seems to me that lots of dependencies of org.apache.solr:solr-core aren't available and/or added to the webapp's classpath in the IT. I can only solve this by manually adding them to the pom:


<dependency>
    <groupId>org.apache.solr</groupId>
    <artifactId>solr-solrj</artifactId>
    <version>${solr.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.solr</groupId>
    <artifactId>solr-solrj-zookeeper</artifactId>
    <version>${solr.version}</version>
</dependency>
<dependency>
    <groupId>io.opentelemetry</groupId>
    <artifactId>opentelemetry-api</artifactId>
    <version>1.56.0</version>
</dependency>
<dependency>
    <groupId>io.opentelemetry</groupId>
    <artifactId>opentelemetry-sdk-metrics</artifactId>
    <version>1.56.0</version>
</dependency>
<dependency>
    <groupId>org.apache.lucene</groupId>
    <artifactId>lucene-core</artifactId>
    <version>10.3.2</version>
</dependency>
<dependency>
    <groupId>org.apache.lucene</groupId>
    <artifactId>lucene-analysis-common</artifactId>
    <version>10.3.2</version>
</dependency>
<dependency>
    <groupId>org.apache.lucene</groupId>
    <artifactId>lucene-analysis-phonetic</artifactId>
    <version>10.3.2</version>
</dependency>
<dependency>
    <groupId>org.apache.lucene</groupId>
    <artifactId>lucene-analysis-kuromoji</artifactId>
    <version>10.3.2</version>
</dependency>
<dependency>
    <groupId>org.apache.lucene</groupId>
    <artifactId>lucene-analysis-nori</artifactId>
    <version>10.3.2</version>
</dependency>
<dependency>
    <groupId>org.apache.lucene</groupId>
    <artifactId>lucene-queries</artifactId>
    <version>10.3.2</version>
</dependency>
<dependency>
    <groupId>org.apache.lucene</groupId>
    <artifactId>lucene-spatial-extras</artifactId>
    <version>10.3.2</version>
</dependency>
<dependency>
    <groupId>org.apache.lucene</groupId>
    <artifactId>lucene-suggest</artifactId>
    <version>10.3.2</version>
</dependency>
<dependency>
    <groupId>org.apache.lucene</groupId>
    <artifactId>lucene-join</artifactId>
    <version>10.3.2</version>
</dependency>
<dependency>
    <groupId>com.carrotsearch</groupId>
    <artifactId>hppc</artifactId>
    <version>0.10.0</version>
</dependency>
<dependency>
    <groupId>org.apache.lucene</groupId>
    <artifactId>lucene-highlighter</artifactId>
    <version>10.3.2</version>
</dependency>
<dependency>
    <groupId>org.apache.lucene</groupId>
    <artifactId>lucene-queryparser</artifactId>
    <version>10.3.2</version>
</dependency>
<dependency>
    <groupId>org.apache.lucene</groupId>
    <artifactId>lucene-misc</artifactId>
    <version>10.3.2</version>
</dependency>
<dependency>
    <groupId>org.glassfish.jersey.core</groupId>
    <artifactId>jersey-server</artifactId>
    <version>4.0.2</version>
</dependency>
 <dependency>
     <groupId>org.glassfish.jersey.media</groupId>
     <artifactId>jersey-media-json-jackson</artifactId>
     <version>4.0.2</version>
 </dependency>
 <dependency>
     <groupId>com.fasterxml.jackson.dataformat</groupId>
     <artifactId>jackson-dataformat-cbor</artifactId>
     <version>2.21.1</version>
 </dependency>
 <dependency>
     <groupId>org.glassfish.jersey.inject</groupId>
     <artifactId>jersey-hk2</artifactId>
     <version>4.0.2</version>
 </dependency>
<dependency>
    <groupId>org.apache.solr</groupId>
    <artifactId>solr-solrj-streaming</artifactId>
    <version>${solr.version}</version>
</dependency>
<dependency>
    <groupId>io.opentelemetry.instrumentation</groupId>
    <artifactId>opentelemetry-runtime-telemetry-java17</artifactId>
    <version>2.22.0-alpha</version>
</dependency>
<dependency>
    <groupId>io.opentelemetry</groupId>
    <artifactId>opentelemetry-exporter-prometheus</artifactId>
    <version>1.56.0-alpha</version>
</dependency>
<dependency>
    <groupId>com.github.ben-manes.caffeine</groupId>
    <artifactId>caffeine</artifactId>
    <version>3.2.2</version>
</dependency>

This is the whole list of dependencies necessary to make the execptions go away and let the test work again.


I'm a bit lost and couldn't find a reason for all that. It doesn't matter whether I'm using jetty-maven-plugin 11.0.x or 12.0.x/12.1.x; the exceptions are the same.

Using 10.0.26 doesn't work anymore because the older Jetty version implements javax.servlet whereas Solr 10.x server code obviously uses the newer Jakarta namespaces...


Does anyone have an idea what is causing this?



Regards

Thorsten


PS: Sorry for the long e-mail ;-)

Attachment: OpenPGP_0x5A54BBB878225E08.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to