I also applied a fix to both Trunk/4.x and the 3.x branch (will be in 3.6 when 
it is released).  This should give you better error messages when something 
goes wrong when ScriptTransformer is invoked.  It will tell you that you need 
>1.6 only if the functionality is absent (case #1 in my last message).  In case 
#2 or #3 it will tell you the "language" you specified isn't supported.  In 
case #4, it will tell you the script itself is invalid.

See https://issues.apache.org/jira/browse/SOLR-3260 .

James Dyer
E-Commerce Systems
Ingram Content Group
(615) 213-4311


-----Original Message-----
From: Dyer, James [mailto:james.d...@ingrambook.com] 
Sent: Tuesday, March 20, 2012 9:46 AM
To: solr-user@lucene.apache.org
Subject: RE: SOLR 3.3 DIH and Java 1.6

Taking a quick look at the code, it seems this exception could have been thrown 
for four reasons:  
(see org.apache.solr.handler.dataimport.ScriptTransformer#initEngine)

1. Your JRE doesn't have class "javax.script.ScriptEngineManager"  (pre 1.6, 
loaded here via reflection)

2. Your JRE doesn't have any installed scripting engines.  This little program 
outputs 1 engine on my JRE with 6 aliases:
        [js, rhino, JavaScript, javascript, ECMAScript, ecmascript]
-----
import javax.script.ScriptEngineFactory;
import javax.script.ScriptEngineManager;

public class TestScripting
{
        public static void main(String args[])
        {
                ScriptEngineManager sem = new ScriptEngineManager();
                for(ScriptEngineFactory sef : sem.getEngineFactories())
                {
                        System.out.println(sef.getNames());
                }
        }
}
-----
3. You specified an unsupported scripting engine name in the "language" 
parameter (see http://wiki.apache.org/solr/DataImportHandler#ScriptTransformer)

4. The script you wrote in the <script> tag has errors.

Unfortunately, it looks like all 4 of these things are being checked in the 
same try/catch block.  So you could have any of these problems and are getting 
a potentially misleading error message.

One way to eliminate all #1&#2 is to run the test 
"org.apache.solr.handler.dataimport.TestScriptTransformer" on your JRE and see 
if it passes.  (see here for how:  
http://wiki.apache.org/solr/HowToContribute#Unit_Tests)

James Dyer
E-Commerce Systems
Ingram Content Group
(615) 213-4311

-----Original Message-----
From: randolf.julian [mailto:randolf.jul...@dominionenterprises.com] 
Sent: Tuesday, March 20, 2012 9:24 AM
To: solr-user@lucene.apache.org
Subject: RE: SOLR 3.3 DIH and Java 1.6

Thanks Mikhail and Juampa. How can I prove to our Systems guys that the Rhino
Engine is not installed? This is the only way that I can prove that it's not
installed and we have to have it for SOLR data importhandler script to run.

Thanks again.
- Randolf

--
View this message in context: 
http://lucene.472066.n3.nabble.com/SOLR-3-3-DIH-and-Java-1-6-tp3841355p3842520.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to