Jetty Java files Cannot delete java files consume delete invalid runtime lock static resource resolution

Source: Internet
Author: User

a few days ago jetty found that Java can not delete files, the file operation has been occupied by the JVM, but changed the tomcat problem disappeared. today again, try the online solution, after I test, directly modify the configuration file sometimes can not take effect, the specific reasons are unclear, we recommend the use of directly modify the Web. xml Filethe red part of the following

files are locked because jetty maps these files in memory by default when using Windows systems, and Windows locks memory-mapped files.    The workaround is to modify the configuration of the jetty so that it sets the Usefilemappedbuffer flag bit to False when starting the server.

There are two ways to set up a method, one is to modify the Usefilemappdbuffer flag bit in the Webdefault.xml file. The Webdefault.xml file is a configuration file for the Jetty startup service, and the Web-inf/web.xml file its first in the project is loaded. This file is available by default in the jetty package, which can be extracted, saved in the project root directory, and modified by the Usefilemappedbuffer node.

12
<param-name>useFileMappedBuffer</param-name><param-value>false</param-value>

A reference to this file is then added to the Build.gradle.

123 
[jettyRun, jettyRunWar,jettyStop]*.with { webDefaultXml = file("${rootDir}/webdefault.xml")}

 The second method is to modify the files in the project to WEB-INF/web.xml include this node.

12345 6789 
 <  Servlet><!--Override init parameter to avoid nasty--> <!--file locking issue on Windows.--> <servlet-name >default</servlet-name> <init-param> <param-name>usefilemappedbuffer</param-name><param-value>false</param-value> </init-param></SERVLET>      

Jetty Java files cannot delete java files consuming delete invalid runtime locking of static resources workaround

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.