Search code examples
intellij-ideaweb-deploymentjetty-8

intellij11 error when redeploying static files to jetty


all.

I got exactly same scenario like this one - Jetty Maven Plugin is ignoring custom webdefault.xml

the only difference is that I try to deploy my app to local jetty8 inside intellij11 on windows 7

the error is

Error copying 'myproj\src\main\webapp\less\defaults.less' to 'myproj\target\myproj.war
\less\defaults.less'.: myproj\target\myproj.war\less\defaults.less 
(The requested operation cannot be performed on a file with a user-mapped section open)

I updated the webdefault.xml and set useFileMappedBuffer to false and later again I added in my filter config in web.xml which should also override the default but nothing helps.

I start jetty with default etc/jetty-jmx.xml.

what am I missing?


Solution

  • finally I managed to solve the issue.

    following this page http://wiki.eclipse.org/Jetty/Howto/Deal_with_Locked_Windows_Files, unfortunately this page is outdated and the only way to keep resources unlocked, that worked for me, is

    <servlet>
     <servlet-name>default</servlet-name>
     <servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class>
     <init-param>
       <param-name>useFileMappedBuffer</param-name>
       <param-value>false</param-value>
     </init-param>
     <load-on-startup>0</load-on-startup>
    </servlet>
    

    note that package have changed to org.eclipse.jetty since 7th version. the other solutions seems to be broken as jetty doesnt recognize context ref or throws other exceptions.

    hope that this will help someone.