Hi, I'm starting using SolR 1.4 queried by SolRJ 1.4 (all official release that I've downloaded from the main link on the web site : http://www.apache.org/dyn/closer.cgi/lucene/solr/ mirror : http://apache.multidist.com/lucene/solr/1.4.0/ downloaded the .zip file.)
The servers start OK and the class CommonsHttpSolrServer works fine. But when running the class EmbeddedSolrServer to do the same basic test, it fails with the following "compilation like" exception : 09:55:59,859 INFO ~ Adding 'file:/C:/Projets_RD/WorkspacePlay/apache-solr-1.4.0/contrib/clustering/lib/jackson-mapper-asl-0.9.9-6.jar' to classloader 09:55:59,859 INFO ~ Adding 'file:/C:/Projets_RD/WorkspacePlay/apache-solr-1.4.0/contrib/clustering/lib/log4j-1.2.14.jar' to classloader Exception in thread "main" java.lang.VerifyError: class org.apache.solr.search.SolrIndexReader overrides final method setNorm.(ILjava/lang/String;B)V at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$000(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at org.apache.solr.core.SolrConfig.<init>(SolrConfig.java:166) at org.apache.solr.core.CoreContainer$Initializer.initialize(CoreContainer.java:134) at util.UtilSolR.getEmbeddedSolRServer(UtilSolR.java:65) at util.UtilSolR.main(UtilSolR.java:29) Am I doing something wrong ? I'm not a newby in Java and this exception seems more like a compilation problem than a config or usage pbl. In my classPath, I've imported the jars from the folder "\apache-solr-1.4.0\dist". The class SlorIndexReader extends the class FilterIndexReader. It effectively overrides the following method : *...@override public void setNorm(int doc, String field, byte value) throws StaleReaderException, CorruptIndexException, LockObtainFailedException, IOException { in.setNorm(doc, field, value); }* The ovrridden method seems to be in a "lucene" jar : org.apache.lucene.index.FilterIndexReader or org.apache.lucene.index.IndexReader Does this pbl come from a build/packaging error, like a no compatibility between jars that have been packaged together ?? I do not have the source code of the Lucene library... so I can't check where the pbl exactly comes from... Can someone help me please ?? I really don't know what to do to make that work... I'm going to try to download from other mirrors, but I guess that obviously they will provide me with the exact same package. Thanks. Damien *PS:* Here is my test code : *package util; import java.io.IOException; import java.net.MalformedURLException; import java.util.ArrayList; import java.util.Collection; import javax.xml.parsers.ParserConfigurationException; import org.apache.solr.client.solrj.SolrServer; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer; import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer; import org.apache.solr.common.SolrInputDocument; import org.apache.solr.core.CoreContainer; import org.xml.sax.SAXException; public class UtilSolR { private static EmbeddedSolrServer embeddedSolrServer = null; private static SolrServer httpSolrServer = null; /** * @param args */ public static void main(String[] args) { //SolrServer server = getHttpSolRServer(); SolrServer server = getEmbeddedSolRServer(); SolrInputDocument doc1 = new SolrInputDocument(); doc1.addField( "id", "id1", 1.0f ); doc1.addField( "name", "doc1", 1.0f ); doc1.addField( "price", 10 ); SolrInputDocument doc2 = new SolrInputDocument(); doc2.addField( "id", "id2", 1.0f ); doc2.addField( "name", "doc2", 1.0f ); doc2.addField( "price", 20 ); Collection<SolrInputDocument> docs = new ArrayList<SolrInputDocument>(); docs.add( doc1 ); docs.add( doc2 ); try { server.add( docs ); server.commit(); } catch (SolrServerException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("Done !!"); } public static EmbeddedSolrServer getEmbeddedSolRServer(){ if(embeddedSolrServer == null){ CoreContainer coreContainer; System.setProperty("solr.solr.home", "C:\\Projets_RD\\WorkspacePlay\\apache-solr-1.4.0\\example\\solr"); CoreContainer.Initializer initializer = new CoreContainer.Initializer(); try { coreContainer = initializer.initialize(); embeddedSolrServer = new EmbeddedSolrServer(coreContainer, ""); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ParserConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SAXException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return embeddedSolrServer; } public static SolrServer getHttpSolRServer(){ if(httpSolrServer == null){ String url = "http://localhost:8983/solr"; /* CommonsHttpSolrServer is thread-safe and if you are using the following constructor, you *MUST* re-use the same instance for all requests. If instances are created on the fly, it can cause a connection leak. The recommended practice is to keep a static instance of CommonsHttpSolrServer per solr server url and share it for all requests. See https://issues.apache.org/jira/browse/SOLR-861 for more details */ try { httpSolrServer = new CommonsHttpSolrServer( url ); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return httpSolrServer; } }*