2013-05-13 116 views
0

我正在用自定義碼頭集裝箱的一個開發模式GWT應用程序。該應用程序加載罰款的第一次,但是,如果我刷新它,我得到的發展模式窗口下面的錯誤(路徑變更):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) 

UPDATE

在ProcessExplorer我可以看到託管Jetty的JVM進程有一個打開的文件句柄,所以這可能是其他JVM(託管dev模式)無法寫入文件的原因。任何方式來解決它?

+0

你有一個防病毒? (哦,在Windows上,你應該,但你應該禁用它爲您的工作空間) – 2013-05-13 14:30:26

回答

0

,我發現這個頁面上的解決方案:

http://docs.codehaus.org/display/JETTY/Files+locked+on+Windows

編輯:

上面的網址現在已經死了。

現在,它很容易找到碼頭的wiki解決方案:

碼頭提供了webdefault.xml文件中的配置開關 ,允許或禁止使用的內存映射 文件DefaultServlet。如果您在Windows上運行,並且具有文件鎖定 的問題,您應該將此開關設置爲禁用內存映射文件 緩衝區。

默認的webdefault.xml文件在位於org/eclipse/jetty/webapp/webdefault.xml的 的lib/jetty.jar中。它解壓到一個方便 磁盤位置,並對其進行編輯以useFileMappedBuffer更改爲false。

https://wiki.eclipse.org/Jetty/Howto/Deal_with_Locked_Windows_Files

+0

能否請您發佈的內容,這種解決辦法?鏈接被破壞。 – Navigateur 2015-07-04 21:05:37

+0

我編輯了答案 – milosz 2015-07-06 12:36:08

+0

真棒,謝謝 – Navigateur 2015-07-06 12:47:28

0

看來,兩(開/關)(開/關)rutines在同一文件太快了一個又一個原因,這個......一些開發商提出來調用GC發生。檢查每個I/O操作是否正確關閉。不要太快地執行完成(打開,循環(寫入),關閉)。看起來,當一個操作將在第二個請求到達時完成並引發問題。