Forum Discussion

hmb506's avatar
hmb506
Occasional Contributor
13 years ago

MultipleCompilationErrorsException in Groovy SolrJ script

Hi,

I'm getting the following error in SoapUI groovy script:


org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script1.groovy: 4: unable to resolve class org.apache.solr.client.solrj.SolrQuery @ line 4, column 1. import org.apache.solr.client.solrj.SolrQuery; ^ org.codehaus.groovy.syntax.SyntaxException: unable to resolve class org.apache.solr.client.solrj.SolrQuery @ line 4, column 1. at org.codehaus.groovy.ast.ClassCodeVisitorSupport.addError(ClassCodeVisitorSupport.java:148) at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1240) at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:148) at org.codehaus.groovy.control.CompilationUnit$8.call(CompilationUnit.java:601) at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:839) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:544) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:493) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:306) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:287) at groovy.lang.GroovyShell.parseClass(GroovyShell.java:731) at groovy.lang.GroovyShell.parse(GroovyShell.java:743) at groovy.lang.GroovyShell.parse(GroovyShell.java:770) at groovy.lang.GroovyShell.parse(GroovyShell.java:761) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.compile(SoapUIGroovyScriptEngine.java:148) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:93) at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SourceFile:89) at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:149) at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:274) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Script1.groovy: 3: unable to resolve class org.apache.solr.common.SolrInputDocument @ line 3, column 1. import org.apache.solr.common.SolrInputDocument; ^ org.codehaus.groovy.syntax.SyntaxException: unable to resolve class org.apache.solr.common.SolrInputDocument @ line 3, column 1. at org.codehaus.groovy.ast.ClassCodeVisitorSupport.addError(ClassCodeVisitorSupport.java:148) at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1240) at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:148) at org.codehaus.groovy.control.CompilationUnit$8.call(CompilationUnit.java:601) at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:839) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:544) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:493) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:306) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:287) at groovy.lang.GroovyShell.parseClass(GroovyShell.java:731) at groovy.lang.GroovyShell.parse(GroovyShell.java:743) at groovy.lang.GroovyShell.parse(GroovyShell.java:770) at groovy.lang.GroovyShell.parse(GroovyShell.java:761) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.compile(SoapUIGroovyScriptEngine.java:148) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:93) at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SourceFile:89) at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:149) at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:274) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Script1.groovy: 1: unable to resolve class org.apache.solr.client.solrj.SolrServerException @ line 1, column 1. import org.apache.solr.client.solrj.SolrServerException; ^ org.codehaus.groovy.syntax.SyntaxException: unable to resolve class org.apache.solr.client.solrj.SolrServerException @ line 1, column 1. at org.codehaus.groovy.ast.ClassCodeVisitorSupport.addError(ClassCodeVisitorSupport.java:148) at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1240) at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:148) at org.codehaus.groovy.control.CompilationUnit$8.call(CompilationUnit.java:601) at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:839) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:544) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:493) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:306) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:287) at groovy.lang.GroovyShell.parseClass(GroovyShell.java:731) at groovy.lang.GroovyShell.parse(GroovyShell.java:743) at groovy.lang.GroovyShell.parse(GroovyShell.java:770) at groovy.lang.GroovyShell.parse(GroovyShell.java:761) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.compile(SoapUIGroovyScriptEngine.java:148) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:93) at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SourceFile:89) at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:149) at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:274) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Script1.groovy: 2: unable to resolve class org.apache.solr.client.solrj.impl.HttpSolrServer @ line 2, column 1. import org.apache.solr.client.solrj.impl.HttpSolrServer; ^ org.codehaus.groovy.syntax.SyntaxException: unable to resolve class org.apache.solr.client.solrj.impl.HttpSolrServer @ line 2, column 1. at org.codehaus.groovy.ast.ClassCodeVisitorSupport.addError(ClassCodeVisitorSupport.java:148) at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1240) at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:148) at org.codehaus.groovy.control.CompilationUnit$8.call(CompilationUnit.java:601) at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:839) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:544) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:493) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:306) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:287) at groovy.lang.GroovyShell.parseClass(GroovyShell.java:731) at groovy.lang.GroovyShell.parse(GroovyShell.java:743) at groovy.lang.GroovyShell.parse(GroovyShell.java:770) at groovy.lang.GroovyShell.parse(GroovyShell.java:761) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.compile(SoapUIGroovyScriptEngine.java:148) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:93) at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SourceFile:89) at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:149) at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:274) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) 4 errors

Here are the lines of code that throws the above error:

import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.HttpSolrServer;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.client.solrj.SolrQuery;
import java.net.MalformedURLException;

i have added all the necessary jar files that Solr require to the lib/ext folder, but still i'm having these errors so please let me know how i can resolve this issue. Secondly, i have tried the same groovy script from the Groovy Editor with the same jar files, and it works !! Not sure why it's failing in SoapUI......

any help to resolve these errors is much appreciated

thanks,
JHB506

5 Replies

  • hmb506's avatar
    hmb506
    Occasional Contributor
    oops, it's the "bin/ext" folder were all jar files were added !!
  • Hi,

    I tried by copying all the jar files from \lib to bin\ext, it still doesn't work.

    Please help me resolve this issue.
    Thanks
  • hmb506's avatar
    hmb506
    Occasional Contributor
    Looks like i spoke too soon, even i'm facing the same odd problem again

    I Google'd the issue and found that the SLF4J version that SoapUI uses is not compatible with what is needed for SolrJ groovy script.
    For now, i trying to see if I can import those necessary jar files during runtime...... any other ideas ??
  • hmb506's avatar
    hmb506
    Occasional Contributor
    Finally resolved the issue, and here's the solution.....

    Read the following SolrJ wiki to find out about all the required jars needed for your script:
    http://wiki.apache.org/solr/Solrj

    You will noticed in the wiki that it states clearly about the jar file compatibility of apache-solr-solrj-*.jar (any version 4.1 or 3.6.2), but currently SoapUI 4.5.1 that i have installed also have few of the jar files from the wiki page such as:
    commons-codec-1.3.jar
    commons-httpclient-3.1.jar
    commons-io-1.3.2.jar
    slf4j-api-1.5.8.jar

    now all you need to download compatible versions of the following jars:
    jcl-over-slf4j-*.jar
    slf4j-jdk14-*.jar
    & the most important apache-solr-solrj-*.jar

    i have used these versions for the above jars:
    slf4j-jdk14-1.5.8.jar
    jcl-over-slf4j-1.5.8.jar
    solr-solrj-4.1.0.jar

    and now my groovy script works

    thanks !!