AEM Add File: Exception occurred: This tree does not exist

129 views Asked by At

I am trying to create a txt file under /conf but got this error:

Exception occurred: This tree does not exist

Here is the simplified version of my code - ignoring the file content:

Session session = resourceResolver.adaptTo(Session.class);
Node confNode = session.getNode("/conf");
Node fileNode = confNode.addNode("helloworld.txt", "nt:file");
session.save();

Am I missing anything? /conf path exists in CRXDE so I am not sure why it says the tree does not exist. I have also make sure the SystemUser.yaml has the write and read permission under /conf

0

There are 0 answers