: However, My testing project is a pure Java project. I still don't : understand how it messed up with J2EE stuff. Actually, the same code is : working for CommonsHttpSolrServer without any error like embedded one.
but that makes total sense: if you are using CommonsHttpSolrServer then you would be connecting to a remote solr instance (or at least one running in a differnet JVM) via HTTP, so it wouldn't execute any of the same code to use JNDI. : It was amazing when I changed the code to ... : I got another weird error: I believe that becaue of the way you changed the code, you bypassed all of the solr logic for checking JNDI (or system properties) to locate the solr home dir, so then it moved on to trying to Load Lucene jars... : Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/lucene/util/Version ...which is essentially the same as the IndexReader NoClassDefFoundError you had before (bottom line: lucene jars aren't being found) : In fact, in solr package, there are no lucene jars. I don't know the : relation between solr and lucene. Sould I download lucene and add it to : my testing project? If you are using solr, you are using Lucene. All of the lucene jars needed to run solr are included in the solr war as part of hte solr binary distribution. likewise if you download the solr src distribution, you get all lucene+solr source, and it compiles all of hte lucene+solr jars for you. however: it does seem that (since the build refactoring that happened recently) if you download the solr binary release, the lucene jars are not readily available for building embeded solr apps. you can find them easily enough by unpacking the solr war, but i've opened a jira issue to see if we can improve this situation for the future... https://issues.apache.org/jira/browse/SOLR-2786 -Hoss