解决用run-jetty-run锁住css,js文件的问题。

开发中用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.jar后解压,编辑org/mortbay/jetty/webapp/webdefault.xml这个文件。把useFileMappedBuffer改成false。这里也就是禁用memory mapped file. 

Xml代码   收藏代码
  1. <init-param>  
  2.   <param-name>useFileMappedBuffer</param-name>  
  3.   <param-value>true</param-value> <!-- change to false -->  
  4. </init-param>  


改完之后再把你改的打包成jar. 启动jetty后就能改css, js静态文件了。 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值