Problems compiling hello world example

15 views
Skip to first unread message

Josef

unread,
Nov 3, 2008, 9:07:16 AM11/3/08
to gxp-users
I just recently found the slides about gxp and tried to compile the
hello world example from them. However I only receive the following
output:

/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/
java
-cp gxp-0.2.3-beta.jar com.google.gxp.compiler.cli.Gxpc --verbose
--output_language java hello.gpx
java.lang.NullPointerException
at
com.google.gxp.com.google.common.base.Preconditions.checkNotNull(Preconditions.java:
181)
at
com.google.gxp.com.google.common.collect.ImmutableMap.entryOf(ImmutableMap.java:
141)
at com.google.gxp.com.google.common.collect.ImmutableMap.access
$300(ImmutableMap.java:55)
at com.google.gxp.com.google.common.collect.ImmutableMap
$Builder.put(ImmutableMap.java:176)
at
com.google.gxp.compiler.CompilationSet.createCompilationUnits(CompilationSet.java:
143)
at
com.google.gxp.compiler.CompilationSet.<init>(CompilationSet.java:130)
at
com.google.gxp.compiler.CompilationSet.<init>(CompilationSet.java:53)
at com.google.gxp.compiler.CompilationSet
$Builder.build(CompilationSet.java:98)
at com.google.gxp.compiler.Compiler.call(Compiler.java:105)
at com.google.gxp.compiler.cli.Gxpc.main(Gxpc.java:76)
at com.google.gxp.compiler.cli.Gxpc.main(Gxpc.java:44)

*******************************************************************************

Looks like you found a bug in gxpc! Please email gxpc...@google.com

Please include the command-line arguments, full output (including the
stack trace) and the location of your client workspace in your
report.

*******************************************************************************

Could someone please point me in the right direction? Am I missing
something in the template or the compiler options?

with kind regards

Josef

harryh

unread,
Nov 3, 2008, 12:57:52 PM11/3/08
to gxp-users
Try this:

/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/
java -cp gxp-0.2.3-beta.jar com.google.gxp.compiler.cli.Gxpc --verbose
--output_language java hello.gxp

Note that it's hello.gxp not hello.gpx

-harryh
> Looks like you found a bug in gxpc! Please email gxpc-...@google.com

harryh

unread,
Nov 3, 2008, 1:06:20 PM11/3/08
to gxp-users
And also you don't want your source gxp at the top level. If it's
named (for example) com.google.foo.hello you want it inside the com/
google/foo/ directory (gxpc doesn't give proper error messages when
you try to compile a source file in the root directory).

Also, if you want to put your source GXPs in a directory like gxps/com/
google/foo/, you'll need to pass a --source gxps/ flag so gxpc knows
where the root is.

-harryh

Josef Auer

unread,
Nov 4, 2008, 9:20:09 AM11/4/08
to gxp-...@googlegroups.com
hi!

thx for the response!

I managed to compile the hello world example after renaming the file
AND putting it to the right directory. However I did not need the
--source option.
Are there more tutorials available?

josef

--
Dip.Ing(FH) Josef Auer
Software Development
http://www.auer.biz
http://www.auer.biz/blog

Laurence Gonsalves

unread,
Nov 4, 2008, 11:25:56 AM11/4/08
to gxp-users
Unfortunately, no, not at the moment. We've been meaning to write up a
full tutorial, but we haven't had the time. Currently the slides are
the closest thing we have to a tutorial.

axelrose

unread,
Nov 23, 2008, 5:18:01 AM11/23/08
to gxp-users
Hi,

I can compile something but seem to be unable to get html output.

Without -"-output_language java" I get no output at all.

This way:

~/work/gxp-test > java -cp ../gxp-0.2.3-beta.jar:.
com.google.gxp.compiler.cli.Gxpc --verbose --output_language java --
warn error --verbose de/roeslein/gxp/HelloWorld.gxp
de/roeslein/gxp/HelloWorld.java:0:0:0:0: Generating
de/roeslein/gxp/HelloWorld.gxp:7:50:7:50: unextractable text
de/roeslein/gxp/HelloWorld.java:0:0:0:0: Generate finished

there is a generated .java file.

What I'd like to see is some html output.

~/work/gxp-test > cat de/roeslein/gxp/HelloWorld.gxp
<gxp:template name='de.roeslein.gxp.HelloWorld'
xmlns:gxp='http://google.com/2001/gxp'
xmlns:expr='http://google.com/2001/gxp/expressions'
xmlns:java='http://google.com/2001/gxp/code/java'
xmlns:cpp='http://google.com/2001/gxp/code/cpp'
xmlns:msg='http://google.com/2001/gxp/msg'
xmlns:nomsg='http://google.com/2001/gxp/nomsg'>

Hello World!

</gxp:template>


Thanks

Axel

harryh

unread,
Nov 23, 2008, 1:06:21 PM11/23/08
to gxp-...@googlegroups.com
> there is a generated .java file.
>
> What I'd like to see is some html output.

GXPC will just generate the .java files. To see the actual HTML
output, you'll need to compile the generated .java files into your
application and execute them.

There is a brief tutorial on how to do this with standard java
servlets here: http://code.google.com/p/gxp/wiki/GxpAndServlets

-harryh

Axel Rose

unread,
Nov 23, 2008, 2:09:46 PM11/23/08
to gxp-...@googlegroups.com
Thanks, I'll try that.

I was mostly puzzled by the "unextractable text" message.


Axel

harryh

unread,
Nov 23, 2008, 2:49:04 PM11/23/08
to gxp-...@googlegroups.com
> I was mostly puzzled by the "unextractable text" message.

You only saw this because you compiled with --verbose. This is a
informational alert indicating that you have uninternationalized text.
To make it go away you can add <gxp:msg> or <gxp:nomsg> tags around
"Hello World!"

-harryh

axelrose

unread,
Nov 24, 2008, 3:48:48 AM11/24/08
to gxp-users
> GXPC will just generate the .java files.  To see the actual HTML
> output, you'll need to compile the generated .java files into your
> application and execute them.

Ok.
But doesn't this imply that for each template change I'd have to
regenerate Java code, recompile, redeploy?


Regards,
Axel.

harryh

unread,
Nov 24, 2008, 11:16:32 AM11/24/08
to gxp-...@googlegroups.com
> But doesn't this imply that for each template change I'd have to
> regenerate Java code, recompile, redeploy?

GXP also has a development mode where it will check to see if the .gxp
files have changed on disk and, if they have, perform a runtime
compilation. Compile with the --dynamic flag to enable this mode.

This mode should *not* be used when you generate production binaries.

-harryh

Axel Rose

unread,
Nov 24, 2008, 12:32:57 PM11/24/08
to gxp-...@googlegroups.com
Understood.

But in production this means that with GXP a XML template is only available as binary.
A refreshed XML template will only be deployed for production with a new binary.
Correct?


Regards

Axel

harryh

unread,
Nov 24, 2008, 12:39:42 PM11/24/08
to gxp-...@googlegroups.com
Correct.
Reply all
Reply to author
Forward
0 new messages