I've recently started having the same problem, usually happens after a fresh build/deploy. My workaround was to modify the SmapUtil class. If the rename fails on the first try, it waits 50ms then retries (loops as needed). So far it always works on the second try after the 50ms delay.
Do you have a virus scan running on your machine? The reason I ask is that my guess is that this is an operating system level issue. On windows, if I am viewing a file in Word and try to rename , delete, or move it, I get a windows error message. I am guessing that perhaps some other process outside of JBOSS might be trying to read the file and a race condition can sometimes occur.
Thats the same thing we've been thinking here is that its an OS level issue, not actually a JBoss problem. Symantec antivirus is running, but after disabling all the symantec related services and turning off the auto-protect, the issue was still there. Maybe it needs to be completely uninstalled or its another program causing the problem.
The SmapUtil code causing the problem basically does
copy A -> B
<other stuff here>
rename B -> A
and according to some documentation with Java in Windows, the rename will fail if the filename you are trying to rename to already exists, which makes me think the delete is being slightly delayed for some reason. With my code change to:
rename B -> A
the problem does not show up.
After a complete uninstall of symantec, the issue seems to have disappeared during my limited testing.