community bug
Your mistake is very common, and the official blog explains it clearly. Be careful with the built-in Solr server, it is not recommended by SOLR !!!
As stated in the official solarium :
The easiest, most secure way to use Solr is through the standard Solr protocol HTTP interfaces. Solr embedding is less flexible, more difficult to maintain, and not as well-tested, and should be reserved for special circumstances.
A choice question: "Continue to work unit test server" or run it "on the fly"
I suggest you do the same thing that we do to unit test, - run a dedicated solr server or - run one on the fly
To start the solr server inside the maven assembly, you can use CARGO: - To run the assembly and unit test, we use maven - we will run an automatic test on Solr - we start the test with a live instance on the fly and close it using conain Maven Cargo - At the end of the unit, we close Cargo! :)
Easy and clean! Enjoy :)
Freight maven code example:
<plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <version>1.4.8</version> <executions> <execution> <id>start-container</id> <phase>process-test-resources</phase> <goals> <goal>start</goal> </goals> </execution> <execution> <id>stop-container</id> <phase>package</phase> <goals> <goal>stop</goal> </goals> </execution> </executions> <configuration> <configuration> <properties> <cargo.servlet.port>8966</cargo.servlet.port> </properties> </configuration> <container> <containerId>jetty7x</containerId> <type>embedded</type> <systemProperties> <solr.solr.home>${basedir}/target/solr</solr.solr.home> <log4j.debug>true</log4j.debug> <net.sourceforge.cobertura.datafile>target/cobertura/cobertura.ser</net.sourceforge.cobertura.datafile> </systemProperties> <dependencies> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>jcl-over-slf4j</artifactId> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>jul-to-slf4j</artifactId> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> </dependency> </dependencies> </container> <deployables> <deployable> <groupId>org.apache.solr</groupId> <artifactId>solr</artifactId> <type>war</type> <properties> <context>/solr</context> </properties> </deployable> </deployables> </configuration> </plugin>
source share