jetty文件服务器,在Jetty中访问Web容器外部的文件

我在Windows XP SP3中使用Eclipse 3.6开发GWT应用程序。该应用程序需要显示驻留在服务器上的图形文件夹的内容到客户端。此外,图形文件夹不在Web容器内,而在硬盘中的另一个位置。 Eclispe使用Jetty HTTP服务器运行Web应用程序。我在我的RemoteServiceServlet中使用以下代码片段来测试文件访问并获取文本文件的内容。在Jetty中访问Web容器外部的文件

File inputFile = new File("C:\\mytext.txt");

FileReader fin = new FileReader(inputFile);

char c[] = new char[(char)inputFile.length()];

int i;

i = fin.read(c);

s = new String(c);

不幸的是我得到一个错误,我不知道如何翻译它以纠正代码(或任何配置文件)。

Initializing AppEngine server

Unable to access http://appengine.google.com/api/updatecheck?runtime=java&release=1.5.1&timestamp=1308100600&api_versions=['1.0']

java.net.UnknownHostException: appengine.google.com

at java.net.PlainSocketImpl.connect(Unknown Source)

at java.net.SocksSocketImpl.connect(Unknown Source)

at java.net.Socket.connect(Unknown Source)

at java.net.Socket.connect(Unknown Source)

at sun.net.NetworkClient.doConnect(Unknown Source)

at sun.net.www.http.HttpClient.openServer(Unknown Source)

at sun.net.www.http.HttpClient.openServer(Unknown Source)

at sun.net.www.http.HttpClient.(Unknown Source)

at sun.net.www.http.HttpClient.New(Unknown Source)

at sun.net.www.http.HttpClient.New(Unknown Source)

at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)

at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)

at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)

at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)

at java.net.URL.openStream(Unknown Source)

at com.google.appengine.tools.info.RemoteVersionFactory.getVersion(RemoteVersionFactory.java:76)

at com.google.appengine.tools.info.UpdateCheck.checkForUpdates(UpdateCheck.java:99)

at com.google.appengine.tools.info.UpdateCheck.doNagScreen(UpdateCheck.java:174)

at com.google.appengine.tools.info.UpdateCheck.maybePrintNagScreen(UpdateCheck.java:142)

at com.google.appengine.tools.development.gwt.AppEngineLauncher.maybePerformUpdateCheck(AppEngineLauncher.java:137)

at com.google.appengine.tools.development.gwt.AppEngineLauncher.start(AppEngineLauncher.java:103)

at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:500)

at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1055)

at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:804)

at com.google.gwt.dev.DevMode.main(DevMode.java:309)

Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger

Successfully processed C:\Documents and Settings\Giorgos\workspace\Zserver\war\WEB-INF/appengine-web.xml

Successfully processed C:\Documents and Settings\Giorgos\workspace\Zserver\war\WEB-INF/web.xml

The server is running at http://localhost:8888/

[ERROR] javax.servlet.ServletContext log: Exception while dispatching incoming RPC call

com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract java.lang.String mytest.client.GreetingService.greetServer(java.lang.String) throws java.lang.IllegalArgumentException' threw an unexpected exception: java.security.AccessControlException: access denied (java.io.FilePermission C:\mytext.txt read)

at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:385)

at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:588)

at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)

at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)

at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)

at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)

at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:35)

at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)

at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:58)

at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)

at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)

at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)

at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122)

at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)

at com.google.appengine.tools.development.BackendServersFilter.doFilter(BackendServersFilter.java:97)

at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)

at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)

at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)

at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)

at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)

at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)

at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:70)

at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:351)

at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

at org.mortbay.jetty.Server.handle(Server.java:326)

at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)

at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)

at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)

at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)

at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)

at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)

at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

Caused by: java.security.AccessControlException: access denied (java.io.FilePermission C:\mytext.txt read)

at java.security.AccessControlContext.checkPermission(Unknown Source)

at java.security.AccessController.checkPermission(Unknown Source)

at java.lang.SecurityManager.checkPermission(Unknown Source)

at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:166)

at java.lang.SecurityManager.checkRead(Unknown Source)

at java.io.FileInputStream.(Unknown Source)

at java.io.FileReader.(Unknown Source)

at mytest.server.GreetingServiceImpl.greetServer(GreetingServiceImpl.java:34)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:100)

at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)

... 34 more

参与评论 您还未登录,请先 登录 后发表或查看评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:1024 设计师:我叫白小胖 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值