errol.cristales404236

groovy.lang.MissingPropertyException: No such property: JsonValidator for class

Discussion created by errol.cristales404236 on May 22, 2018
Latest reply on Jul 15, 2018 by brianbrinley

Hi Everyone,

 

Im trying to implement a workaround using JsonValidator for the validation of incoming json requests.

I mixed some solution found on this forum for it but I encountered an error that I'm not familiar with:

"groovy.lang.MissingPropertyException: No such property: JsonValidator for class" .

Would anyone know the cause of this error?

below is the error trace, groovy script and jars imported as reference.

 

Error:

 

com.boomi.process.ProcessException: Error executing data process
    at com.boomi.process.shape.BaseFiberShape.prepareFiberThrown(BaseFiberShape.java:259)
    at com.boomi.process.shape.CatchErrorsShape.executeInitial(CatchErrorsShape.java:255)
    at com.boomi.process.shape.BaseFiberShape.execute(BaseFiberShape.java:77)
    at com.boomi.process.shape.CatchErrorsShape.execute(CatchErrorsShape.java:123)
    at com.boomi.process.graph.ProcessShape.executeShape(ProcessShape.java:559)
    at com.boomi.process.graph.ProcessGraph.executeShape(ProcessGraph.java:489)
    at com.boomi.process.graph.ProcessGraph.executeNextShapes(ProcessGraph.java:573)
    at com.boomi.process.graph.ProcessGraph.executeShape(ProcessGraph.java:510)
    at com.boomi.process.graph.ProcessGraph.executeNextShapes(ProcessGraph.java:573)
    at com.boomi.process.graph.ProcessGraph.execute(ProcessGraph.java:308)
    at com.boomi.process.ProcessExecution.call(ProcessExecution.java:812)
    at com.boomi.execution.ExecutionTask.call(ExecutionTask.java:935)
    at com.boomi.execution.ExecutionTask.call(ExecutionTask.java:61)
    at com.boomi.util.concurrent.CancellableFutureTask.run(CancellableFutureTask.java:160)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: com.boomi.process.ProcessException: Error executing data process
    at com.boomi.process.shape.DataProcessShape.execute(DataProcessShape.java:52)
    at com.boomi.process.graph.ProcessShape.executeShape(ProcessShape.java:559)
    at com.boomi.process.graph.ProcessGraph.executeShape(ProcessGraph.java:489)
    at com.boomi.process.graph.ProcessGraph.executeNextShapes(ProcessGraph.java:573)
    at com.boomi.process.graph.ProcessGraph.executeShape(ProcessGraph.java:510)
    at com.boomi.process.graph.ProcessGraph.executeNextShapes(ProcessGraph.java:573)
    at com.boomi.process.graph.ProcessGraph.execute(ProcessGraph.java:308)
    at com.boomi.process.ProcessExecution.call(ProcessExecution.java:812)
    at com.boomi.execution.ExecutionTask.call(ExecutionTask.java:935)
    at com.boomi.execution.ExecutionTask.call(ExecutionTask.java:61)
    at com.boomi.util.concurrent.CancellableFutureTask.run(CancellableFutureTask.java:160)
    at com.boomi.execution.NestedExecutionForker$NestedSynchronousExecutionFuture.runSynchronous(NestedExecutionForker.java:203)
    at com.boomi.execution.NestedExecutionForker$NestedSynchronousExecutionFuture.get(NestedExecutionForker.java:171)
    at com.boomi.execution.NestedExecutionForker$NestedSynchronousExecutionFuture.get(NestedExecutionForker.java:150)
    at com.boomi.execution.ExecutionTask.getChildResult(ExecutionTask.java:1307)
    at com.boomi.execution.ExecutionTask.getChildResult(ExecutionTask.java:1293)
    at com.boomi.process.shape.ChildInvokerShape.getChildResult(ChildInvokerShape.java:41)
    at com.boomi.process.shape.CatchErrorsShape.executeInitial(CatchErrorsShape.java:250)
    ... 15 more
Caused by: com.boomi.process.ProcessException: No such property: JsonValidator for class: Script29 (in groovy script)
    at com.boomi.process.graph.ProcessShape.failProcess(ProcessShape.java:772)
    at com.boomi.process.graph.ProcessShape.notifyDocumentStatus(ProcessShape.java:630)
    at com.boomi.document.util.DocumentUtil.failProcess(DocumentUtil.java:122)
    at com.boomi.document.impl.OutboundDocumentGroupImpl.failRemainingDocuments(OutboundDocumentGroupImpl.java:125)
    at com.boomi.document.handler.DocumentMultiProcessExecutor.invoke(DocumentMultiProcessExecutor.java:36)
    at com.boomi.document.util.DataProcessExecutor.executeStep(DataProcessExecutor.java:111)
    at com.boomi.document.util.DataProcessExecutor.executeDataProcess(DataProcessExecutor.java:65)
    at com.boomi.process.shape.DataProcessShape.execute(DataProcessShape.java:50)
    ... 32 more
Caused by: com.boomi.execution.ExecutionException: No such property: JsonValidator for class: Script29 (in groovy script)
    at com.boomi.execution.ScriptExecutorManager$SimpleScriptExecutor.execute(ScriptExecutorManager.java:371)
    at com.boomi.document.scripting.ScriptingDocumentHandler.execute(ScriptingDocumentHandler.java:80)
    at com.boomi.document.handler.DocumentMultiProcessExecutor.invoke(DocumentMultiProcessExecutor.java:33)
    ... 35 more
Caused by: groovy.lang.MissingPropertyException: No such property: JsonValidator for class: Script29
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getGroovyObjectProperty(ScriptBytecodeAdapter.java:537)
    at Script29.run(Script29.groovy:18)
    at com.sun.script.groovy.GroovyScriptEngine.eval(GroovyScriptEngine.java:243)
    at com.sun.script.groovy.GroovyCompiledScript.eval(GroovyCompiledScript.java:46)
    at javax.script.CompiledScript.eval(CompiledScript.java:106)
    at com.boomi.execution.ScriptExecutorManager$SimpleScriptExecutor.execute(ScriptExecutorManager.java:341)
    ... 37 more

 

 

 

Script:

 

import java.util.Properties;
import com.boomi.execution.ExecutionUtil;
import org.etlunit.json.*;
import org.codehaus.jackson.*;

 


for( int i = 0; i < dataContext.getDataCount(); i++ ) {
     InputStream is = dataContext.getStream(i);
     Properties props = dataContext.getProperties(i);
     logger = ExecutionUtil.getBaseLogger();
    

 

    
    //Dynamic Process Property
    String schemaFile = ExecutionUtil.getDynamicProcessProperty("DPP_jsonFile");
 
    
    JsonValidator  = JsonValidator.instance;
     
    // Validate the json document
    try {
       
        JsonValidator.validate(schemaFile);
        props.setProperty("document.dynamic.userdefined.isValid", "true");

 

    } catch (Exception e) {

 

        // instance document is invalid!
        props.setProperty("document.dynamic.userdefined.isValid", "false");  
        props.setProperty("document.dynamic.userdefined.validationError", e.getMessage());  
    }

 


    is.reset();
    dataContext.storeStream(is, props);
}

Outcomes