"Module has no entry points defined" - how to avoid?

545 views
Skip to first unread message

Rob Jellinghaus

unread,
Apr 24, 2007, 4:24:20 AM4/24/07
to Google Web Toolkit
So I have the standard Java 5-related GWT problem, which is that I
have some server-side domain / entity classes that are written with
Java 5 syntax (annotations, generics, the works). And I want to pass
objects of these classes in my GWT service interfaces.

Well, obviously it's not possible since GWT can't handle Java 5
source. So I'm doing the next best thing: I'm writing a very
lightweight DTO generator with the JAM tool (part of Codehaus's
AnnoGen). It basically creates a set of DTO classes that shadow my
domain classes, leaving all the JDK 5 syntax out. Some minor
extensions to avoid creating fields that aren't emulated by GWT, some
reflection glue to populate a DTO graph from an entity graph, and
there you have it.

Except now I need to use these DTO classes in my actual GWT module.
And since these are generated files, I don't want to inject them right
into the source tree of my GWT module (never commingle generated
source with hand-crafted source!).

So I'm trying to make another module, "dto.GeneratedDto", which JUST
contains the DTOs. This module really only wants to be a small set of
plain Javabeans, bundled into a module that I can share from
elsewhere. Then I want to inherit dto.GeneratedDto from my actual
modules.

Hence, I've got the following directory hierarchy for the
dto.GeneratedDto module:

build/
generated/
dto.GeneratedDto/ <-- the module directory
dto/
GeneratedDto.gwt.xml
domain/
Blog.java
BlogEntry.java
HitCount.java

And my GeneratedDto.gwt.xml file is simply:

<module>
<!-- Specify the source. This module ONLY has source. -->
<source path="domain"/>
</module>

But when I point the GWT compiler at this, I get this error:

[java] [ERROR] Module has no entry points defined
[java] [ERROR] Build failed

Well, yes, the module has no entry points defined. I don't WANT the
module to have any entry points defined. It's a simple library, not
referenced from HTML anywhere. This page:

http://code.google.com/webtoolkit/documentation/com.google.gwt.doc.DeveloperGuide.Fundamentals.Modules.html

says, quote:

"An entry point application class name; these are optional, although
any module referred to in HTML must have at least one entry-point
class specified."

So why is the GWT compiler complaining about my module not having an
entry point? And more generally, is there some better way to do what
I'm trying to do here?

Thanks very much for any enlightenment. And don't be rude,
Reinier :-)
Cheers!
Rob

Fred Sauer

unread,
Apr 24, 2007, 11:41:05 AM4/24/07
to Google-We...@googlegroups.com
Rob,

You might try inheriting com.google.gwt.user.User. Here is a working *.gwt.xml file from my project

<module>
  <inherits name='com.google.gwt.user.User'/>
  <stylesheet src='DragDrop.css'/>
</module>

Then, elsewhere in an entry point module I write (inheriting two such supporting modules):
<module>
  <inherits name='com.allen_sauer.gwt.dragdrop.DragAndDrop'/>
  <inherits name='com.allen_sauer.gwt.log.Log'/>
  <entry-point class='com.allen_sauer.gwt.dragdrop.demo.client.DragDropDemo'/ >
  <stylesheet src='DragDropDemo.css'/>
</module>


I don't know if you are packaging up your generated code or not (sounds like you haven't gotten that far yet), but my experience has been that the main entry point module won't be able to find the supporting module in a jar file unless I include directories explicitly in the jar file, so includeDirectoryEntries="true" in the Eclipse *.jardesc file.

Let me know if you still have trouble.

Fred


    dto.GeneratedDto /    <-- the module directory

Reinier Zwitserloot

unread,
Apr 24, 2007, 6:58:46 PM4/24/07
to Google Web Toolkit
groups.google.com seems on the fritz. reposting:

On Apr 24, 10:24 am, Rob Jellinghaus <rjellingh...@gmail.com> wrote:
> Thanks very much for any enlightenment. And don't be rude,
> Reinier :-)
> Cheers!
> Rob

You refer to this module from another using an <inherit> tag in
the .gwt.xml file of your real project. You then compile/hosted-mode-
run THAT one, and everything will work. In other words, you don't need
to compile this one. This works for any <inherit> shenanigans; you
only compile the one module with the entry point that includes all
others, and that one compilation job will compile everything to one
single .js file (well, actually, one .html containing js for each
permutation, but, details). Totally different from the ordinary .java
to .class compilation process, which takes a bit getting used to.

Make sure you <inherit> dto.GeneratedDto.GeneratedDto in your main
proejct's .gwt.xml file.

Hope that helps!

NB: Oh, and because you asked so nicely: You are obviously dumber than
a goldfish with aquaphobia for asking such a ridiculous question! ;-P

Rob Jellinghaus

unread,
Apr 24, 2007, 7:10:34 PM4/24/07
to Google Web Toolkit
On Apr 24, 3:58 pm, Reinier Zwitserloot <reini...@gmail.com> wrote:
> groups.google.com seems on the fritz. reposting:

Yeah, it has been flaky, hasn't it?

> You refer to this module from another using an <inherit> tag in
> the .gwt.xml file of your real project. You then compile/hosted-mode-
> run THAT one, and everything will work. In other words, you don't need
> to compile this one.

AHA. Duh. Now THAT is helpful. I tried Fred's suggestion and it
didn't work, but this one sounds like a winner.

> Make sure you <inherit> dto.GeneratedDto.GeneratedDto in your main
> proejct's .gwt.xml file.

Not just dto.GeneratedDto? I'll try it both ways but I expect
dto.GeneratedDto to work.

Once I get this working I'll post the source -- this is turning into a
little mini framework for generating DTO hierarchies, stripping out
all problematic GWT imports, Java 5 constructs, etc. Seems like
there's a lot of need for it.

> NB: Oh, and because you asked so nicely: You are obviously dumber than
> a goldfish with aquaphobia for asking such a ridiculous question! ;-P

Ah phew, I thought you were someone posing as Reinier for a minute :-)
Cheers!
Rob

Reinier Zwitserloot

unread,
Apr 24, 2007, 10:54:51 PM4/24/07
to Google Web Toolkit
a tag of the form: <inherits name="dto.GeneratedDto.GeneratedDto"/>

will perform the following task:

Take each path in the current CLASSPATH, and look from there for:

(CLASSPATH-ENTRY)/dto/GeneratedDto/GeneratedDto.gwt.xml

if found, assume the directory that contains the .gwt.xml file is the
'root' for any further (possibly implied) <source> and <public> tags
in that .gwt.xml file, and do not allow any paths in this .gwt.xml
file to '..' to a parent of the directory that contains the .gwt.xml
file.

I misread your directory structure. You will indeed need to use
"dto.GeneratedDto", not a double GeneratedDto, and you'll have to put
the "dto.GeneratedDto" directory in the classpath. If you're using
eclipse, this makes a lot of sense as a structure.

Carry on!

Reply all
Reply to author
Forward
0 new messages