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 "randolf.julian" <ra...@dominionenterprises.com> on 2012/03/20 05:41:57 UTC

SOLR 3.3 DIH and Java 1.6

I am trying to use the data import handler to update SOLR index with Oracle
data. In the SOLR schema, a dynamic field called PHOTO_* has been defined. I
created a script transformer:

  <script>
     

and called it in a query:

       <entity name="photo" transformer="script:pivotPhotos"
               query="select
p.path||','||p.photo_barcode||','||p.display_order REC_PHOTO,
                             lpad(p.display_order,3,'0') SEQUENCE_NUMBER
                        from traderadm.photo p
                        where p.realm_id = '${ad.REALM_ID}'
                          and p.ad_id = '${ad.AD_ID}'
                        order by p.display_order"/>

However, whenever I run a full import, it fails with this error in the
solr0.log file:

Full Import
failed:org.apache.solr.handler.dataimport.DataImportHandlerException:
&lt;script&gt; can be used only in java 6 or above

Here's the output of my java version:

$ java -version
java version "1.6.0_0"
OpenJDK Runtime Environment (IcedTea6 1.6) (rhel-1.13.b16.el5-x86_64)
OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)

I believe we are using java 6.

I am lost with this error and need help on why this is happening.

Thanks.

- Randolf


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

RE: SOLR 3.3 DIH and Java 1.6

Posted by "randolf.julian" <ra...@dominionenterprises.com>.
Thanks guys for all the help. We moved to an upgraded O.S. version and the
java script worked.

- Randolf

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

RE: SOLR 3.3 DIH and Java 1.6

Posted by "Dyer, James" <Ja...@ingrambook.com>.
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.Dyer@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.julian@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.

RE: SOLR 3.3 DIH and Java 1.6

Posted by "Dyer, James" <Ja...@ingrambook.com>.
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.julian@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.

RE: SOLR 3.3 DIH and Java 1.6

Posted by "randolf.julian" <ra...@dominionenterprises.com>.
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.

RE: SOLR 3.3 DIH and Java 1.6

Posted by Juan Pablo Mora <ju...@informa.es>.
Some versions of the OpenJDK doesn´t include the Rhino Engine to run javascript dataimport. You have to use the Oracle JDK.

Juampa.
________________________________________
De: randolf.julian [randolf.julian@dominionenterprises.com]
Enviado el: martes, 20 de marzo de 2012 5:41
Para: solr-user@lucene.apache.org
Asunto: SOLR 3.3 DIH and Java 1.6

I am trying to use the data import handler to update SOLR index with Oracle
data. In the SOLR schema, a dynamic field called PHOTO_* has been defined. I
created a script transformer:

  <script>


and called it in a query:

       <entity name="photo" transformer="script:pivotPhotos"
               query="select
p.path||','||p.photo_barcode||','||p.display_order REC_PHOTO,
                             lpad(p.display_order,3,'0') SEQUENCE_NUMBER
                        from traderadm.photo p
                        where p.realm_id = '${ad.REALM_ID}'
                          and p.ad_id = '${ad.AD_ID}'
                        order by p.display_order"/>

However, whenever I run a full import, it fails with this error in the
solr0.log file:

Full Import
failed:org.apache.solr.handler.dataimport.DataImportHandlerException:
&lt;script&gt; can be used only in java 6 or above

Here's the output of my java version:

$ java -version
java version "1.6.0_0"
OpenJDK Runtime Environment (IcedTea6 1.6) (rhel-1.13.b16.el5-x86_64)
OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)

I believe we are using java 6.

I am lost with this error and need help on why this is happening.

Thanks.

- Randolf


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

Re: SOLR 3.3 DIH and Java 1.6

Posted by Mikhail Khludnev <mk...@griddynamics.com>.
Hello,

Have you tried jdk 6 from Oracle?

On Tue, Mar 20, 2012 at 8:41 AM, randolf.julian <
randolf.julian@dominionenterprises.com> wrote:

> I am trying to use the data import handler to update SOLR index with Oracle
> data. In the SOLR schema, a dynamic field called PHOTO_* has been defined.
> I
> created a script transformer:
>
>  <script>
>
>
> and called it in a query:
>
>       <entity name="photo" transformer="script:pivotPhotos"
>               query="select
> p.path||','||p.photo_barcode||','||p.display_order REC_PHOTO,
>                             lpad(p.display_order,3,'0') SEQUENCE_NUMBER
>                        from traderadm.photo p
>                        where p.realm_id = '${ad.REALM_ID}'
>                          and p.ad_id = '${ad.AD_ID}'
>                        order by p.display_order"/>
>
> However, whenever I run a full import, it fails with this error in the
> solr0.log file:
>
> Full Import
> failed:org.apache.solr.handler.dataimport.DataImportHandlerException:
> &lt;script&gt; can be used only in java 6 or above
>
> Here's the output of my java version:
>
> $ java -version
> java version "1.6.0_0"
> OpenJDK Runtime Environment (IcedTea6 1.6) (rhel-1.13.b16.el5-x86_64)
> OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)
>
> I believe we are using java 6.
>
> I am lost with this error and need help on why this is happening.
>
> Thanks.
>
> - Randolf
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/SOLR-3-3-DIH-and-Java-1-6-tp3841355p3841355.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>



-- 
Sincerely yours
Mikhail Khludnev
Lucid Certified
Apache Lucene/Solr Developer
Grid Dynamics

<http://www.griddynamics.com>
 <mk...@griddynamics.com>