2010-10-28 80 views
0

我想從我的Web應用程序訪問網絡文件。無法從運行在tomcat 6.0上的jsp訪問網絡映射的驅動器

我已經建立了Web應用程序(即訪問網絡共享文件夾和文件)及其在eclipse下完美的作品。

如果通過web服務器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);

其實,我想從文件服務器上傳文件的修改日期和時間。因此,我正在檢查Web應用程序是否可以訪問服務器的根文件夾以訪問該文件。

但是,這在Eclipse中完美的工作,但是當我把它作爲WAR文件在Tomcat 6.0中不起作用。

我試過UNCPATH,反斜槓和正斜槓沒有結果。

你能請任何人幫忙嗎?

提前許多感謝, Kotteeswaran

回答

0

請確保您有訪問權限。還要確保在Web服務器上運行的應用程序可以訪問您指定的位置。嘗試輸出位置,然後從瀏覽器窗口手動進入,以查看是否可以找到它。

你應該能夠讀取文件,所以它很可能是訪問或不正確的路徑問題。

+0

我試圖輸出並能夠從瀏覽器訪問指定的位置。請幫助我如何確保網絡應用程序能夠訪問指定的位置。 – 2010-11-20 10:20:47

+0

請幫幫我! – 2010-11-20 10:22:05

+0

最有可能你沒有使用正確的道路。你會得到什麼錯誤? – 2010-11-29 21:31:02

相關問題