Groovy Scripting Errors & Exceptions (Aspire 2)

From wiki.searchtechnologies.com
Jump to: navigation, search

For Information on Aspire 3.1 Click Here

This page details common errors that you may encounter when using the Groovy stage and resolutions. You should look for the Caused by: in the AspireException to aid troubleshooting.

No such property: bh for class

The following error was caused by an incorrect Groovy component configuration:

 AspireException(GroovyStage.script-execution-error):
 com.searchtechnologies.aspire.services.AspireException: Error occured while executing the groovy script. (component='/MemoryLane-initial-experiment/ProcessEndecaFiles/SplitEndecaFileAndFeedIndividualDocs', componentFactory='aspire-groovy')
       at com.searchtechnologies.aspire.components.GroovyStage.process(GroovyStage.java:146)
       at com.searchtechnologies.aspire.framework.JobHandler.runNested(JobHandler.java:106)
       at com.searchtechnologies.aspire.framework.JobHandler.run(JobHandler.java:47)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
       at java.lang.Thread.run(Thread.java:619)
 Caused by: groovy.lang.MissingPropertyException: No such property: bh for class: Script1
       at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:49)
       at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
       at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:241)
       at Script1.run(Script1.groovy:23)
       at com.searchtechnologies.aspire.components.GroovyStage.process(GroovyStage.java:142)
       ... 5 more

The script used a branch handler, but its configuration had been placed outside the <config> block:

     <component name="SplitEndecaFileAndFeedIndividualDocs" subType="default" factoryName="aspire-groovy">
       <config>
         <script>
           <![CDATA[
             .
             .
             AspireDocument subDoc = new AspireDocument();
             subDoc.add("text", outputBuffer.toString());  
             Job subJob = job.createSubJob(subDoc, job.getJobId() + "-" + subjobCount);
             bh.enqueue(subJob, "onPublish");
             .
             .
           ]]>
         </script>
       </config>
       <!-- Mis placed <branches> configuration below -->
       <branches>
          <branch event="onPublish" pipelineManager="../PrintDocDontIndex" />
       </branches>
     </component>

The correct configuration is shown below:

     <component name="SplitEndecaFileAndFeedIndividualDocs" subType="default" factoryName="aspire-groovy">
       <config>
         <script>
           <![CDATA[
             .
             .
             AspireDocument subDoc = new AspireDocument();
             subDoc.add("text", outputBuffer.toString());  
             Job subJob = job.createSubJob(subDoc, job.getJobId() + "-" + subjobCount);
             bh.enqueue(subJob, "onPublish");
             .
             .
           ]]>
         </script>
         <!-- Correctly placed <branches> configuration below -->
         <branches>
            <branch event="onPublish" pipelineManager="../PrintDocDontIndex" />
         </branches>
       </config>
     </component>