cancel
Showing results for 
Search instead for 
Did you mean: 

org.codehaus.groovy.syntax.SyntaxException: unable to resolve class error occurs in Linux machine

SOLVED
Contributor

org.codehaus.groovy.syntax.SyntaxException: unable to resolve class error occurs in Linux machine

Hi team,

 

We have some groovy files used in script Library in ReadyAPI (integrated with cucumber) they are imported and use in Groovy steps in Test cases. These case are working fine when running via either the ReadyAPI application as well as using Cucumber under Windows. It however fails with the below error when run in Linux machine via Ansible batches.  The failing appears to be randomly: in the same testcase, two scenarios might be successful and one would fail because the import of the groovy script fails. Could some one please help to get this fixed.

 

20:19:00,260 ERROR [SoapUI] An error occurred [startup failed:
Script1.groovy: 2: unable to resolve class com.common.Transactions
@ line 2, column 1.
import com.common.Transactions
^
org.codehaus.groovy.syntax.SyntaxException: unable to resolve class com.common.Transactions
@ line 2, column 1.
tat org.codehaus.groovy.ast.ClassCodeVisitorSupport.addError(ClassCodeVisitorSupport.java:149)
tat org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1225)
tat org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:178)
tat org.codehaus.groovy.control.CompilationUnit$11.call(CompilationUnit.java:651)
tat org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:931)
tat org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:593)
tat org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:542)
tat groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
tat groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
tat groovy.lang.GroovyShell.parseClass(GroovyShell.java:694)
tat groovy.lang.GroovyShell.parse(GroovyShell.java:706)
tat groovy.lang.GroovyShell.parse(GroovyShell.java:742)
tat groovy.lang.GroovyShell.parse(GroovyShell.java:733)
tat com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.recompileWithNewName(SoapUIGroovyScriptEngine.java:155)
tat com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.compile(SoapUIGroovyScriptEngine.java:146)
tat com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:95)
tat com.eviware.soapui.impl.wsdl.teststeps.assertions.basic.GroovyScriptAssertion.assertScript(GroovyScriptAssertion.java:151)
tat com.eviware.soapui.impl.wsdl.teststeps.assertions.basic.GroovyScriptAssertion.internalAssertResponse(GroovyScriptAssertion.java:187)
tat com.eviware.soapui.impl.wsdl.teststeps.WsdlMessageAssertion.assertResponse(WsdlMessageAssertion.java:163)
tat com.eviware.soapui.impl.wsdl.teststeps.RestTestRequest.assertResponse(RestTestRequest.java:146)
tat com.eviware.soapui.impl.wsdl.teststeps.RestTestRequest.setResponse(RestTestRequest.java:133)
tat com.eviware.soapui.impl.wsdl.teststeps.RestTestRequestStep.run(RestTestRequestStep.java:852)
tat com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:261)
tat com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runCurrentTestStep(WsdlTestCaseRunner.java:50)
tat com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:171)
tat com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:1)
tat com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:130)
tat com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.start(AbstractTestRunner.java:73)
tat com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase.run(WsdlTestCase.java:685)
tat com.eviware.soapui.impl.wsdl.WsdlTestCasePro.run(WsdlTestCasePro.java:105)
tat com.eviware.soapui.impl.wsdl.WsdlTestCasePro.run(WsdlTestCasePro.java:94)
tat com.stepDefinitions.StepDefinitionsTransactions.post_Transaction_request_with(StepDefinitionsTransactions.java:175)
tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
tat java.lang.reflect.Method.invoke(Method.java:498)
tat cucumber.runtime.Utils$1.call(Utils.java:26)
tat cucumber.runtime.Timeout.timeout(Timeout.java:16)
tat cucumber.runtime.Utils.invoke(Utils.java:20)
tat cucumber.runtime.java.JavaStepDefinition.execute(JavaStepDefinition.java:57)
tat cucumber.runner.PickleStepDefinitionMatch.runStep(PickleStepDefinitionMatch.java:50)
tat cucumber.runner.TestStep.executeStep(TestStep.java:65)
tat cucumber.runner.TestStep.run(TestStep.java:50)
tat cucumber.runner.PickleStepTestStep.run(PickleStepTestStep.java:43)
tat cucumber.runner.TestCase.run(TestCase.java:46)
tat cucumber.runner.Runner.runPickle(Runner.java:49)
tat cucumber.runtime.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:146)
tat cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:68)
tat cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:23)
tat org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
tat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
tat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
tat org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
tat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
tat org.junit.runners.ParentRunner.run(ParentRunner.java:363)
tat cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:73)
tat cucumber.api.junit.Cucumber.runChild(Cucumber.java:123)
tat cucumber.api.junit.Cucumber.runChild(Cucumber.java:65)
tat org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
tat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
tat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
tat org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
tat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
tat cucumber.api.junit.Cucumber$RunCucumber.evaluate(Cucumber.java:147)
tat org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
tat org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
tat org.junit.runners.ParentRunner.run(ParentRunner.java:363)
tat org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:283)
tat org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:173)
tat org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
tat org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:128)
tat org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
tat org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
tat org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Contributor

Re: org.codehaus.groovy.syntax.SyntaxException: unable to resolve class error occurs in Linux machin

Thanks Rao. We increasing the heap size to load script library and it worked. 

View solution in original post

8 REPLIES 8
Highlighted
Community Hero

Re: org.codehaus.groovy.syntax.SyntaxException: unable to resolve class error occurs in Linux machin

Make sure the library files which are in your system under READY_HOME/bin/ext directory are available in the new machine you are trying to use.


Regards,
Rao.
Highlighted
Contributor

Re: org.codehaus.groovy.syntax.SyntaxException: unable to resolve class error occurs in Linux machin

Hi Rao,

 

I have the library files in src/test/resources path in cucumber project in both the machines and setting them up after loading the project like mentioned below.

 

project = new WsdlProjectPro("src/test/resources/xml/SoapUI");
project.setScriptLibrary("src/test/resources/groovy/");

This is working for all the test cases but not all the time.

 

Regards

Highlighted
Community Hero

Re: org.codehaus.groovy.syntax.SyntaxException: unable to resolve class error occurs in Linux machin

Libraries,yYou mean below class?
"com.common.Transactions"


Regards,
Rao.
Highlighted
Contributor

Re: org.codehaus.groovy.syntax.SyntaxException: unable to resolve class error occurs in Linux machin

Hi Rao,

 Yes, we created a com.common.Transactions.groovy custom class. This is not getting imported in the groovy test step some times.

 

Regards

Highlighted
Community Hero

Re: org.codehaus.groovy.syntax.SyntaxException: unable to resolve class error occurs in Linux machin

Otherway is to compile and create a jar file and copy it under READYAPI_HOME/bin/ext directory.

You may look at below library by our community expert Mr. Ruprert Anderson.
http://rupertanderson.com/blog/1-how-to-develop-add-and-use-a-custom-groovy-library-in-soapui/


Regards,
Rao.
Highlighted
Contributor

Re: org.codehaus.groovy.syntax.SyntaxException: unable to resolve class error occurs in Linux machin

Thanks Rao. We increasing the heap size to load script library and it worked. 

View solution in original post

Highlighted
Community Manager

Re: org.codehaus.groovy.syntax.SyntaxException: unable to resolve class error occurs in Linux machin

I'm glad to hear it is working now Smiley Happy 



Sonya Mihaljova
Community and Education Specialist

 Join SmartBear Connect next April in Boston to meet with software development, API and testing experts from around the world! Get your ticket today!
Highlighted
Community Hero

Re: org.codehaus.groovy.syntax.SyntaxException: unable to resolve class error occurs in Linux machin

Strange. There isn't any close relationship to find the classes with heap size unless the file are available.


Regards,
Rao.