`
g4_gc
  • 浏览: 61810 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

解决Jetty运行时锁定静态文件(css, js, image)的问题

    博客分类:
  • ssh
 
阅读更多

 

解决Jetty运行时锁定静态文件(css, js, image)的问题
2009年08月21日 星期五 10:05

开发中用run-jetty-run插件启动jetty调式tapestry5应用。tapestry5的live class loader用起来非常爽, 不管你改page class还是html模板都不用重启server。 但是有一个例外,那就是jetty起来之后css, js文件会被jetty锁住, 然后用eclipse修改不了。 所以改css js都非常麻烦, 每改一下就要重启下jetty。google之后发现原来:

引用

Jetty buffers static content for webapps such as html files, css files, images etc and uses memory mapped files to do this if the NIO connectors are being used. The problem is that on Windows, memory mapping a file causes the file to be locked, so that the file cannot be updated or replaced. This means that effectively you have to stop Jetty in order to update a file.


怪不得以前在ubuntu下没有这个问题,转到windows下就发现这个问题了。 

解决办法就是找到run-jetty-run插件里面的jetty.jar。jetty.jar可以在eclipse中的jetty启动里面的Classpath中找到。 看下图 

解决Jetty运行时锁定静态文件(css, js, image)的问题_丁春华 - sun - 学无止境


找到jetty.jar后解压,编辑org/mortbay/jetty/webapp/webdefault.xml这个文件。把useFileMappedBuffer改成false。这里也就是禁用memory mapped file. 

Xml代码
useFileMappedBuffer true <!-- change to false -->

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics