Not able to access network mapped drive from jsp running on tomcat 6.0
I want to access the net开发者_开发技巧work files from my web application.
I have build the web application (which access network share folder and files) and its works perfectly under eclipse.
The same application doesn't run if run through web server Tomcat 6.0
String lineSeparator = System.getProperty("file.separator");
String path1=lineSeparator.concat(lineSeparator).concat("188.10.1.5").concat(lineSeparator).concat("aps3b2-share").concat(lineSeparator).concat("tiger").concat(lineSeparator);
File pathtest1 = new File(path1);
if (pathtest1.exists())
{
fullpath = lineSeparator.concat(lineSeparator).concat("188.10.1.5").concat(lineSeparator).concat("aps3b2-share").concat(lineSeparator).concat("tiger").concat(lineSeparator);
}
else
{
errmount="Please Mount the APS 3B2 Share using //188.10.1.5 on this system and then login!!!.";
errval=1; } System.out.println("In login"+fullpath);
Actually, i want to get the modified date and time of the file from the file server to upload. Hence, i am checking whether the web application can access the root folder of the server to access the file.
But, this works perfectly under Eclipse but when i put as a WAR file in Tomcat 6.0 it doesn't work.
I have tried UNCPath, backslash and forward slash with no result.
Could you please anyone help on this?
Many thanks in advance, Kotteeswaran
Make sure you have access rights. Also make sure the app running in web server can access the location you are specifying. Try to output the location and go there manually from the browser window to see if it could find it.
You should be able to read files, so it is most likely access or incorrect path problem.
精彩评论