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.
Build 040915 App server plugin 20040914-1708 Setup: empty userdir, Java 1.5.0-beta3-b59 Steps: 1) File | New Project | Web - Web Applications 2) Invoke Run Project from pop-up menu deploy to App server 3) Invoke Project's Properties -> node Running project, change Server to Tomcat5 (Bundled Tomcat ..) 4) Invoke Run Project Get Deployment error: DOM graph creation failed: org.netbeans.modules.schema2beans.Schema2BeansRuntimeException: Failed to create the XML-DOM Document. Check your XML to make sure it is correct. Also see stack trace. After Clean and Build Project deployment is working OK. I also performed other check: After succesfful deployment web app to Tomcat I changed target server to Sun App, Run project. Deployed to App Server OK. Change webapp's target server to Tomcat. Run Project and second deployment is without any errors.
Created attachment 17697 [details] stack trace
tomcat issue.
The error is caused by empty context.xml in build/web/META-INF directory. When you change target server to Tomcat, web/META-INF/context.xml and build/web/META-INF/context.xml files are created. Second file is empty.
This could be related to the fact that web content is auto-copied from docBase to build. Maybe some events get lost in the process, so the file is not always correctly copied. Could be related to issue 49185 that I just filed.
I have encountered the problem when adding a non-valid element into deployment descriptor. I mistakenly added an element <load-on-startup>x</load-on-startup> into a servlet element and saved the DD. Then a warning dialog appeared and when I press 'save anyway' the attached exception appeared. Note that there should be an integer instead of the 'x'. I bet the problem is more wider than just the described case, but it can be easily reproduced by that.
Created attachment 17776 [details] java.lang.RuntimeException: DOM graph creation failed: org.netbeans.modules.schema2beans.Schema2BeansRuntimeException: Failed to instanciate an object of class "java.math.BigInteger" for property "LoadOnStartup" using its String constructor with the valu
The issue is not in schema2beans. The problem is that the bean graph cannot be generated from empty file (build/web/META-INF/context.xml is empty). This is the scenario : 1. create a web project (the default server is SJSAS-8) the following structure is created : + wp + web + WEB-INF sub-web.xml web.xml + src 2. build project : the structure has changed to : + wp + build + web + WEB-INF + classes sun-web.xml web.xml index.xml + web + WEB-INF sub-web.xml web.xml + src 3. run (deploy) project (on SJSAS-8) : + wp + build + web + WEB-INF + classes sun-web.xml web.xml J2EE.dpf index.xml + web + WEB-INF sub-web.xml web.xml + src 4. change the target server for web project to Tomcat + wp + build + web + META-INF context.xml (empty file) + WEB-INF + classes sun-web.xml web.xml J2EE.dpf index.xml + web + WEB-INF sub-web.xml web.xml + src 5. Run project again (on Tomcat) : + wp + build + web + META-INF context.xml (empty file) + WEB-INF + classes sun-web.xml web.xml J2EE.dpf Tomcat5.dpf index.xml + web + WEB-INF sub-web.xml web.xml + src and the exception is thrown from schema2beans trying to create bean graph from empty build/web/META-INF/context.xml
I think the important fact is that if you only work with Tomcat(default server), the build process creates the structure : + wp + build + web + META-INF context.xml + WEB-INF + classes web.xml index.xml + web + META-INF context.xml + WEB-INF web.xml + src the build/web/META-INF/context.xml and web/META-INF/context.xml are identical.
Another interesting observation : if (in step 4) the empty build/web/META-INF/context.xml were not generated the step 5 would work perfectly. The proper context.xml would be generated during the execution (run) process.
Created attachment 17845 [details] Possible patch for this issue
Here is what I found out so far. The problem is somewhere in the area of firing events after the change of META-INF/context.xml. In the current code, server-specific config files are written using the java.io.File API, and then FileObject.refresh() is used, see also ConfigDataObject, ConfigurationStorage and TomcatPlanSplitter. When the target server is changed, the following happens: - new context.xml is created - some placeholder invalid content is placed in context.xml - proper content with the correct context path is created in context.xml See also the attachment below, which contains stack traces. Now, not all of these file change events are propagated to org.netbeans.modules.web.project.WebProject$CopyOnSaveSupport (don't know why). The patch I attached above fixes this issue by: - properly closing output streams in Tomcat module - doing all the file operations during server change in one FileSystem.AtomicAction. Please review the patch. However, a more systematic and clean solution would be the following: - Server plugins should be responsible for all aspects of file saving. Currently, the infrastructure creates the file, and plugins fill it with data. This architecture makes it difficult to do the whole operation atomically. If plugins were responsible for everything, this would be easier to do atomically. - Server plugins should use FileSystem APIs to write the config file. All the refresh stuff should be eliminated.
Created attachment 17846 [details] Diagnostic stack traces
Fixed by Nam Nguyen - thanks, Nam! j2eeserver/src/org/netbeans/modules/j2ee/deployment/config/ConfigSupportImpl.java,rev.1.21 tomcatint/tomcat5/src/org/netbeans/modules/tomcat5/ide/TomcatPlanSplitter.java,rev.1.5
[build 20050907]