Bug 114951

Summary: Can't close/saveall project: Error "Cannot get exclusive access"
Product: javaee Reporter: _ krystyna <krystyna>
Component: Web ProjectAssignee: David Konecny <dkonecny>
Status: RESOLVED WONTFIX QA Contact: issues <issues.netbeans.org>
Priority: P3 CC: blaha, jhorvath, markdey, mfukala, mmirilovic, potingwu, ppisl, rmatous, sandipchitale, yousufh
Version: 6.x   
Target Milestone: 6.x   
Hardware: Other   
OS: All   
Whiteboard: beta1fix
Issue Type: DEFECT Exception Report:
Attachments: full stacktrace
Message log for non-visualweb project case.

Description _ krystyna 2007-09-06 22:20:02 UTC
NB Beta1 09061200
XP 
JDK1.5.0_12


Please assign to appropriate category

This is Intermittently reproducible after successive File->Close WebApps
and then File->Open recent project.  The result is eventually the project cannot be closed --  
any incremental changes done to the project cannot be saved.

Start with a clean userdir and create a simple VWP ee5 project

1. Drop a component, such as "dropdown list"
2. File -> "Close WebApplicationX" and select Save All
3. File -> Open Recent Project [this project] 
4. (File opens to .jsp view) Switch to design tab.

Repeat above steps. Eventually, by the ~third File->Close we get

>Error dialog to screen:
 

Cannot get exclusive access to C:\Documents and Settings\Krystyna Polomski\My 
Documents\NetBeansProjects\WebApplication490\web\Page1.jsp (probably opened for reading).

3. OK this error dialog
4. Save all dialog is still up. 

>Only choice is to discard all at this point to get back to the project, but the project
cannot be saved.

Continuing however with these limited choices makes further problems downstream.
I received a Source File Error to the screen switching tabs in the multiviewer.

(partial stack below; full attached)
SEVERE:  Cannot get exclusive access to C:\Documents and Settings\Krystyna Polomski\My 
Documents\NetBeansProjects\WebApplication490\web\Page1.jsp (probably opened for reading).
Caused by: org.openide.ErrorManager$AnnException: msg
        at org.openide.ErrorManager$AnnException.findOrCreate(ErrorManager.java:839)
        at org.openide.ErrorManager$AnnException.findOrCreate(ErrorManager.java:853)
        at org.openide.ErrorManager$DelegatingErrorManager.annotate(ErrorManager.java:628)
        at org.openide.ErrorManager.annotate(ErrorManager.java:430)
        at org.netbeans.modules.project.ui.ExitDialog.save(ExitDialog.java:181)
        at org.netbeans.modules.project.ui.ExitDialog.save(ExitDialog.java:154)
        at org.netbeans.modules.project.ui.ExitDialog.actionPerformed(ExitDialog.java:135)
        at org.netbeans.core.windows.services.NbPresenter$ButtonListener.actionPerformed(NbPresenter.java:1060)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
        at java.awt.Component.processMouseEvent(Component.java:5517)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
        at java.awt.Component.processEvent(Component.java:5282)
        at java.awt.Container.processEvent(Container.java:1966)
        at java.awt.Component.dispatchEventImpl(Component.java:3984)
        at java.awt.Container.dispatchEventImpl(Container.java:2024)
        at java.awt.Component.dispatchEvent(Component.java:3819)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
        at java.awt.Container.dispatchEventImpl(Container.java:2010)
        at java.awt.Window.dispatchEventImpl(Window.java:1791)
        at java.awt.Component.dispatchEvent(Component.java:3819)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:153)
        at java.awt.Dialog$1.run(Dialog.java:535)
        at java.awt.Dialog$2.run(Dialog.java:563)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.Dialog.show(Dialog.java:561)
        at org.netbeans.core.windows.services.NbPresenter.superShow(NbPresenter.java:812)
        at org.netbeans.core.windows.services.NbPresenter.doShow(NbPresenter.java:846)
        at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:834)
        at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:82)
        at org.openide.util.Mutex.doEventAccess(Mutex.java:1201)
        at org.openide.util.Mutex.readAccess(Mutex.java:220)
        at org.netbeans.core.windows.services.NbPresenter.show(NbPresenter.java:819)
        at java.awt.Component.show(Component.java:1302)
        at java.awt.Component.setVisible(Component.java:1255)
        at org.netbeans.modules.project.ui.ExitDialog.innerShowDialog(ExitDialog.java:294)
        at org.netbeans.modules.project.ui.ExitDialog.showDialog(ExitDialog.java:224)
        at org.netbeans.modules.project.ui.ProjectUtilities$1.doClose(ProjectUtilities.java:171)
        at org.netbeans.modules.project.ui.ProjectUtilities$1.close(ProjectUtilities.java:103)
        at org.netbeans.modules.project.ui.ProjectUtilities.closeAllDocuments(ProjectUtilities.java:415)
        at org.netbeans.modules.project.ui.OpenProjectList.close(OpenProjectList.java:380)
        at org.netbeans.modules.project.ui.actions.CloseProject.actionPerformed(CloseProject.java:60)
        at org.netbeans.modules.project.ui.actions.LookupSensitiveAction.actionPerformed(LookupSensitiveAction.java:139)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
        at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
        at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1051)
        at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1092)
        at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:231)
        at java.awt.Component.processMouseEvent(Component.java:5517)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
        at java.awt.Component.processEvent(Component.java:5282)
        at java.awt.Container.processEvent(Container.java:1966)
        at java.awt.Component.dispatchEventImpl(Component.java:3984)
        at java.awt.Container.dispatchEventImpl(Container.java:2024)
        at java.awt.Component.dispatchEvent(Component.java:3819)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
        at java.awt.Container.dispatchEventImpl(Container.java:2010)
        at java.awt.Window.dispatchEventImpl(Window.java:1791)
        at java.awt.Component.dispatchEvent(Component.java:3819)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
msg
Caused: org.netbeans.modules.masterfs.filebasedfs.utils.FSException: Cannot get exclusive access to C:\Documents and 
Settings\Krystyna Polomski\My Documents\NetBeansProjects\WebApplication490\web\Page1.jsp (probably opened for reading).
        at org.netbeans.modules.masterfs.filebasedfs.utils.FSException.io(FSException.java:103)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.MutualExclusionSupport.addResource
(MutualExclusionSupport.java:77)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj.getOutputStream(FileObj.java:66)
        at org.netbeans.modules.masterfs.MasterFileObject.getOutputStream(MasterFileObject.java:158)
        at org.openide.text.DataEditorSupport$Env.outputStream(DataEditorSupport.java:629)
        at org.openide.text.CloneableEditorSupport$1SaveAsReader.run(CloneableEditorSupport.java:807)
        at org.netbeans.editor.BaseDocument.render(BaseDocument.java:1162)
        at org.openide.text.CloneableEditorSupport.saveDocument(CloneableEditorSupport.java:855)
        at org.openide.text.DataEditorSupport.saveDocument(DataEditorSupport.java:321)
        at org.netbeans.modules.visualweb.project.jsfloader.JsfJspEditorSupport.saveDocument
(JsfJspEditorSupport.java:224)
        at org.netbeans.modules.visualweb.project.jsfloader.JsfJspEditorSupport.saveDocument
(JsfJspEditorSupport.java:179)
        at org.netbeans.modules.visualweb.project.jsfloader.JsfJspEditorSupport$1.save(JsfJspEditorSupport.java:91)
        at org.netbeans.modules.visualweb.project.jsfloader.CompoundSaveCookie.save(CompoundSaveCookie.java:61)
Comment 1 _ krystyna 2007-09-06 22:21:07 UTC
Created attachment 48329 [details]
full stacktrace
Comment 2 _ krystyna 2007-09-07 01:26:23 UTC
I am upgrading this to a P1 because I have Reproduced with Plain Web project -
on both Windows and Solaris using jdk1.5.0_12 with Beta1 09061200. I have not
been able to reproduce with jdk1.6.

There are a couple of paths to reproducing: make edits, then press toolbar save all, then contextmenu on web project to
close *or* edit, then press File->Close on the project. Two or three cycles of either method then File>Reopen project 
will reproduce the error. Thereafter no more data can be saved to the project.




Comment 3 Jiri Prox 2007-09-07 07:24:48 UTC
There in nothing from editor in the stacktrace, it probably openide or project bug. Reassigning
Comment 4 Milos Kleint 2007-09-07 10:29:35 UTC
the problem is with the web/Page1.jsp file.
probably something in 
org.netbeans.modules.visualweb.project.jsfloader.JsfJspEditorSupport or
org.netbeans.modules.visualweb.project.jsfloader.CompoundSaveCookie.save()

reassigning to visualweb
Comment 5 rmatous 2007-09-07 12:22:51 UTC
FS part says, that writing to *.jsp file isn't save to do because reading from it is still in progress (even after
2000ms delay) - thus exception is thrown. In other words FS tries to ensure reading/writing exclusivity.

Milos is probably right, visualweb.
Comment 6 _ sandipchitale 2007-09-07 15:13:42 UTC
Additional info:

As mentioned by Krystina the exception occurs for a non-visual web project also. Open project, modify welcomeJSF.jsp ans
save, close project. After second or third try the exception occurs.

Attaching the message log for my run.
Comment 7 _ sandipchitale 2007-09-07 15:15:52 UTC
Created attachment 48405 [details]
Message log for non-visualweb project case.
Comment 8 Peter Zavadsky 2007-09-07 15:34:36 UTC
The designer doesn't manage the files. Why is it assigned here?

OK, Sandip provided it is reproducible for non-visual projects as well, passing there.


Comment 9 _ sandipchitale 2007-09-07 18:12:45 UTC
If it helps debugging...I set a breakpoint inside on FileInputStrem CTOR and dumped the stacks. Here are a few stack
traces just prior to the exception in a non-visualweb JSF page. In the last exception notice the call to :

org.netbeans.modules.localhistory.utils.FileUtils.copy() method from within the 
org.openide.text.DataEditorSupport$Env.outputStream() call which is saving the document.

Try to reproduce with LocalHistory module turned off.

java.lang.Exception: Stack trace
	at java.io.FileInputStream.<init>(FileInputStream.java:106)
	at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj$2.<init>(FileObj.java:110)
	at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj.getInputStream(FileObj.java:109)
	at org.netbeans.modules.masterfs.MasterFileObject.getInputStream(MasterFileObject.java:148)
	at org.openide.text.DataEditorSupport$Env.inputStream(DataEditorSupport.java:607)
	at org.openide.text.CloneableEditorSupport.getInputStream(CloneableEditorSupport.java:1296)
	at org.netbeans.modules.web.core.jsploader.JspParserAccess$WM.getEditorInputStream(JspParserAccess.java:112)
	at org.netbeans.modules.web.jspparser.ParserServletContext.getResourceAsStream(ParserServletContext.java:292)
	at org.apache.jasper.JspCompilationContext.getResourceAsStream(JspCompilationContext.java:304)
	at org.apache.jasper.compiler.JspUtil.getInputStream(JspUtil.java:890)
	at org.apache.jasper.compiler.JspUtil.getReader(JspUtil.java:1090)
	at org.apache.jasper.compiler.JspReader.<init>(JspReader.java:103)
	at org.apache.jasper.compiler.ParserController.determineSyntaxAndEncoding(ParserController.java:411)
	at sun.reflect.GeneratedMethodAccessor80.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.apache.jasper.compiler.ParserControllerProxy.extractSyntaxAndEncoding(ParserControllerProxy.java:113)
	at org.apache.jasper.compiler.ParserControllerProxy.extractSyntaxAndEncoding(ParserControllerProxy.java:101)
	at org.apache.jasper.compiler.ExtractPageData.extractPageData(ExtractPageData.java:108)
	at org.apache.jasper.compiler.ExtractPageData.isXMLSyntax(ExtractPageData.java:52)
	at org.netbeans.modules.web.jspparser_ext.WebAppParseSupport.getJspOpenInfo(WebAppParseSupport.java:149)
	at org.netbeans.modules.web.jspparser.JspParserImpl.getJspOpenInfo(JspParserImpl.java:124)
	at org.netbeans.modules.web.core.jsploader.TagLibParseSupport.getCachedOpenInfo(TagLibParseSupport.java:247)
	at org.netbeans.modules.web.core.jsploader.JspContextInfoImpl.getCachedOpenInfo(JspContextInfoImpl.java:123)
	at org.netbeans.modules.web.core.syntax.JSPKit.createSyntaxSupport(JSPKit.java:259)
	at org.netbeans.editor.BaseDocument.getSyntaxSupport(BaseDocument.java:453)
	at org.netbeans.modules.web.core.syntax.folding.JspFoldManager.generateFolds(JspFoldManager.java:191)
	at org.netbeans.modules.web.core.syntax.folding.JspFoldManager.updateFolds(JspFoldManager.java:385)
	at org.netbeans.modules.web.core.syntax.folding.JspFoldManager.access$100(JspFoldManager.java:66)
	at org.netbeans.modules.web.core.syntax.folding.JspFoldManager$1$1.run(JspFoldManager.java:128)
	at java.lang.Thread.run(Thread.java:595)
java.lang.Exception: Stack trace
	at java.io.FileInputStream.<init>(FileInputStream.java:106)
	at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj$2.<init>(FileObj.java:110)
	at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj.getInputStream(FileObj.java:109)
	at org.netbeans.modules.masterfs.MasterFileObject.getInputStream(MasterFileObject.java:148)
	at org.netbeans.modules.web.jspparser.FastOpenInfoParser.getJspOpenInfo(FastOpenInfoParser.java:107)
	at org.netbeans.modules.web.jspparser.JspParserImpl.getJspOpenInfo(JspParserImpl.java:115)
	at org.netbeans.modules.web.core.jsploader.TagLibParseSupport.getCachedOpenInfo(TagLibParseSupport.java:247)
	at org.netbeans.modules.web.core.jsploader.JspDataObject.updateFileEncoding(JspDataObject.java:183)
	at org.netbeans.modules.web.core.jsploader.BaseJspEditorSupport.open(BaseJspEditorSupport.java:209)
	at org.openide.windows.CloneableOpenSupport.edit(CloneableOpenSupport.java:96)
	at org.netbeans.modules.project.ui.ProjectUtilities$1.open(ProjectUtilities.java:87)
	at org.netbeans.modules.project.ui.ProjectUtilities.openProjectFiles(ProjectUtilities.java:494)
	at org.netbeans.modules.project.ui.OpenProjectList$5.run(OpenProjectList.java:696)
	at org.netbeans.modules.project.ui.OpenProjectList$5.run(OpenProjectList.java:694)
	at org.openide.util.Mutex$1AWTWorker.run(Mutex.java:1216)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:153)
	at java.awt.Dialog$1.run(Dialog.java:525)
	at java.awt.Dialog$2.run(Dialog.java:553)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.awt.Dialog.show(Dialog.java:551)
	at java.awt.Component.show(Component.java:1300)
	at java.awt.Component.setVisible(Component.java:1253)
	at org.netbeans.modules.project.ui.OpenProjectList.open(OpenProjectList.java:255)
	at org.netbeans.modules.project.ui.actions.RecentProjects$MenuItemActionListener.actionPerformed(RecentProjects.java:182)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
	at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
	at java.awt.Component.processMouseEvent(Component.java:5501)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
	at java.awt.Component.processEvent(Component.java:5266)
	at java.awt.Container.processEvent(Container.java:1966)
	at java.awt.Component.dispatchEventImpl(Component.java:3968)
	at java.awt.Container.dispatchEventImpl(Container.java:2024)
	at java.awt.Component.dispatchEvent(Component.java:3803)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
	at java.awt.Container.dispatchEventImpl(Container.java:2010)
	at java.awt.Window.dispatchEventImpl(Window.java:1778)
	at java.awt.Component.dispatchEvent(Component.java:3803)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
java.lang.Exception: Stack trace
	at java.io.FileInputStream.<init>(FileInputStream.java:106)
	at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj$2.<init>(FileObj.java:110)
	at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj.getInputStream(FileObj.java:109)
	at org.netbeans.modules.masterfs.MasterFileObject.getInputStream(MasterFileObject.java:148)
	at org.openide.text.DataEditorSupport$Env.inputStream(DataEditorSupport.java:607)
	at org.openide.text.CloneableEditorSupport.loadDocument(CloneableEditorSupport.java:1803)
	at org.openide.text.CloneableEditorSupport.access$1800(CloneableEditorSupport.java:94)
	at org.openide.text.CloneableEditorSupport$Listener.run(CloneableEditorSupport.java:2501)
	at org.openide.text.CloneableEditorSupport$2.run(CloneableEditorSupport.java:552)
	at org.netbeans.editor.GuardedDocument.runAtomic(GuardedDocument.java:229)
	at org.openide.text.NbDocument.runAtomic(NbDocument.java:362)
	at org.openide.text.CloneableEditorSupport$2.run(CloneableEditorSupport.java:533)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:539)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:964)
java.lang.Exception: Stack trace
	at java.io.FileInputStream.<init>(FileInputStream.java:106)
	at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj$2.<init>(FileObj.java:110)
	at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj.getInputStream(FileObj.java:109)
	at org.netbeans.modules.masterfs.MasterFileObject.getInputStream(MasterFileObject.java:148)
	at org.netbeans.modules.web.jspparser.FastOpenInfoParser.getJspOpenInfo(FastOpenInfoParser.java:107)
	at org.netbeans.modules.web.jspparser.JspParserImpl.getJspOpenInfo(JspParserImpl.java:115)
	at org.netbeans.modules.web.core.jsploader.TagLibParseSupport.getCachedOpenInfo(TagLibParseSupport.java:247)
	at org.netbeans.modules.web.core.jsploader.JspDataObject.updateFileEncoding(JspDataObject.java:183)
	at org.netbeans.modules.web.core.jsploader.BaseJspEditorSupport.loadFromStreamToKit(BaseJspEditorSupport.java:203)
	at org.openide.text.CloneableEditorSupport.loadDocument(CloneableEditorSupport.java:1807)
	at org.openide.text.CloneableEditorSupport.access$1800(CloneableEditorSupport.java:94)
	at org.openide.text.CloneableEditorSupport$Listener.run(CloneableEditorSupport.java:2501)
	at org.openide.text.CloneableEditorSupport$2.run(CloneableEditorSupport.java:552)
	at org.netbeans.editor.GuardedDocument.runAtomic(GuardedDocument.java:229)
	at org.openide.text.NbDocument.runAtomic(NbDocument.java:362)
	at org.openide.text.CloneableEditorSupport$2.run(CloneableEditorSupport.java:533)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:539)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:964)
Too many choices! startTag$3 : <TEXT,'\n            <h1>'> <TAG,'<h:outputText'>:<TEXT,'\n            <h1>'>
<TAG,'<h:outputText'> <WHITESPACE,' '> <ATTRIBUTE,'value'> <SYMBOL,'='> <ATTR_VALUE,'"JavaServer Faces"'> <WHITESPACE,'
'> <SYMBOL,'/>'> <TEXT,'</h1>\n        '> <ENDTAG,'</f:view'> 
INFO [org.netbeans.modules.web.debug]: JspTooltip: getShortDescription
INFO [org.netbeans.modules.web.debug]: JspTooltip: getShortDescription
INFO [org.netbeans.modules.web.debug]: JspTooltip: getShortDescription
INFO [org.netbeans.modules.web.debug]: JspTooltip: getShortDescription
INFO [org.netbeans.modules.web.debug]: JspTooltip: getShortDescription
Too many choices! startTag$3 : <TEXT,'\n            <h1>'> <TAG,'<h:outputText'>:<TEXT,'\n            <h1>'>
<TAG,'<h:outputText'> <WHITESPACE,' '> <ATTRIBUTE,'value'> <SYMBOL,'='> <ATTR_VALUE,'"JavaServer Faces"'> <WHITESPACE,'
'> <SYMBOL,'/>'> <TEXT,'</h1>\n        '> <ENDTAG,'</f:view'> 
java.lang.Exception: Stack trace
	at java.io.FileInputStream.<init>(FileInputStream.java:106)
	at org.netbeans.modules.localhistory.utils.FileUtils.createInputStream(FileUtils.java:217)
	at org.netbeans.modules.localhistory.utils.FileUtils.copy(FileUtils.java:88)
	at org.netbeans.modules.localhistory.store.LocalHistoryStoreImpl.fileChange(LocalHistoryStoreImpl.java:147)
	at org.netbeans.modules.localhistory.LocalHistoryVCSInterceptor.storeFile(LocalHistoryVCSInterceptor.java:204)
	at org.netbeans.modules.localhistory.LocalHistoryVCSInterceptor.beforeChange(LocalHistoryVCSInterceptor.java:195)
	at org.netbeans.modules.versioning.FilesystemInterceptor$DelegatingInterceptor.beforeChange(FilesystemInterceptor.java:397)
	at org.netbeans.modules.versioning.FilesystemInterceptor.beforeChange(FilesystemInterceptor.java:97)
	at org.netbeans.modules.masterfs.ProvidedExtensionsProxy$7.run(ProvidedExtensionsProxy.java:178)
	at org.netbeans.modules.masterfs.ProvidedExtensionsProxy.runCheckCode(ProvidedExtensionsProxy.java:223)
	at org.netbeans.modules.masterfs.ProvidedExtensionsProxy.beforeChange(ProvidedExtensionsProxy.java:176)
	at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj.getOutputStream(FileObj.java:64)
	at org.netbeans.modules.masterfs.MasterFileObject.getOutputStream(MasterFileObject.java:158)
	at org.openide.text.DataEditorSupport$Env.outputStream(DataEditorSupport.java:621)
	at org.openide.text.CloneableEditorSupport$1SaveAsReader.run(CloneableEditorSupport.java:807)
	at org.netbeans.editor.BaseDocument.render(BaseDocument.java:1162)
	at org.openide.text.CloneableEditorSupport.saveDocument(CloneableEditorSupport.java:855)
	at org.openide.text.DataEditorSupport.saveDocument(DataEditorSupport.java:321)
	at org.netbeans.modules.web.core.jsploader.BaseJspEditorSupport.saveDocument(BaseJspEditorSupport.java:353)
	at org.netbeans.modules.web.core.jsploader.BaseJspEditorSupport.saveDocument(BaseJspEditorSupport.java:300)
	at org.netbeans.modules.web.core.jsploader.BaseJspEditorSupport$5.save(BaseJspEditorSupport.java:265)
	at org.openide.actions.SaveAction.performAction(SaveAction.java:58)
	at org.openide.util.actions.NodeAction$DelegateAction$1.run(NodeAction.java:559)
	at org.netbeans.modules.openide.util.ActionsBridge.doPerformAction(ActionsBridge.java:55)
	at org.openide.util.actions.NodeAction$DelegateAction.actionPerformed(NodeAction.java:555)
	at org.openide.windows.TopComponent.processKeyBinding(TopComponent.java:933)
	at javax.swing.JComponent.processKeyBindings(JComponent.java:2818)
	at javax.swing.JComponent.processKeyEvent(JComponent.java:2735)
	at java.awt.Component.processEvent(Component.java:5278)
	at java.awt.Container.processEvent(Container.java:1966)
	at java.awt.Component.dispatchEventImpl(Component.java:3968)
	at java.awt.Container.dispatchEventImpl(Container.java:2024)
	at java.awt.Component.dispatchEvent(Component.java:3803)
	at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1826)
	at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:677)
	at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:934)
	at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:806)
	at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:641)
	at java.awt.Component.dispatchEventImpl(Component.java:3841)
	at java.awt.Container.dispatchEventImpl(Container.java:2024)
	at java.awt.Window.dispatchEventImpl(Window.java:1778)
	at java.awt.Component.dispatchEvent(Component.java:3803)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Comment 10 _ sandipchitale 2007-09-07 19:35:01 UTC
Please ignore the last comment about 

org.netbeans.modules.localhistory

module. Disabling the module did not help :(
Comment 11 Petr Pisl 2007-09-10 10:04:51 UTC
Marek, could you look at this? Probably the jsp file has an open stream for reading. 
Comment 12 Marek Fukala 2007-09-10 13:31:45 UTC
I have added some debugging code to the MutualExclusionSupport so I am able to find who is the one who gets the stream
but doesn't close it. As is shown below the problematic code is JavaSourceObject in particullar its JSP implementation
from org.netbeans.modules.web.core.syntax.JavaSourceProviderImpl.

The implementation of the forFileObject() returns FilterImpl() with following implementation:

  public Reader filterReader(Reader r) {
      return new StringReader("class SimplifiedJSPServlet {}"); //NOI18N
  }

This code not wrapping the given reader causes that the reader _r_ is never closed and hence the MutualExclusionSupport
still holds the info about the file stream being read. 

Since the implementation of MutualExclusionSupport holds the info about the resource being used just weakly there is a
workaround: after facing the described problem, cancel the saveAll dialog, invoke GC in the ide and then save the documents.
    
I am not sure if this is a P1 since there is a workaround, but OTOH not so much straightforward. In any case reassigning
to Jan Lahoda which is the author of the code.


Caller of the addResource():

java.lang.Thread.getStackTrace(Thread.java:1426)
org.netbeans.modules.masterfs.filebasedfs.fileobjects.MutualExclusionSupport$Closeable.<init>(MutualExclusionSupport.java:111)
org.netbeans.modules.masterfs.filebasedfs.fileobjects.MutualExclusionSupport$Closeable.<init>(MutualExclusionSupport.java:102)
org.netbeans.modules.masterfs.filebasedfs.fileobjects.MutualExclusionSupport.addResource(MutualExclusionSupport.java:87)
org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj.getInputStream(FileObj.java:107)
org.netbeans.modules.masterfs.MasterFileObject.getInputStream(MasterFileObject.java:148)
org.netbeans.modules.java.source.parsing.SourceFileObject.openReader(SourceFileObject.java:134)
org.netbeans.modules.java.source.parsing.SourceFileObject.getCharContentImpl(SourceFileObject.java:334)
org.netbeans.modules.java.source.parsing.SourceFileObject.getCharContent(SourceFileObject.java:107)
org.netbeans.modules.java.source.parsing.SourceFileObject.getCharContent(SourceFileObject.java:59)
com.sun.tools.javac.main.JavaCompiler.readSource(JavaCompiler.java:500)
com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:567)
com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java:822)
com.sun.tools.javac.api.JavacTaskImpl.parse(JavacTaskImpl.java:278)
com.sun.tools.javac.api.JavacTaskImpl.parse(JavacTaskImpl.java:254)
org.netbeans.api.java.source.JavaSource.moveToPhase(JavaSource.java:1140)
org.netbeans.api.java.source.JavaSource$CompilationJob.run(JavaSource.java:1507)
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
java.util.concurrent.FutureTask.run(FutureTask.java:138)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
java.lang.Thread.run(Thread.java:619)


SEVERE [global]

msg
msg
Caused: org.netbeans.modules.masterfs.filebasedfs.utils.FSException: Cannot get exclusive access to
/marek/NetBeansProjects/WebApplication4/web/index_1.jsp (probably opened for reading).
        at org.netbeans.modules.masterfs.filebasedfs.utils.FSException.io(FSException.java:103)
        at
org.netbeans.modules.masterfs.filebasedfs.fileobjects.MutualExclusionSupport.addResource(MutualExclusionSupport.java:82)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj.getOutputStream(FileObj.java:66)
        at org.netbeans.modules.masterfs.MasterFileObject.getOutputStream(MasterFileObject.java:158)
        at org.openide.text.DataEditorSupport$Env.outputStream(DataEditorSupport.java:629)
        at org.openide.text.CloneableEditorSupport$1SaveAsReader.run(CloneableEditorSupport.java:807)
        at org.netbeans.editor.BaseDocument.render(BaseDocument.java:1162)
        at org.openide.text.CloneableEditorSupport.saveDocument(CloneableEditorSupport.java:855)
        at org.openide.text.DataEditorSupport.saveDocument(DataEditorSupport.java:321)
        at org.netbeans.modules.web.core.jsploader.BaseJspEditorSupport.saveDocument(BaseJspEditorSupport.java:353)
        at org.netbeans.modules.web.core.jsploader.BaseJspEditorSupport.saveDocument(BaseJspEditorSupport.java:300)
        at org.netbeans.modules.web.core.jsploader.BaseJspEditorSupport$5.save(BaseJspEditorSupport.java:265)
[catch] at org.openide.actions.SaveAction.performAction(SaveAction.java:58)
        at org.openide.util.actions.NodeAction$DelegateAction$1.run(NodeAction.java:559)
        at org.netbeans.modules.openide.util.ActionsBridge.doPerformAction(ActionsBridge.java:55)
        at org.openide.util.actions.NodeAction$DelegateAction.actionPerformed(NodeAction.java:555)
        at org.openide.windows.TopComponent.processKeyBinding(TopComponent.java:933)
        at javax.swing.JComponent.processKeyBindings(JComponent.java:2895)
        at javax.swing.JComponent.processKeyEvent(JComponent.java:2812)
        at java.awt.Component.processEvent(Component.java:5815)
        at java.awt.Container.processEvent(Container.java:2058)
        at java.awt.Component.dispatchEventImpl(Component.java:4410)
        at java.awt.Container.dispatchEventImpl(Container.java:2116)
        at java.awt.Component.dispatchEvent(Component.java:4240)
        at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1848)
        at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:693)
        at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:958)
        at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:830)
        at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:657)
        at java.awt.Component.dispatchEventImpl(Component.java:4282)
        at java.awt.Container.dispatchEventImpl(Container.java:2116)
        at java.awt.Window.dispatchEventImpl(Window.java:2429)
        at java.awt.Component.dispatchEvent(Component.java:4240)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
ALL [null]: Cannot get exclusive access to /marek/NetBeansProjects/WebApplication4/web/index_1.jsp (probably opened for
reading).
ALL [null]: There were some problems while saving index_1.jsp.
Comment 13 Marek Fukala 2007-09-10 13:55:07 UTC
Fixed in trunk. Workarounded on the web side, thought the proper fix should be done in the infrastrucure. Honzo, please
remove this once you fix this issue properly. I am downgrading to P2 and kindly asking QE to test it and Honza Lahoda
and Petr Pisl to check the change so I can fix to beta1 branch.

Checking in JavaSourceProviderImpl.java;
/cvs/web/jspsyntax/src/org/netbeans/modules/web/core/syntax/JavaSourceProviderImpl.java,v  <--  JavaSourceProviderImpl.java
new revision: 1.7; previous revision: 1.6
done

public Reader filterReader(Reader r) {
+    //Workaround for issue #114951 - Can't close/saveall project: Error "Cannot get exclusive access"
+    try {
+        r.close();
+    }catch(IOException ioe) {
+       Logger.global.log(Level.WARNING, "Cannot close stream.", ioe);
+    }
    return new StringReader("class SimplifiedJSPServlet {}"); //NOI18N
}

Comment 14 Petr Pisl 2007-09-10 14:36:54 UTC
I agree with the proposed solution. 
Comment 15 Jan Lahoda 2007-09-10 14:37:56 UTC
The workaround is OK IMO. Thanks.
Comment 16 Petr Blaha 2007-09-10 17:01:48 UTC
Marku, QE approved fix in beta1 branch. Please, commit fix today. Thanks
Comment 17 Marek Fukala 2007-09-10 18:17:17 UTC
fixed in release60_beta1 branch.

Checking in JavaSourceProviderImpl.java;
/cvs/web/jspsyntax/src/org/netbeans/modules/web/core/syntax/JavaSourceProviderImpl.java,v  <--  JavaSourceProviderImpl.java
new revision: 1.6.2.1; previous revision: 1.6
done
Comment 18 Marek Fukala 2007-09-10 18:20:30 UTC
Honzo, can you do the proper fix in trunk please? Thanks.
Comment 19 Jan Lahoda 2007-09-26 09:52:03 UTC
The API is friend anyway, so P3 should be enough, IMO.
Comment 20 Jiri Prox 2008-04-11 01:16:33 UTC
moving opened issues from TM <= 6.1 to TM=Dev
Comment 21 David Konecny 2009-09-22 04:49:25 UTC
Reopen if you disagree.
Comment 22 tdk 2011-05-25 09:52:59 UTC
I still keep getting this error in 6.9.1!

Could you pls repopen and fix it.

Thanx
Comment 23 David Konecny 2011-05-25 23:02:07 UTC
Could I ask you please to file a new issue and attach a new stack trace. Current one is from 2007. Thx.
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo