无法从在 tomcat 6.0 上运行的 jsp 访问网络映射驱动器
我想从我的网络应用程序访问网络文件。
我已经构建了 Web 应用程序(访问网络共享文件夹和文件)并且它在 Eclipse 下完美运行。
运行,则同一应用程序不会运行
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!!!.";
如果通过 Web 服务器 Tomcat 6.0 errval=1 ; } System.out.println("登录中"+完整路径);
实际上,我想从文件服务器获取文件的修改日期和时间来上传。因此,我正在检查 Web 应用程序是否可以访问服务器的根文件夹来访问该文件。
但是,这在 Eclipse 下工作得很好,但是当我将其作为 WAR 文件放入 Tomcat 6.0 中时,它不起作用。
我尝试过 UNCPath、反斜杠和正斜杠,但没有结果。
你能请任何人帮忙吗?
预先非常感谢, 科蒂斯瓦兰
I want to access the network 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保您有访问权限。另请确保在 Web 服务器中运行的应用程序可以访问您指定的位置。尝试输出位置并从浏览器窗口手动转到那里,看看是否可以找到它。
您应该能够读取文件,因此很可能是访问或路径错误的问题。
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.