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.

Bug 49166 - DOM graph creation failed: org.netbeans.modules.schema2beans.Schema2BeansRuntimeException
Summary: DOM graph creation failed: org.netbeans.modules.schema2beans.Schema2BeansRunt...
Status: CLOSED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Tomcat (show other bugs)
Version: 4.x
Hardware: Sun All
: P2 blocker (vote)
Assignee: Petr Jiricka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-16 16:17 UTC by Petr Blaha
Modified: 2006-03-24 10:00 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
stack trace (12.29 KB, text/plain)
2004-09-16 16:19 UTC, Petr Blaha
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 (5.33 KB, text/plain)
2004-09-21 07:55 UTC, Marek Fukala
Details
Possible patch for this issue (5.15 KB, patch)
2004-09-23 16:43 UTC, Petr Jiricka
Details | Diff
Diagnostic stack traces (1.44 KB, text/plain)
2004-09-23 17:11 UTC, Petr Jiricka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Blaha 2004-09-16 16:17:56 UTC
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.
Comment 1 Petr Blaha 2004-09-16 16:19:01 UTC
Created attachment 17697 [details]
stack trace
Comment 2 _ ludo 2004-09-16 16:26:50 UTC
tomcat issue.
Comment 3 Petr Blaha 2004-09-16 16:58:31 UTC
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.
Comment 4 Petr Jiricka 2004-09-17 08:53:28 UTC
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.
Comment 5 Marek Fukala 2004-09-21 07:54:52 UTC
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.
Comment 6 Marek Fukala 2004-09-21 07:55:43 UTC
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
Comment 7 Milan Kuchtiak 2004-09-21 14:32:06 UTC
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
Comment 8 Milan Kuchtiak 2004-09-21 14:39:04 UTC
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.
Comment 9 Milan Kuchtiak 2004-09-21 14:54:01 UTC
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. 
Comment 10 Petr Jiricka 2004-09-23 16:43:34 UTC
Created attachment 17845 [details]
Possible patch for this issue
Comment 11 Petr Jiricka 2004-09-23 17:10:28 UTC
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.
Comment 12 Petr Jiricka 2004-09-23 17:11:12 UTC
Created attachment 17846 [details]
Diagnostic stack traces
Comment 13 Petr Jiricka 2004-09-24 09:47:10 UTC
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
Comment 14 Petr Blaha 2005-09-08 10:01:55 UTC
[build 20050907]