Ask Your Question
1

Can't add external JS script to JavaScript Evaluator

asked 2018-07-23 08:48:12 -0500

tamizh gravatar image

updated 2018-07-23 11:02:35 -0500

metadaddy gravatar image

Hello everyone, I am using external javascript inside javascript evaluator in streamsets. But when i try to load the external code i got following error. How should i resolve this. Thanks

ERROR SafeScheduledExecutorService - Uncaught throwable from com.streamsets.pipeline.lib.executor.SafeScheduledExecutorService$SafeCallable@69717812: com.streamsets.datacollector.util.PipelineException: PREVIEW_0003 - Encountered error while previewing : java.security.AccessControlException: access denied ("java.io.FilePermission" "/opt/streamsets-datacollector-user-libs/test.js" "read")
com.streamsets.datacollector.util.PipelineException: PREVIEW_0003 - Encountered error while previewing : java.security.AccessControlException: access denied ("java.io.FilePermission" "/opt/streamsets-datacollector-user-libs/test.js" "read")
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-07-23 11:02:06 -0500

metadaddy gravatar image

updated 2018-07-23 13:09:34 -0500

As mentioned in the blog post on Calling External Libraries from the JavaScript Evaluator, you will need to add a security policy to be able to load a script file. Add the following to $SDC_CONF/sdc-security.policy :

// Set global perm so that JS can load scripts from this directory
// Note - this means any code in the JVM can read this dir!
grant {
  permission java.io.FilePermission "/opt/streamsets-datacollector-user-libs/-", "read";
};

You will need to restart Data Collector for changes to the security policy file to take effect.

edit flag offensive delete link more

Comments

Do I need to restart the datacollector after change sdc-security.policy file ??

tamizh gravatar imagetamizh ( 2018-07-23 12:49:33 -0500 )edit

Yes - added a line to the answer :-)

metadaddy gravatar imagemetadaddy ( 2018-07-23 13:09:50 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-07-23 08:48:12 -0500

Seen: 13 times

Last updated: Jul 23