我正在使用定制Jetty容器在开发模式下运行一个GWT应用程序。该应用程序第一次加载良好,但是,如果我刷新它,我会在“开发模式”窗口中得到以下错误(路径更改):
00:16:44.854 [ERROR] Unable to create file 'C:\somePath\src\war\msjavaSnack\C4EA130FD0ED44BE513FEEDDE13614DA.cache.png'
java.io.FileNotFoundException: C:\somePath\src\war\msjavaSnack\C4EA130FD0ED44BE513FEEDDE13614DA.cache.png (The requested operation cannot be performed on a file with a user-mapped section open)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:194)
at java.io.FileOutputStream.<init>(FileOutputStream.java:145)
at com.google.gwt.core.ext.linker.impl.StandardLinkerContext.writeArtifactToFile(StandardLinkerContext.java:658)
at com.google.gwt.core.ext.linker.impl.StandardLinkerContext.produceOutputDirectory(StandardLinkerContext.java:595)
at com.google.gwt.dev.DevMode.produceOutput(DevMode.java:476)
at com.google.gwt.dev.DevModeBase.relink(DevModeBase.java:1131)
at com.google.gwt.dev.DevModeBase.access$000(DevModeBase.java:67)
at com.google.gwt.dev.DevModeBase$2.accept(DevModeBase.java:1076)
at com.google.gwt.dev.shell.ShellModuleSpaceHost$1.accept(ShellModuleSpaceHost.java:122)
at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:59)
at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:154)
at com.google.gwt.dev.shell.ShellModuleSpaceHost.rebind(ShellModuleSpaceHost.java:119)
at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:531)
at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:414)
at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:39)
at com.google.gwt.core.client.GWT.create(GWT.java:98)
at com.extjs.gxt.ui.client.GXT.<clinit>(GXT.java:38)
at com.extjs.gxt.ui.client.widget.Component.<clinit>(Component.java:202)
at msjava.snack.gui.client.MSHeaderPanelViewport.<init>(MSHeaderPanelViewport.java:62)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:422)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:361)
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:185)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:380)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
at java.lang.Thread.run(Thread.java:662)更新
在ProcessExplorer中,我可以看到托管Jetty的JVM进程对文件有一个打开句柄,所以这可能是其他JVM (宿主dev模式)不能写入它的原因。有办法解决吗?
发布于 2013-05-16 14:39:33
我在这页上找到了解决方案:
http://docs.codehaus.org/display/JETTY/Files+locked+on+Windows
编辑:
上面的URL现在已经死了。
现在很容易在Jetty的wiki中找到解决方案:
Jetty在webdefault.xml文件中为DefaultServlet提供了一个配置开关,用于启用或禁用内存映射文件的使用。如果您正在Windows上运行,并且存在文件锁定问题,则应将此开关设置为禁用内存映射文件缓冲区。 默认的webdefault.xml文件位于org/eclipse/jetty/webapp/webdefault.xml的lib/jetty.jar中。将其解压缩到一个方便的磁盘位置,并编辑它以将useFileMappedBuffer更改为false。
发布于 2013-05-13 15:03:53
似乎同一文件上的两个(打开/关闭)(打开/关闭)规则一个接一个地发生太快,导致.一些开发人员建议调用gc。检查是否正确关闭每个i/o操作。不要太快地执行完全(打开、循环(写)、关闭)。看起来,当第二个请求到达时,当一个操作完成时,就会抛出问题。
https://stackoverflow.com/questions/16524432
复制相似问题