On 15/10/11 19:38, Léa Massiot wrote:
Hello, Thank you for reading my post. Here is my problem: - I have two machines S and M on the same LAN. - S is a Debian machine running a Tomcat server. - And I have a WebApp W deployed on this Tomcat server. - M is a Windows machine which hosts some files for W. - S and M belong to the same Samba domain. - On M, the WebApp files are stored in a directory: "C:\p1\p2\". - "p2" is a share. - Somewhere in the WebApp Java code, I have declared a "final" to store the files path. Here is what I wrote: public static final String s_path = "//M/p2/"; - Now, when I manipulate the WebApp in such a way a file "f.xml" located in "C:\p1\p2\p3\" has to be opened and read, I get the following error: java.io.FileNotFoundException: /M/p2/p3/f.xml (No such file or directory) My question is: how do I have to declare "s_path" to properly access, from S (W), those files which are stored on M? (I basically want to have the data on one machine and Tomcat on another machine). Can you help me? Best regards, -- Léa
Well, for a start a webapp is not normally allowed to access files outside its own container... this is usually only the {catalina.base}/webapps/yourWebapp/ directory and its contents.
You can get "outside that container" with a context.xml docbase element, but I can see that won't work for you because you are talking as if you have/need most of your webapp within the container.
The only way I know to access data outside the container (under linux) is to define a linux symlink from inside the container to a directory path outside the container. You also need to permit the webapp to follow the symlink, because that is not normally allowed. I //think// you should be able to symlink to a samba share - I do that successfully, but haven't tried to hang the whole thing together for a webapp under tomcat, so I can't promise it will work.
Tomcat docs tell you how to do this, but I have a more newbie-friendly explanation for a jspwiki plugin that I wrote. You can read it here:
http://www.jspwiki.org/wiki/PhotoCollectionPlugin Good luck! Brian --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org