The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

gwtuser2008 (1) [Avatar] Offline
#1
I'm new to GWT and I'm trying to follow the examples in the book. I have followed all the steps up to Stage2 (pg. 86). I executed the Dashboard-Constants-i18n command in Eclipse which automatically created the DashboardConstants.java file as expected. However, in the main Dashboard.java file(same as in Listing 3.7), I still get an error saying that "DashboardConstants cannot be resolved to a type" for the following line:

DashboardConstants constants = (DashboardConstants) GWT.create(DashboardConstants.class);

As a result, I'm not being able to successfully compile/run to get the output shown in Figure 3.7. I have incorporated the right .css files etc. and modified the .gwt.xml file as mentioned in the book. Any pointers/suggestions would be appreciated.

Thanks,
gwtuser2008
robert.hanson (173) [Avatar] Offline
#2
Re: DashboardConstants Issue - GWTIA Book
Is the DashboardConstants class in the same package as the class that is reporting the error? If not, be sure that you have an import statement in your code.
BobMarcum (10) [Avatar] Offline
#3
Re: DashboardConstants Issue - GWTIA Book
Robert,

I am having this same problem. However, I am using netbeans6 with the nb4gwt plugin.

I get this message when attempting to compile the result of Chapter 3:
/root/tmp/GWTinAction/Dashboard/src/java/org/client/DashboardEntryPoint.java:40: cannot find symbol
symbol : class DashboardConstants
location: class org.client.DashboardEntryPoint
DashboardConstants constants = (DashboardConstants) GWT.create (DashboardConstants.class);

Thanks for any guidance.
robert.hanson (173) [Avatar] Offline
#4
Re: DashboardConstants Issue - GWTIA Book
Some quick ideas...

- Are you importing the i18n module in your config?
- Are there any other errors prior to that error in the shell?

Maybe you can post some of your code/config along with a dir /s (or ls -R)?
BobMarcum (10) [Avatar] Offline
#5
Re: DashboardConstants Issue - GWTIA Book
Thanks for input. Let's take your ideas one at a time:

Hanson: - Are you importing the i18n module in your config?
Well ... no. I did nothing specific to accomplish that. How does one do that?
Hanson: - Are there any other errors prior to that error in the shell?
No. No prior errors

Now, the class that the Netbeans compiler cannot find is presumably generated on-the-fly and , according to the discussion on page 80, is subject to 'deferred binding'. My code is the code detailed on page 79 of the book. The line of code where the compiler hiccups is that line indicated by the annotation "4" in the code on page 79 and in the ensuing discussion on page 80.

By the way ... I now have thie result of Chapter 3 working successfully using command-line tools in another directory.
robert.hanson (173) [Avatar] Offline
#6
Re: DashboardConstants Issue - GWTIA Book
this needs to be in your module config in order to be able to use the i18n classes. This includes the Constants class.

<inherits name="com.google.gwt.i18n.I18N" />
BobMarcum (10) [Avatar] Offline
#7
Re: DashboardConstants Issue - GWTIA Book
Oh! Yes, that line is in my Dashboard.gwt.xml file ... as prescribed in the book. What would I see, where would I look, to confirm the effect of that "inherits" line?

What next?
adam.tacy (269) [Avatar] Offline
#8
Re: DashboardConstants Issue - GWTIA Book
Interesting error!

Do you get anything in netBeans to show that DashboardConstats is not visible at the point in your code it is used (e.g. a warning or anything)?

Do you ge the same problem if you're trying to run in HostedMode (you mention compiling - not sure if you mean compiling for WebMode or you get the error in your Hosted Mode window)

Beyond that, I think if you posted your code then it would be easier for Rob and I to see if there's anything there - otherwise it's very hard to think what might be the issue.....

//Adam
BobMarcum (10) [Avatar] Offline
#9
Re: DashboardConstants Issue - GWTIA Book
Tracy: Do you get anything in netBeans to show that DashboardConstats is not visible at the point in your code it is used (e.g. a warning or anything)?
Nothing.

Tracy: Do you ge the same problem if you're trying to run in HostedMode (you mention compiling - not sure if you mean compiling for WebMode or you get the error in your Hosted Mode window)
I cannot see a way in netbeans to execute hosted mode. The closest is "debug"; however, I get the very same error indication attempting "run", debug", or "test" options under menu "Run".
The netbeans environment is driven by an ant build script. I have explored it and its associated .xml files. I see a target, "debug-connect-gwt-shell-hosted". I have tried to execute that target manually, i.e., with the command "ant debug-connect-gwt-shell-hosted". It ran but seemed not to do anything. I re-ran that command with the ant "-verbose" option and see this notation:

debug-connect-gwt-shell-hosted:
Skipped because property 'netbeans.home' not set.

Oh!

Then trying "ant -verbose run", I see this notation among the text of the output:

-do-compile:
[javac] org/Dashboard.gwt.xml skipped - don't know how to handle it
[javac] org/client/DashboardEntryPoint.java added as org/client/DashboardEntryPoint.class doesn't exist.

Oh! Dashboard.gwt.xml skipped !!?? I can see nowhere else that the Dashboard.gwt.xml file is processed. Maybe the "inherits" clause for the I18n support code did not get inherited.

This begins to look more like an nb4gwt problem. Do you agree? Perhaps I should go off to see if I can get the nb4gwt boys engaged.

Tracy: Beyond that, I think if you posted your code then it would be easier for Rob and I to see if there's anything there - otherwise it's very hard to think what might be the issue.....

I have just not wanted to clutter my postings or to make them difficult to process. I certainly can supply you with anything you might be willing to look at. For instance, I can provide a "tree" view of the directory and files layout under netbeans, if you think that might help.

Thanks.
BobMarcum (10) [Avatar] Offline
#10
Re: DashboardConstants Issue - GWTIA Book
Okay. I have found evidence that the nb4gwt plugin developers discovered in November 2007 that there is a problem in nb4gwt handling internationalization. I have found no evidence that condition has been remedied.

The nb4gwt forum notes this problem when one of the developers said he was working through the GWT in Action book and discovered this problem.. He said in that posting that he had figured out how to work around the problemm manually and was going to post a tutorial on how to do that, on wiki.netbeans.org. I've been there and found no discussion of the problem or its solution.

Given this situation, I think I will unfortunately be obliged to back away from using netbeans with GWT at this tiime. Maybe I will try eclipse; I know there is also a gwt plugin for eclipse.

Thank you all for your help.
adam.tacy (269) [Avatar] Offline
#11
Re: DashboardConstants Issue - GWTIA Book
Hi Bob,

Sounds a shame - could you post the link you found on the wiki (I use Eclipse myself rather than Netbeans, but would be interested to see what they say)

//Adam
BobMarcum (10) [Avatar] Offline
#12
Re: DashboardConstants Issue - GWTIA Book
Link to the gwt4nb discussion where the problem is identified:
https://gwt4nb.dev.java.net/servlets/ProjectForumMessageView?forumID=2603&messageID=22338

The link to the netbeans wiki is : wiki.netbeans.org
I have found no reference there to this issue, where the solution is expected to be.

Going to the GWT site at http://code.google.com/webtoolkit/ and searching there for "netbeans" I cannot find any acknowledgement of the problem.

I am using the latest version of the gwt4nb plugin available for netbeans 6.0, which is the version og netbeans I am using.

I have sent an email to one of the gwt4nb plugin developers asking the status of this issue.

Best regards,

Bob Marcum
BobMarcum (10) [Avatar] Offline
#13
Re: DashboardConstants Issue - GWTIA Book
I now have my work from Chapter 3 running successfully in eclipse. Pity! I would have preferred to use Netbeans. ... But...

At lest I am ready to move on.

There is one anonomaly: I cannot seem to get the application to run in any way other than hosted mode in Eclipse. I know this not the Eclipse forum, but can someone with more Eclipse experience than I easily tell me what I am doing wrong?

Thanks.