GWT (eclipse) - only seeing static html in welcome page - gwt

Surely very basic, but I am a server-side/pure java developer, just started with GWT...
My new GWT project was working just fine, until it stopped - now the welcome page is served, but I only see the static html on it and nothing else. I see no error anywhere, I can see that the js file is built and referenced from the html, Same happens with the sample web app that's created in a new project in eclipse - it is the Web application starter project - I see "enter you name:" on the browser and nothing else.
Would someone save my sanity?

Try to wait longer if you've really all right and no any exceptions or errors are thrown. The fact that the static HTML is displayed immediately but compiling your Java code takes some time.

I have encountered this a few times (very rarely indeed) when there was an error in the generated files. The typical "Project > Clean..." alone is not enough with GWT projects. Here's the full process I have used to resolve this:
Make a backup of your files.
Delete the following directories (either through the "Navigator" view in Eclipse, or with an external file browser)
gwt-unitCache
war/mymodulename
war/WEB-INF/classes
war/WEB-INF/deploy
Refresh the project (right click it, choose Refresh)
Finally use Project > Clean...

Related

extremely frustrating with eclipse luna

I have a simple html file "index.html" in my java EE project. I changed the contents of the file, changed some links. But when I run it from eclipse nothing's changing. When I run it outside of eclipse it opened with the updated contents. Finally I became frustrated I uninstalled and reinstalled eclipse and tomcat. I imported my previous project and nothing changed in the html file! I deleted all content and run it and even though the page is empty it still shows the old page! What is going on? How can I fix this?
Whenever you make a change in a
file follow these steps:
stop the
server
right click on server
add/remove
remove the project
add
again
start the server again
run the page
click refresh or simply
enable Publish changes
immediately when server is started
If the contents are not changing you
should always refresh the whole page.
Sometimes the cached
page may be the one being
displayed.
Hope this helps :)

JavaScript content assist not working for JSP file in Eclipse Kepler

I am using Eclipse Kepler to develop App Engine application.The autocomplete feature is not working for JSP files and am not sure if I am missing any Property settings.
Would be glad if someone can let me know what needs to be done to enable auto-complete feature?
PS : FYI, I have the WTP tool already installed
You have to be working with a file in a JavaScript Source Folder. To do that, you can create a JavaScript project or enable an existing project from its Configure context menu (right-click->Configure->something JavaScript). Once that's done, if it wasn't opened automatically, bring up the project's JavaScript Include Path property page and create or mark an existing folder as a Source Folder. That should enable it for both JS files and web pages.
Have you tried closing the project and opening it again. That would clear the cache and get things running.
right click project > close project
right click closed project > open project

Play Framework + Eclipse: undefined method for ReverseApplication

I'm having a little trouble (more like an annoyance, really) when using the Play Framework with Eclipse.
I'm following this tutorial to get started with Play. In a certain moment in the tutorial, it asks us to type in this code:
public static Result index() {
return redirect(routes.Application.tasks());
}
This works as expected when running the application. The problem is that Eclipse doesn't like it. It says:
The method tasks() is undefined for the type ReverseApplication
While underlining tasks with the dashed red line. Is there a reason for this to happen? I've tried cleaning and compiling the project (through the Play terminal) and refreshing the project in Eclipse, but to no avail.
Is there something I can do about it?
I'm using Eclipse Juno, build 20120606-2254
Thank you so much!
Since the views are Scala code, they are compiled by the Scala compiler (ie your Play console through sbt). So Eclipse cannot compile and find these.
So, your best option is to configure Eclipse so that it automatically refresh the workspace and make sure that the folder "target/scala-2.9.1/classes_managed" is in your build path (it should be done by the "eclipsify" command).
If it does not work after all these steps, try "clean", "compile" and "eclipsify" (for Play 2.0.x) or "eclipse" (for Play 2.1.x) and refresh your projet.
Close and open your project in Eclipse. This worked for me (Eclipse Juno).
None of the previous suggestions worked for me, but when I did a refresh on the target folder, the red underlining on my view references went away.
The Play command used to be called "eclipsify". It is now called "eclipse".
Generally, I do the following and it works pretty well with Eclipse
-at the start of the day, start the play console in your project dir and do 'clean' and 'run'
-open a web browser point to the app (localhost:9000)
-launch eclipse
-make code changes...
-Play will rebuild the app whenever code changes occur. So refreshing the app in
the browser.
-back in eclipse, Refresh the project to reload the files that play rebuild just made.
I know it has been a year since #nico_ekito's answer but just wanted to add this.
Adding /target/scala-2.10/classes_managed and ensuring that Eclipse automatically refreshes the workspace fixed it for me. Thanks #nico_ekito
Using Eclipse Kepler, play framework 2.2.2

Running PHP in Eclipse issue

I downloaded the the PHP tools for Eclipse and have created a new PHP project. I added a trivial hello world script with no dependencies and click Run As -> PHP Webscript.
Now for the weird part:
My entire workspace gets rebuilt. This means that ALL my other projects in different languages like C,C++ and Java are being built and only THEN does the script run as a webpage.
Any ideas where I could reconfigure this or why its happening?
Have you tried right-clicking on the PHP project and selecting "Close Unrelated Projects"? When you need to go back to one of the other projects, you can right-click on it and select "Open Project" to open it back up.
I have not tried this on projects with version control, though.

How do I open the GWT samples in eclipse Helios and GWT 2.1.1?

What is the straight-forward way of importing one of the GWT samples in eclipse Helios + GWT 2.1.1. It seems like the content of the zip file doesn't contain any project files for eclipse.
I tried the following:
create a GWT project 'bla'
Delete the src ad war folder and
replace it with the src and war
folder from the sample
refresh the project in eclipse
hit 'run'
[ERROR] Unable to find
'bla/bla.gwt.xml' on
your classpath; could be a typo, or
maybe you forgot to include a
classpath entry for source?
So I go to the run configuration and remove the path for the example projects from the arguments list. I also changed the name of hosted html page to the one in the sample. Hit 'run' and:
[ERROR] Invalid version number "2.0"
passed to external.gwtOnLoad(),
expected "2.1"; your hosted mode
bootstrap file may be out of date;
Now I need an out of date version of GWT to run these samples? What is going on, I just want to look at a sample to learn a new concept.
Reading the readme.txt in the GWT samples directory I came across a solution that works on Eclipse 3.7. Assuming you have ant installed on your machine, execute the following from the sample's directory:
ant eclipse.generate
This will generate both the .classpath and .project files needed to import the sample into Eclipse and run it.
Here the relevant excerpt from README.txt:
-- Option A: Import your project into Eclipse (recommended) --
If you use Eclipse, you can simply import the generated project into
Eclipse. We've tested against Eclipse 3.4 and 3.5. Later versions
will likely also work, earlier versions may not.
If the directory containing this file does not have a .classpath or
.project file, generate them by running 'ant eclipse.generate'
In Eclipse, go to the File menu and choose:
File -> Import... -> Existing Projects into Workspace
Browse to the directory containing this file, select "Mail".
Be sure to uncheck "Copy projects into workspace" if it is checked.
Click Finish. You can now browse the project in Eclipse.
To launch your web app in GWT development mode, go to the Run menu and
choose:
Run -> Open Debug Dialog...
Under Java Application, you should find a launch configuration
named "Mail". Select and click "Debug".
You can now use the built-in debugger to debug your web app in
development mode.
In eclipse 3.7, instead of Run -> Open Debug Dialog..., its Run -> Debug Configurations. I got both the showcase and mail samples running following those commands. Should work for all of the other samples as well.
The examples that come with GWT SDK were built in different ways. Some are Maven builds, others use Ant. Eclipse can handle these common builds directly, but you have to choose the right option.
So, if you want to open the Expenses project in eclipse, you would look in the projects root directory (i.e. ../gwt2.4/samples/Expenses) where you'll find a file called pom.xml. That is a Maven build file. To import it into your Work space select:
File->Import...
Open Maven->Existing Maven Projects, and click on Next > button
Browse your file system til you reach the Expenses folder. Click on it and Select OK.
At this point it will show you the Projects in that directory in the Projects: area of the window...only one in this case: /pom.xml com.google.gwt.sample.expenses:...etc.
click on the checkbox for that project, Next>
Finally, it ask you to map plugins. You'll need to select in the drop down menu under Actions the required plugins (such as m2e).
In other project folders you may find a build.xml file instead. That's an Ant build file. To import that you do something similar, but different (of course!):
File->New->Project...
Open the Java folder and select "Java Project from Existing Ant Buildfile", Next >
Click the Browse button, dig through your directory to the project folder and select the build.xml file, and Open it.
Project name should fill in automatically, just select the declaration to use in the middle window and click Finish.
Since those tutorial only include the src and war directory, the idea remains to:
create a new project following this tutorial
remove any created class part of the example files which are automatically added (see Issue 1547)
Unfortunately the Google Plugin does not allow to created a new Web Application Project without creating template files. The template files are nice for the first try but annoying if you want to start from scratch with a new GWT application.
copy the src and war directory in place within the now empty project
Following your ticket 5847 (No easy and straight-forward way to make examples work in eclipse),
as xo4yhamope comments, you need the right GWT option.
and did you consider the Issue 5038 about the error message:
Unable to find 'xxxx.gwt.xml' on your classpath;
could be a typo, or maybe you forgot to include a classpath entry for source?
This message usually means you attempted to refresh the browser before dev mode has had a chance to finish loading the module.
The uppercase/lowercase confusion happens because the module has been renamed to 'stockwatcher', but dev mode cannot map 'stockwatcher' to "StockWatcher' until it has finished loading the entire module.
So, it's just a matter of waiting a few seconds longer after the Development Mode pane says I should go to http://127.0.0.1:8888/StockWatcher.html?gwt.codesvr=127.0.0.1:9997 ?
That seems a little messed up. It should wait until it's actually ready before telling me it's ok, because users (like me) are going to go there as soon as the UI says it's ready.
The other confusing part is that the server begins serving the host page as soon as that message in the UI comes up. Because this was happening, I assumed that the server was completely up, even though (as it turns out) it wasn't.
Anyway, waiting a few more seconds seems to resolve the "Unable to find 'stockwatcher.gwt.xml' on your classpath" problem. Thanks!
I'm beginning to suspect this is a bug in the samples. I am adding this answer so it can be marked as an answer when I get confirmation about that.
I was trying out some other samples and came across this page. At the top is a little explanation for how to download and import the sample.
Before you begin
The StockWatcher project
This tutorial builds on the GWT
concepts and the StockWatcher
application created in the Build a
Sample GWT Application tutorial.
If you have not completed the Build a
Sample GWT Application tutorial and
are familiar with basic GWT concepts,
you can import the StockWatcher
project as coded to this point.
Download the StockWatcher project.
Unzip the file.
Import the project into Eclipse
From the File menu, select the Import... menu option.
Select the import source General > Existing Projects into
Workspace. Click the Next button.
For the root directory, browse to and select the StockWatcher
directory (from the unzipped file).
Click the Finish button.
If you are using ant, edit the
gwt.sdk property in
StockWatcher/build.xml to point to
where you unzipped GWT.
Now this is what I call straight-forward and easy.
At that point I had already built the StockWatcher in a previous tutorial but I got intrigued by the fact that it was explained exactly as I tried it the first time. So I downloaded the project and it had the correct eclipse project structure. I tried to import it 'et voila' I have the project in eclipse. I runs out of the box (with warnings). That is how expected the samples to be.
This experience leads me into thinking that the sample projects are malformed (as eclipse projects) and need to be updated. Let's hope my issue report leads to results.
-- Option A: Import your project into Eclipse (recommended) --
If you use Eclipse, you can simply import the generated project into Eclipse.
We've tested against Eclipse 3.4 and 3.5. Later versions will likely also
work, earlier versions may not.
If the directory containing this file does not have a .classpath or .project
file, generate them by running 'ant eclipse.generate'
In Eclipse, go to the File menu and choose:
File -> Import... -> Existing Projects into Workspace
Browse to the directory containing this file,
select "Mail".
Be sure to uncheck "Copy projects into workspace" if it is checked.
Click Finish.
You can now browse the project in Eclipse.
Copy from readme.txt supplied by samples. I tried this method, it's OK.
To import GWT showcase(2.5.1) I did following steps:
Create a new Google Web Application Project
New –> Other –> Google –> Web Application Project
Provide the project name “Showcase” and the Package name is com.google.gwt.sample.showcase
Click Finish
Go to eclipse plugin folder and traverse to the gwt
Under that folder go to gwt-2.3.\samples\Showcase
Copy (Ctrl C) all the contents. The contents are
a. src
b. test
c. war
d. build.xml
e. README.txt
In the eclipse, right click on the Showcase project and paste. Overwrite all the files
The files should start copying without any problem
Right click on the Showcase and Run As “Web Application”
You should have your Showcase working like Gem!
For me it worked like a charm ;)
Ref : http://simplestepswebdev.wordpress.com/2011/05/16/import-gwt-samples-into-eclipse/