Question

How to read and write files in Groovy/java ?


Hi Team,

I am not able to read and write flies in groovy scripter and groovy evaluator as opening local files in java/groovy when being run in a browser is forbidden. which processor allows me to read/write files? 

Can anyone help me through this please.


3 replies

Userlevel 3
Badge +1

Hi @priya,

What exactly do you mean by opening local files in java/groovy when being run in a browser is forbidden? Did you try reading locally hosted files using groovy processor? Are you facing any error? You might also want to look at processing using jython processor.

Yes, i tried reading locally hosted files using groovy processor and i am getting error as  (java.security.AccessControlException:access denied(“java.io.FilePermission”) .

My requirement is to read and join the files in groovy processor. 

Userlevel 2
Badge +1

@Priya : you need to add permissions to the files. Refer to the below documentation :

https://docs.streamsets.com/portal/platform-datacollector/4.3.x/datacollector/UserGuide/Processors/Groovy.html#task_otr_swr_nx

 

 

 

Reply