This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Let's follow this scenario ; 1. create a Web Application project, e.g. WebApplication1 (Since 6.0 - there is a lookup extensibility, and we register a specific LookupProvider in websvc/jaxwsmodel for Web Project) The WebJaxWsLookupProvider.createAdditionalLookup() is called once - that's correct. 2. delete the project 3. create again Web Application project with the same name: WebApplication1 The WebJaxWsLookupProvider.createAdditionalLookup() is called twice - this looks suspicious. Moreover, if FileOwnerQuery.getOwner() is called for some file object (from the project) - it may return the wrong project instance. We have some problems with that. See the issue 133860 (the last comment).
Created attachment 63358 [details] StackTrace
I inserted the Thread.dumpStack() just at the beginning of LookupProvider.createAdditionalLookup() method. It's may be a general problem in Project's infrastructure.
Deleting a project and recreating it under the same name is known to be problematic. Considering that in real life it is something you rarely do it is not worth fixing. In your scenario there is probably still old instance of project in memory which was not garbage collected yet - that's why it is called twice.
I haven't invented this scenario intentionally. See the issue 133860. The issue is common on DEMOs. That time you often create (and delete) projects of the same name. It happened also to me at JavaOne Netbeans Booth, And you can see I am not the only person who hit this problem. Please, rather, change the priority, or find why old project is not garbage collected properly. You may look at the second stack trace - why this is ever called. This may be a generic problem of project infrastructure.
After some farther investigation, it doesn't look this is a garbage collection problem. In the scenario described before (create project->delete project->create project with the same name) the LookupProvider.createAdditionalLookup() method is called - twice - for entirely new project instances: The recommended code is used here : public class WebJaxWsLookupProvider implements LookupProvider { public Lookup createAdditionalLookup(Lookup baseContext) { Project prj = baseContext.lookup(Project.class); ... The other ugly think (may be this is the consequence or not) is that FileOwnerQuery.getOwner(file) returns different project instances when called for project's root and for file located in sources directory: e.g. FileOwnerQuery.getOwner(FileObject[/home/mkuchtiak/WebApplication1]) ... returns project instance A FileOwnerQuery.getOwner(FileObject[/home/mkuchtiak/WebApplication1/src/java/a/A.java]) ... returns project instance B This is the source of problem described in issue 133860. BTW: it is not important whether new web service is created in project or not. The same happens with empty project.
RE. "web project garbage collection" - I do not remember details; I know that GC played a role there for a while; it is possible there are other issues. This scenario is practised only in demos or testing. It is not how IDE is used by users in daily life. Therefore any issues related are P3, P4. Issue 133860 should have been closed as WONTFIX or priority lowered or duplicate of this one.
duplicate of #134539 milan and myself fixed yesterday. *** This issue has been marked as a duplicate of 134539 ***