Writing data into an XML file on Unix/Tomcat platform - URGENT!!!!

Hi,

Thanks for the solution about using a protocol prefix before accessing the XML file from the Unix file system. I used the http protocol before the file path and the servlet is able to read the XML file. But however, now while writing into the XML file, a SecurityException is thrown by Tomcat. It seems there needs to be some kind of security manager settings that need to be done in order to write into any file.

Could you please help me out in this regard.

Thanks in advance,

Jatin Shroff

Re: Parsing XML on Unix/Tomcat platform - Urgent!!!!

Author: theforce Aug 10, 2001 4:15 AM

Hi,

I think I may have ideas that might just solve your problem with the malformed url exception.

1) on unix (as I'm sure your aware) things are case sensitive (unlike windows), so check the case on the path and file and mimic it exactley.

2) make sure the permissions on the file and path is ok

i.e. the user that is running apache, usually nobody, sometimes root owns the path and file.

3) I notice the error suggests you are not supplying a protocol where the file resides.

i.e. http, file, etc.

this might not be needed on windows, but its still good practice to specify your protocol.

e.g. file://somepath/somedir/somefile.xml - reading directly from disk.

OR

http://<server>:<port>/somepath/somedir/somefile.xml

Author: jcshroff Aug 10, 2001 3:41 AM

Hi,

I'd like to know if it is possible to parse a XML file using the JAXP API on a Sun Solaris system running the Jakarta Tomcat servlet engine.

When trying to execute the servlet that parses the XML document, the following error message comes:

java.net.MalformedURLException:

no protocol: /install/jakarta-tomcat-3.2.2/webapps/ROOT/Orders.xml

The same servlet works fine on Windows NT platform running Java Web Server. I have installed JAXP on the Unix system and set all classpath variables also.

Is this something to do with the web server/servlet engine or are there some additional parsers for XML required on Unix?

Thanks in advance,

Jatin Shroff

[2212 byte] By [jcshroff] at [2007-9-26 3:54:39]
# 1

Hi dude,

glad the fix worked.

1) Hmmmm. This one is trickey. Ideally you need to use a PUT operation over http, which will allow you to write the xml file out. However, not sure what you need to do in terms of ACL's to allow TOmcat to write the file.

2) A quick fix for this would be to change your protocol from http to file://actual/file/path. This will allow you to write the assuming that you have permissions.

3) Check that the user your running Tomcat as has UNIX file permissions. i.e. read and write, not just read.

hope this helps.

daz.

theforce at 2007-6-29 12:44:01 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...