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 "Moore, Gary" <Ga...@ARS.USDA.GOV> on 2012/09/14 03:03:08 UTC
dih groovy script question
I'm a bit stumped as to why I can't get a groovy script to run from the DIH. I'm sure it's something braindead I'm missing. The script looks like this in data-config.xml:
<script language="groovy"><![CDATA[
import java.security.MessageDigest
import java.util.HashMap
def createHashId(HashMap<String,Object>row, org.apache.solr.handler.dataimport.ContextImpl context ) {
// do groovy stuff
return row
}
]]>
</script>
When I run the import, I get the following error:
Caused by: java.lang.NoSuchMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.createHashId() is applicable for argument types: (java.util.HashMap, org.apache.solr.handler.dataimport.ContextImpl) values: [[Format:Reports, Credits:, EnteredBy:Corey Holland, ...], ...]
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.invokeImpl(GroovyScriptEngineImpl.java:364)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.invokeFunction(GroovyScriptEngineImpl.java:160)
... 13 more
The script runs fine from the shell so I don't believe there are any groovy errors. Thanks in advance for any tips.
Gary
This electronic message contains information generated by the USDA solely for the intended recipients. Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil or criminal penalties. If you believe you have received this message in error, please notify the sender and delete the email immediately.
RE: dih groovy script question
Posted by "Moore, Gary" <Ga...@ARS.USDA.GOV>.
Looks like some sort of foul-up with Groovy versions and Solr 3.6.1 as I had to roll back to Groovy 1.7.10 to get this to work. Started with Groovy 2 and then 1.8 before 1.7.10. What's odd is that I implemented the same calls made in ScriptTransformer.java in a test program and they worked fine with all Groovy versions. Can't imagine what the root cause might be -- Groovy implements jsr223 differently in later versions? I suppose to find out I could compile Solr with my jdk but .... time to march on. ;)
Gary
-----Original Message-----
From: Erick Erickson [mailto:erickerickson@gmail.com]
Sent: Saturday, September 15, 2012 9:01 AM
To: solr-user@lucene.apache.org
Subject: Re: dih groovy script question
Stab in the dark... This looks like you're somehow getting the wrong Groovy jars. Can you print out the Groovy version as a test? Perhaps you have one groovy version in your command-line and copied a different version into the libraries Solr knows about?
Because this looks like a pure Groovy error....
Best
Erick
On Thu, Sep 13, 2012 at 9:03 PM, Moore, Gary <Ga...@ars.usda.gov> wrote:
> I'm a bit stumped as to why I can't get a groovy script to run from the DIH. I'm sure it's something braindead I'm missing. The script looks like this in data-config.xml:
>
> <script language="groovy"><![CDATA[
> import java.security.MessageDigest
> import java.util.HashMap
> def createHashId(HashMap<String,Object>row, org.apache.solr.handler.dataimport.ContextImpl context ) {
> // do groovy stuff
> return row } ]]> </script>
>
> When I run the import, I get the following error:
>
>
> Caused by: java.lang.NoSuchMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.createHashId() is applicable for argument types: (java.util.HashMap, org.apache.solr.handler.dataimport.ContextImpl) values: [[Format:Reports, Credits:, EnteredBy:Corey Holland, ...], ...]
> at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.invokeImpl(GroovyScriptEngineImpl.java:364)
> at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.invokeFunction(GroovyScriptEngineImpl.java:160)
> ... 13 more
>
> The script runs fine from the shell so I don't believe there are any groovy errors. Thanks in advance for any tips.
> Gary
>
>
>
>
> This electronic message contains information generated by the USDA solely for the intended recipients. Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil or criminal penalties. If you believe you have received this message in error, please notify the sender and delete the email immediately.
Re: dih groovy script question
Posted by Erick Erickson <er...@gmail.com>.
Stab in the dark... This looks like you're somehow getting the wrong
Groovy jars. Can you
print out the Groovy version as a test? Perhaps you have one groovy
version in your
command-line and copied a different version into the libraries Solr knows about?
Because this looks like a pure Groovy error....
Best
Erick
On Thu, Sep 13, 2012 at 9:03 PM, Moore, Gary <Ga...@ars.usda.gov> wrote:
> I'm a bit stumped as to why I can't get a groovy script to run from the DIH. I'm sure it's something braindead I'm missing. The script looks like this in data-config.xml:
>
> <script language="groovy"><![CDATA[
> import java.security.MessageDigest
> import java.util.HashMap
> def createHashId(HashMap<String,Object>row, org.apache.solr.handler.dataimport.ContextImpl context ) {
> // do groovy stuff
> return row
> }
> ]]>
> </script>
>
> When I run the import, I get the following error:
>
>
> Caused by: java.lang.NoSuchMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.createHashId() is applicable for argument types: (java.util.HashMap, org.apache.solr.handler.dataimport.ContextImpl) values: [[Format:Reports, Credits:, EnteredBy:Corey Holland, ...], ...]
> at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.invokeImpl(GroovyScriptEngineImpl.java:364)
> at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.invokeFunction(GroovyScriptEngineImpl.java:160)
> ... 13 more
>
> The script runs fine from the shell so I don't believe there are any groovy errors. Thanks in advance for any tips.
> Gary
>
>
>
>
> This electronic message contains information generated by the USDA solely for the intended recipients. Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil or criminal penalties. If you believe you have received this message in error, please notify the sender and delete the email immediately.