First-time using SmartGWT 2.0 + NetBeans 6.8 on WinXP - getting XML parse error in file build-gwt.xml

63 views
Skip to first unread message

Stefan Scott Alexander

unread,
Feb 19, 2010, 8:11:07 PM2/19/10
to Google Web Toolkit
Hello -

I am trying to start using SmartGWT-2.0 with NetBeans 6.8 on WinXP SP
3, following a tutorial for NetBeans 6.5 and SmartGWT-1.0b1 located
at:

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

I was able to compile and run the standard Hello World GWT project
generated by NetBeans.


Next I tried to do a slightly more complicated project, copying and
pasting in the code for class AnimationPlaypenSample.java (from the
SmartGWT showcase) into the standard Hello World project's main java
file MainEntryPoint.java (leaving the package declaration and the main
class name MainEntryPoint unchanged)

The supplied file AnimationPlaypenSample.java is located here on my
machine:

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

and the demo using this file can be seen on-line here:

http://www.smartclient.com/smartgwt/showcase/#featured_animation_playpen


Testing this second project, the java compiles, but the build fails
due to a parsing error in an XML configuration file which I never
touched. The error message says:

"[ERROR] Failure while parsing XML"

for file:

build-gwt.xml

located in directory:

C:\usr\nb\WebApp001\nbproject

The error occurs at line 232, which contains an opening <java ...> tag
reading:

[CODE]
<java classpath="${javac.classpath}:${src.dir}:${build.classes.dir}"
failonerror="true"
classname="com.google.gwt.dev.Compiler" fork="true"
jvmargs="${gwt.compiler.jvmargs}">
[/CODE]

in file:

gwt.properties

in the same directory

Line 232 in file build-gwt.xml, where the error is reported, is the
line reading:

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

but of course the error could also be occurring on the two preceding
lines of this three-line <java ...> opening tag.


The parameter referenced on this final line of the tag is defined in
file gwt.properties in the same directory, which currently reads:

gwt.compiler.jvmargs=-Xmx512M

(There is one change I made in this file gwt.properties: I changed the
original 265 to 512 based on a tip mentioned further down in this
post.)

Of course the XML error could be occurring on any of the three lines
of the <java ... > opening tag in build-gwt.xml, which does contain
some other parameters which are also evaluated using ${...} syntax.


By the way, this is a cross-post of the same question which I posted
earlier today on the SmartGWT Technical Q&A forum and the NetBeans
AJAX forum. (Links to those posts can be found at the end of this
message.)

I had also been attempting earlier this week to use GWT 2.0 with
Eclipse 3.5 (Galileo), but that effort is also currently on hold
because after installing the GWT plug-in following the instructions
here:

http://code.google.com/eclipse/docs/getting_started.html

and restarting Eclipse and the computer several times, the plug-in
appears in the list of Eclipse's installed plug-ins in the 'Help'
menu, but the command 'New Web Application' does not appear in the
Eclipse 'File' menu in any Perspective, so I am only able to make a
Static HTML Web Project, not a Web Application.

The complete error message output is shown below.

+++ +++ +++

Here is the complete error message output that appears in the Output
(Run) window of 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)
[/CODE]


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>
[/CODE]


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

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


Also, here is line 134 of the same file:

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


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

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:

<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):

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

+++ +++ +++

Does anyone have any ideas how to correct this XML parse error which
is causing this simple build to fail?

Thank you.

Cross-posted to:
http://forums.netbeans.org/topic23412.html
http://forums.smartclient.com/showthread.php?t=9792

Stefan Scott Alexander

unread,
Feb 21, 2010, 8:59:54 PM2/21/10
to Google Web Toolkit
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:

<!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:

<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:

<?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


On Feb 19, 11:11 pm, Stefan Scott Alexander

Reply all
Reply to author
Forward
0 new messages