I'm trying to use the sitemapgen4j library to build my sitemaps. I'm facing a permission problem while trying to write to my root directory


the root context folder (/src/main/webapp)


Problem writing sitemap file /sitemap.xml 
/sitemap.xml (Permission denied)


File directory = new File("/");
WebSitemapGenerator wsg = new WebSitemapGenerator("http://localhost:8080/app", directory);

Does anybody know how to go about doing this?

1 Answer 1


You are trying to write to root directory ('/') which is not writable for the user account you are using to run the sitemapgen4j (i.e. only root user can write to '/'). Change it to any directory where you have write access.

  • What's your thought on writing to a temp directory and then storing them on amazons s3 server where I could then just stream the files and avoid storing them on the app server all together?
    – George
    Jan 19, 2015 at 23:24
  • That would work or to your home directory. Jan 19, 2015 at 23:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.