You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Xue-Feng Yang <ju...@yahoo.com> on 2011/09/18 03:26:20 UTC

a weird error of embedded server initiaizationl

I could resolve the unicode issue for a deploy on glassfish, so I turn to test the embedded server for solr.  There is a weird error. It throws from   CoreContainer container = new CoreContainer();




java.io.FileNotFoundException: C:\intelli\config\security.properties (The system cannot find the path specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:120)
    at com.sun.enterprise.util.Utility.getPropertiesFromFile(Utility.java:56)
    at com.sun.enterprise.iiop.POAEJBORB.<clinit>(POAEJBORB.java:83)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at org.omg.CORBA.ORB.create_impl(ORB.java:295)
    at org.omg.CORBA.ORB.init(ORB.java:336)
    at com.sun.enterprise.util.ORBManager.createORB(ORBManager.java:140)
    at com.sun.enterprise.util.ORBManager.init(ORBManager.java:69)
    at com.sun.enterprise.naming.SerialInitContextFactory.<init>(SerialInitContextFactory.java:35)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:355)
    at java.lang.Class.newInstance(Class.java:308)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
    at javax.naming.InitialContext.init(InitialContext.java:223)
    at javax.naming.InitialContext.<init>(InitialContext.java:175)
    at org.apache.solr.core.SolrResourceLoader.locateSolrHome(SolrResourceLoader.java:593)
    at org.apache.solr.core.CoreContainer.<init>(CoreContainer.java:82)
    at com.norvar.test.samples.SimpleMain.getEmbeddedSolrServer(SimpleMain.java:151)
    at com.norvar.test.samples.SimpleMain.getSolrServer(SimpleMain.java:143)
    at com.norvar.test.samples.CUVMain.run(CUVMain.java:20)
    at com.norvar.test.samples.CUVMain.main(CUVMain.java:15)
java.io.FileNotFoundException: C:\intelli\config\ejb.properties (The system cannot find the path specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:120)
    at com.sun.enterprise.util.Utility.getPropertiesFromFile(Utility.java:56)
    at com.sun.enterprise.iiop.J2EEInitializer.<init>(J2EEInitializer.java:57)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:355)
    at java.lang.Class.newInstance(Class.java:308)
    at com.sun.corba.ee.internal.Interceptors.PIORB.registerORBInitializers(PIORB.java:373)
    at com.sun.corba.ee.internal.Interceptors.PIORB.parseProperties(PIORB.java:343)
    at com.sun.corba.ee.internal.TxPOA.TxPIORB.parseProperties(TxPIORB.java:116)
    at com.sun.corba.ee.internal.corba.ORB.set_parameters(ORB.java:449)
    at com.sun.corba.ee.internal.POA.POAORB.set_parameters(POAORB.java:152)
    at com.sun.corba.ee.internal.Interceptors.PIORB.set_parameters(PIORB.java:332)
    at org.omg.CORBA.ORB.init(ORB.java:337)
    at com.sun.enterprise.util.ORBManager.createORB(ORBManager.java:140)
    at com.sun.enterprise.util.ORBManager.init(ORBManager.java:69)
    at com.sun.enterprise.naming.SerialInitContextFactory.<init>(SerialInitContextFactory.java:35)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:355)
    at java.lang.Class.newInstance(Class.java:308)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
    at javax.naming.InitialContext.init(InitialContext.java:223)
    at javax.naming.InitialContext.<init>(InitialContext.java:175)
    at org.apache.solr.core.SolrResourceLoader.locateSolrHome(SolrResourceLoader.java:593)
    at org.apache.solr.core.CoreContainer.<init>(CoreContainer.java:82)
    at com.norvar.test.samples.SimpleMain.getEmbeddedSolrServer(SimpleMain.java:151)
    at com.norvar.test.samples.SimpleMain.getSolrServer(SimpleMain.java:143)
    at com.norvar.test.samples.CUVMain.run(CUVMain.java:20)
    at com.norvar.test.samples.CUVMain.main(CUVMain.java:15)

Warning: unable to read transaction.interoperability config property
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/lucene/index/IndexReader
    at org.apache.solr.core.CoreContainer.load(CoreContainer.java:246)
    at org.apache.solr.core.CoreContainer.load(CoreContainer.java:207)
    at com.norvar.test.samples.SimpleMain.getEmbeddedSolrServer(SimpleMain.java:153)
    at com.norvar.test.samples.SimpleMain.getSolrServer(SimpleMain.java:143)
    at com.norvar.test.samples.CUVMain.run(CUVMain.java:20)
    at com.norvar.test.samples.CUVMain.main(CUVMain.java:15)
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.index.IndexReader
    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

Re: a weird error of embedded server initiaizationl

Posted by Xue-Feng Yang <ju...@yahoo.com>.
I had solved this problem.

Thanks.




________________________________
From: Chris Hostetter <ho...@fucit.org>
To: "solr-user@lucene.apache.org" <so...@lucene.apache.org>; Xue-Feng Yang <ju...@yahoo.com>
Sent: Tuesday, September 20, 2011 9:28:24 PM
Subject: Re: a weird error of embedded server initiaizationl


: 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

Re: a weird error of embedded server initiaizationl

Posted by Chris Hostetter <ho...@fucit.org>.
: 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

Re: a weird error of embedded server initiaizationl

Posted by Xue-Feng Yang <ju...@yahoo.com>.
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 <ho...@fucit.org>
To: "solr-user@lucene.apache.org" <so...@lucene.apache.org>; Xue-Feng Yang <ju...@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

Re: a weird error of embedded server initiaizationl

Posted by Chris Hostetter <ho...@fucit.org>.
: 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