Skip to main content
Question

How to read and write files in Groovy/java ?

  • July 20, 2022
  • 3 replies
  • 111 views

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

Pradeep
StreamSets Employee
Forum|alt.badge.img+1
  • StreamSets Employee
  • 48 replies
  • July 21, 2022

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.


  • Author
  • Fan
  • 4 replies
  • July 21, 2022

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. 


wilsonshamim
StreamSets Employee
Forum|alt.badge.img+1
  • StreamSets Employee
  • 25 replies
  • July 22, 2022

@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