Thanks for reply. 

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. The code for finding 
SolrServer is as follows:


        File home = new File(url);
        File f = new File(home, "solr.xml" );
        CoreContainer container = new CoreContainer();
        container.load(url, f);
        EmbeddedSolrServer server = new EmbeddedSolrServer( coreContainer, 
coreName );
 
which is copied from http://wiki.apache.org/solr/Solrj. The error was thrown at 
the line CoreContainer container = new CoreContainer()

It was amazing when I changed the code to

        String solrHome = url+coreName;
        String dataDir = solrHome + "/data";
        CoreContainer coreContainer = new CoreContainer(solrHome);
        SolrConfig solrConfig=solrConfig = new SolrConfig(solrHome, 
"solrconfig.xml", null);
        CoreDescriptor coreDescriptor = new CoreDescriptor(coreContainer, 
coreName, solrHome);
        SolrCore solrCore = new SolrCore(coreName, dataDir, solrConfig, null, 
coreDescriptor);
        coreContainer.register(solrCore, false);
        EmbeddedSolrServer server = new EmbeddedSolrServer( coreContainer, 
coreName );


I got another weird error:

Exception in thread "main" java.lang.NoClassDefFoundError: 
org/apache/lucene/util/Version
    at org.apache.solr.core.SolrConfig.<init>(SolrConfig.java:133)
    at org.apache.solr.core.SolrConfig.<init>(SolrConfig.java:119)
    at 
com.norvar.test.samples.SimpleMain.getEmbeddedSolrServer(SimpleMain.java:176)
    at com.norvar.test.samples.SimpleMain.getSolrServer(SimpleMain.java:146)
    at com.norvar.test.samples.CUVMain.run(CUVMain.java:21)
    at com.norvar.test.samples.CUVMain.main(CUVMain.java:15)
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.util.Version
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    ... 6 more

The error is from  the line           solrConfig = new SolrConfig(solrHome, 
"solrconfig.xml", null); 

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?


At last, in this case, there are no errors with J2EE.





________________________________
From: Chris Hostetter <hossman_luc...@fucit.org>
To: "solr-user@lucene.apache.org" <solr-user@lucene.apache.org>; Xue-Feng Yang 
<just4l...@yahoo.com>
Sent: Sunday, September 18, 2011 12:03:14 AM
Subject: Re: a weird error of embedded server initiaizationl


: to test the embedded server for solr.  There is a weird error. It throws : 
from   CoreContainer container = new CoreContainer();

these errors aren't related to Solr ... they seem to be from running in a 
J2EE/EJB setup that is missconfigured so it can't check security settings for 
the app it's running.

The first two are when Solr is trying to ask the JVM for JNDI Config...

: java.io.FileNotFoundException: C:\intelli\config\security.properties (The 
system cannot find the path specified)
    ...
:     at javax.naming.InitialContext.<init>(InitialContext.java:175)
:     at 
org.apache.solr.core.SolrResourceLoader.locateSolrHome(SolrResourceLoader.java:593)

This one just seems to be a warning, but it's also about a file that google 
says is realted to EJB/J2EE stuff (solr never asks for it)

: Warning: unable to read transaction.interoperability config property

This last one ... well it oculd be anything.  maybe just some missing jars? ...

: Exception in thread "main" java.lang.NoClassDefFoundError: 
org/apache/lucene/index/IndexReader


-Hoss

Reply via email to