【发布时间】:2013-03-06 14:26:47
【问题描述】:
我有以下代码,它在我的本地开发服务器上运行良好,但是当我上传到部署服务器时,我总是遇到文件未找到异常
String urlStr = "http://" + getContext().getRequest().getServerName() +
getContext().getServletContext().getContextPath() + "test.action";
URL url = new URL(urlStr);
InputStream input = url.openStream(); //Error always occurs here, it gives me the correct URL but it says file not found.
谁能帮我解决这个问题?
【问题讨论】:
-
您的应用服务器的名称?
-
抱歉,打错字了。
-
应用服务器是EatJ服务器
-
为什么不打印出
urlStr看看里面有什么? -
我试过了,这是一个正确的 URL,我使用该 URL 将它粘贴到我的浏览器上,它可以工作。
标签: java url stream filenotfoundexception