[opencms-dev] Access Denied From Scheduled Task
Steele, Jeffrey
steelej at DCSC.GOV
Wed Jun 18 01:01:01 CEST 2003
Hello:
I have a class that deletes a new file and then creates a new file in its
place. The code works when run as a jsp scriptlet. However, I modified it to
run as a Scheduled Task and now I am getting access denied to the resource
(can't lock the existing file, and can't create a new file after manually
deleting the original file).
Here is the line from scheduled tasks:
41 * * * * Admin Administrators com.opencms.modules.homepage.news.weather 1
And here is the relevent code in my file:
public String launch(CmsObject cms, String param) throws IOException,
CmsException {
.... omitted for brevity ...
try {
cms.lockResource("/weather.html");
// This fails with access denied
} catch (CmsException ex ) {
System.err.println(ex.toString());
} try {
cms.deleteResource("/weather.html");
try {
CmsResource myFile = cms.createResource("/weather/",
"weather.html", "plain", null, data);
cms.unlockResource(myFile.getAbsolutePath());
cms.publishResource(myFile.getAbsolutePath());
} catch (CmsException ex ) {
System.err.println(ex.toString());
return "Failed to update the resource!";
}
return "Scheduler launched successfully!";
}
I have set both the file and directory to be owned by guest and write
permissions for everyone.
Does anyone have any idea what's going wrong?
FYI, my program pulls the current weather conditions in Washington, DC from
the US Government Weather Service's web page, parses the html, and creates a
file that can be included on my home page. If anyone is interested in this,
I'll be happy to make the code available. It can be easily modified for
other US cities (I'm not sure about Europe, sorry guys!).
Regards,
Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20030618/e586c93f/attachment.htm>
More information about the opencms-dev
mailing list