Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    "Failure while parsing XML" in file build-gwt.xml

    Hello -

    I am trying to use SmartGWT-2.0 with NetBeans 6.8 for the first time.

    When I try to run the following test project from the SmartGWT-2.0 showcase:

    AnimationPlaypenSample.java

    located on my machine in directory:

    C:\programs\smartgwt-2.0\samples\Showcase\src\com\smartgwt\sample\showcase\client\effects\animation

    I keep getting a compile error with the message:

    Code:
    [ERROR] Failure while parsing XML
    Does anyone know how to fix this?

    +++ +++ +++

    Here is the complete output that appears in the Output (Run) window NetBeans when I try to Run this project:

    Code:
    init:
    deps-module-jar:
    deps-ear-jar:
    deps-jar:
    library-inclusion-in-archive:
    library-inclusion-in-manifest:
    compile:
    compile-jsps:
    GWT installation directory: C:\programs\gwt-2.0.2
    do-gwt-compile-15:
    do-gwt-compile-16:
    do-gwt-compile-17:
    do-gwt-compile-20:
    GWT Compiling client-side code.
    [Fatal Error] :8:7: The content of elements must consist of well-formed character data or markup.
    [ERROR] Failure while parsing XML
    org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.
            at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1231)
            at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
            at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.parse(ReflectiveParser.java:327)
            at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.access$100(ReflectiveParser.java:48)
            at com.google.gwt.dev.util.xml.ReflectiveParser.parse(ReflectiveParser.java:398)
            at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:257)
            at com.google.gwt.dev.cfg.ModuleDefLoader$1.load(ModuleDefLoader.java:169)
            at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:283)
            at com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(ModuleDefLoader.java:141)
            at com.google.gwt.dev.Compiler.run(Compiler.java:184)
            at com.google.gwt.dev.Compiler$1.run(Compiler.java:152)
            at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:87)
            at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:81)
            at com.google.gwt.dev.Compiler.main(Compiler.java:159)
    [ERROR] Unexpected error while processing XML
    com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
            at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.parse(ReflectiveParser.java:351)
            at com.google.gwt.dev.util.xml.ReflectiveParser$Impl.access$100(ReflectiveParser.java:48)
            at com.google.gwt.dev.util.xml.ReflectiveParser.parse(ReflectiveParser.java:398)
            at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:257)
            at com.google.gwt.dev.cfg.ModuleDefLoader$1.load(ModuleDefLoader.java:169)
            at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:283)
            at com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(ModuleDefLoader.java:141)
            at com.google.gwt.dev.Compiler.run(Compiler.java:184)
            at com.google.gwt.dev.Compiler$1.run(Compiler.java:152)
            at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:87)
            at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:81)
            at com.google.gwt.dev.Compiler.main(Compiler.java:159)
    C:\usr\nb\WebApp001\nbproject\build-gwt.xml:134: The following error occurred while executing this line:
    C:\usr\nb\WebApp001\nbproject\build-gwt.xml:232: Java returned: 1
    BUILD FAILED (total time: 1 second)

    Here are lines 225 to 243 of file build-gwt.xml located in directory C:\usr\nb\WebApp001\nbproject on my machine:

    Code:
        <target name="do-gwt-compile-20" if="gwt.version.20" unless="gwt.compile.unneeded">
            <!-- You can override this property in the 'gwt.properties' file -->
            <property name="gwt.compiler.output.style" value="OBFUSCATED"/>
            <property name="gwt.compiler.logLevel" value="WARN"/>
            <echo>GWT Compiling client-side code.</echo>
            <java classpath="${javac.classpath}:${src.dir}:${build.classes.dir}" failonerror="true"
              classname="com.google.gwt.dev.Compiler" fork="true"
              jvmargs="${gwt.compiler.jvmargs}">
                <arg value="-war"/>
                <arg path="${build.web.dir}/"/>
                <arg value="-style"/>
                <arg value="${gwt.compiler.output.style}"/>
                <arg value="-localWorkers"/>
                <arg value="${gwt.compiler.local.workers}"/>
                <arg value="-logLevel"/>
                <arg value="${gwt.compiler.logLevel}"/>
                <arg value="${gwt.module}"/>
            </java>
        </target>

    Line 232 in the code shown above is the one that reads:

    Code:
              jvmargs="${gwt.compiler.jvmargs}">

    Also, here is line 134 of the same file:

    Code:
            <antcall target="do-gwt-compile-20" />

    The file gwt.properties in the same directory contains the line:

    Code:
    gwt.compiler.jvmargs=-Xmx512M
    (Originally the value in the line above was 256, but I changed it to 512 following the advice here: http://forums.smartclient.com/showthread.php?t=3168)


    Of course, it is possible that the XML parser thinks there is an error in any part of the <java ... > opening tag, which runs from line 230 to line 232 in file build-gwt.xml as shown above:

    Code:
    <java classpath="${javac.classpath}:${src.dir}:${build.classes.dir}" failonerror="true"
       classname="com.google.gwt.dev.Compiler" fork="true"
       jvmargs="${gwt.compiler.jvmargs}">
    and does not report the error until reaching the final part of this opening tag (on line 232):

    Code:
    jvmargs="${gwt.compiler.jvmargs}">
    +++ +++ +++

    Does anyone have any ideas how to correct this problem?

    Thank you.

    #2
    I found a fix that seems to work

    Doing the steps below solved the problem, following suggestions given here:

    http://forums.smartclient.com/showthread.php?t=9782&highlight=netbeans

    http://forums.smartclient.com/showpost.php?p=29065&postcount=5
    http://www.guj.com.br/posts/list/137140.java (in Portuguese, but you can read the code! :-)
    http://forums.smartclient.com/showthread.php?t=3168&highlight=netbeans
    http://jellebeuselinck.wordpress.com/2009/03/05/setting-up-smartgwt/


    (1) Add the line:

    Code:
    <script type="text/javascript"> var isomorphicDir = "org.yournamehere.Main/sc/"; </script>
    to file:

    WelcomeGWT.html

    in folder:

    C:\usr\nb\HelloWorld001\web

    so that the complete file now reads:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
        <head>
            <meta name='gwt:module' content='org.yournamehere.Main=org.yournamehere.Main'>
            <title>Main</title>
        </head>
        <body>
            <script type="text/javascript"> var isomorphicDir = "org.yournamehere.Main/sc/"; </script>
            <script type="text/javascript"  src="org.yournamehere.Main/org.yournamehere.Main.nocache.js"></script>
        </body>
    </html>

    (2) Add the line:

    Code:
    <inherits name="com.smartgwt.SmartGwt" />
    to file:

    Main.gwt.xml

    in folder:

    C:\usr\nb\HelloWorld001\src\java\org\yournamehere

    so that the complete file now reads:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.7.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.7.0/distro-source/core/src/gwt-module.dtd">
    
    <module>
        <inherits name="com.google.gwt.user.User"/>
        <inherits name="com.smartgwt.SmartGwt" />
    
        <!-- Inherit the default GWT style sheet. You can change -->
        <!-- the theme of your GWT application by uncommenting -->
        <!-- any one of the following lines. -->
        <!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
        <!-- <inherits name="com.google.gwt.user.theme.chrome.Chrome"/> -->
        <!-- <inherits name="com.google.gwt.user.theme.dark.Dark"/> -->
    
        <entry-point class="org.yournamehere.client.MainEntryPoint"/>
    
        <!-- Do not define servlets here, use web.xml -->
    </module>

    Also make sure to do the following:

    (3) Copy the subdirectories:

    css
    images
    Showcase.css (not sure if you need this one)
    ds (if your web app uses any data)

    from diretory:

    C:\programs\smartgwt-2.0\samples\Showcase\war

    to directory:

    C:\usr\nb\HelloWorld001\web


    (4) In the 'Project' treeview pane in NetBeans, right-click on the 'Libraries' node, select 'Add Library...', and add the library 'smargwt-2.0'.


    The steps above also assume that you started by doing 'File' > 'New Project...' in NetBeans, and in the wizard on the 'Choose Project' page you selected 'Java Web' under 'Categories' and 'Web Application' under Projects, and on the 'Frameworks' page you selected 'Google Web Toolkit' and kept the defaults in fields 'GWT Installation Folder' (on my machine: C:\programs\gwt-2.0.2') and GWT Module (I kept the default 'org.yournamehere.Main').

    When I changed the field 'GWT Module' to something more customized like 'org.mysite.helloworld001.Main' I ran into compile/build errors - so for now I'm using the default value 'org.yournamehere.Main'.


    Also, the pathname prefixes 'C:\usr\nb\...' and 'C:\programs\smartgwt-2.0\...' will of course be different on your machine.


    The initial setup instructions I followed can be found here:

    http://www.plantstar.org/tutorials/Netbeans_Smartgwt.htm

    To get the java code to modify my source file MainEntryPoint.java, I used the following for example:

    file:///C:/programs/smartgwt-2.0/samples/Showcase/war/index.html#featured_tree_grid

    Comment

    Working...
    X