GWT App through tomcat on Intellij-Idea 10 - gwt

Sounds simple, but I'm having lots of issues.
I want to run a GWT project in a tomcat on Intellij-idea 10.
Does anyone know how to set up the run config?
Regards,
Charles.

You can use '-noserver' option to start Dev Mode under Tomcat. Edit your GWT run configuration by adding '-noserver -port 8080' to 'Dev Mode parameters' field, then run the Tomcat configuration and after that run the GWT configuration.

This all implies that this is a development run, i.e. for local testing/debugging purposes. This is not deployment to production servers. I also assume you have GWT and Web facets defined for this project.
If you need GWT debugging, then you must run as GWT run configuration: here you can only choose a Default server (Jetty that comes with GWT) or an AppEngine Development server (if installed).
If you must run under Tomcat, then:
a. Add a Tomcat server under Settings - App Servers.
b. Create an Artifact - WAR exploded (under project settings). Add all items in right pane to the left pane.
b. Create a Tomcat run configuration with this Artifact.

You first run gwt compiler for compile gwt module, then compiler creates to your hosted .js and .html files. And you can run tomcat as usual but tomcat does not compiles your gwt modules.
I suggest you t use ant to compile gwt modules.

Related

Is it possible to do Hotswapping of ATG classes

The deployment we follow is that we use runAssembler.bat to build an ear file and deploy it in a app server. We are using weblogic and jboss for testing purposes of the modules we built. However for every small change, we need to run runAssembler and build a new ear and deploy it in app server and restart the server.
I would like to find out if anyone figured out a way to do Hotswapping of class files which are generated by the code we write in ATG environment in either weblogic or jboss.
By attaching your IDE to your Application server on the Debug port it is generally possible to do hotswapping. Setting this up on Eclipse and JBoss is documented here, here and here. There is some information for setting it up in WebLogic here.
Attach your debugger, edit the java file, click 'save' and with hot code replacement in your IDE it should now update the running class file. In Eclipse it usually gives a popup if it was unable to do the sync. If you are using Eclipse, make sure the 'Build Automatically' flag under projects is ticked or you'll be waiting forever. I've not had any issues doing this via JBOSS (exploded ATG EAR) and variable success in doing this on WebSphere 7. It may also be prudent to make sure the same JAVAC you use to compile your build is the one loaded into your IDE compile path.
Another way to at least reduce the build/deploy time would be to deploy an unpacked/exploded EAR and simply copy your class files across (you could use the Eclipse FileSync plugin) and restart the server.
There are also some commercial options available, like JRebel
In our organization, we had good success in using DCEVM. It simply patches your JDK (in Windows: jvm.dll).
Download and patch your JDK
Launch your JBoss/Weblogic with the patched JDK
Set up Eclipse's Installed JRE's to point to patched JDK (restart and rebuild once)
Start the server, Launch debugger and connect
Ensure Eclipse's Debug view shows "Dynamic Code Evolution VM" (instead of something like "HotSpot VM")
Change your code, and voila!
You can do this with JRebel. After hotswapping you don't need to restart the server, only reload you deployment from Weblogic.

Running GWT on tomcat in eclipse

I am trying to get a GWT Project running on a Tomcat 7 server in eclipse. I installed Tomcat and i can run other web application out of eclipse on Tomcat without a problem.
Now i generated a gwt maven project for eclipse with the following command and importet it as maven project to eclipse:
"mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin"
I can run this now as Web application (with the google plugin) and i can build a "war" with maven and deploy this with the Tomcat management console on the server. Both is working. But if i choose the option in eclipse "Run on server" and choose tomcat than just the html is loaded but not the application itself. See the screenshot: It doesn't find the "GWTModule.nocache.js".
This file is available in the target folder. What do i have to change to tell tomcat to look in the correct directory?
Tomcat is not able to run GWT code in development mode. You can use Tomcat for server side code, but in this case you need to run GWT development mode with -noserver option (to prevent built-in Jetty instance from running). See this article for more details.
I would recommend using the wtp plugin for eclipse. If you do this you can add your project/resource to tomcat when adding a new server. Here are the steps to use if you already have your project imported into eclipse.
Window -> Show View -> Servers
In Servers
New -> Server -> Choose apache tomcat
Point to the location of your tomcat installation/download
Next
At this point you should be able to add your gwt-maven project which will add the target/project.war to the tomcat modules.
Save it
Click on the newly added server, then click the modules tab at the bottom kind of hard to see.
This should have your project shown in the list of web modules.
Start your tomcat instance then on your gwt application right click and choose Run As -> Web application. Make sure your configuration settings are correct and when the development server starts it should give you the development url to browse to.
You can configure some aspects of tomcat in the overview tab, I would recommend making sure that "Modules auto reload by default" is checked so that tomcat will watch the filesystem for class changes.

how to stepin/debug a Maven web project in eclipse

I have a Maven project which is a web project and is packaged as a war.
I use tomcat-maven-plugin v1.2-SNAPSHOT to do a tomcat:deploy when i want to deploy.
But my question is how do i debug it / set breakpoints like i can do for normal web projects in eclipse (where a Debugging perceptive is shown and the server is paused.)
(i am a noob in this field)
[EDIT] I am not asking how to deploy to TOMCAT. i am rather asking how to setup the debug mode .FYI i am not able to right click on my project and select run> run on server, even though i have generated WTP specific files through maven.
mvn tomcat:deploy deploys an app to an external Tomcat server. If you want to debug that, you'll need to run that Tomcat server with debugging enabled and set up a remote debugging profile in Eclipse.
Edit: There's a succinct guide to doing this on the Tomcat wiki. The simplest approach is to start Tomcat with catalina jpda start. That will start Tomcat in debug mode listening on port 8000 for debugger connections. Then in Eclipse, you create a "remote" launcher configuration and tell it to connect to localhost:8000.
It doesn't matter whether you deploy it with maven or with Eclipse WTP as long as you started the server to which you deploy from eclipse and eclipse knows where the sources of the code you deployed are placed.
Keep attention if you have set the CATALINA_HOME environment variable, this will used to deploy to with mvn tomcat:deploy. But you can also define this in the configuration of the pom.xml.
<configuration>
<url>http://www.mydomain.com:1234/mymanager</url>
</configuration>
I'm not sure that it is feasible through the Maven plugin.
But you can generate eclipse specific files: mvn eclipse:eclipse -Dwtp.version=2.0 (The WTP version depends on the WTP version of your Eclipse).
Then, you can update your project and deploying it into a Tomcat like you can do for normal web projects.
This solution worked in my case, you can try this
Add module to Server
Go to the Servers view.
Double click on the Tomcat server.
You will get the server editor view.
Click on Modules tab in view (at bottom)
Click add External Web Module enter the path to your built files (e.g., C:\svn\projectName\trunk\test\project\target\webapp) and give a path.
Save.
Debug Server
Right-click on Tomcat in Servers view.
Choose Debug.
Debugging Startup
If you are debugging the startup of your application you might need to increase the startup timeout in the server view.
Thanks.

How to set Tomcat or JBOSS or Glassfish as App-Server for GWT Web Project in eclipse

How to create and run GWT web project in eclipse with tomcat or another app-server?
I created a Gwt Project and when i run or debug it, eclise did use GWT hosted mode server.
I can not find and configuration in project properties to select tomcat or another server for the project/
Regards
In the GWT Run/Debug configuration of the project you want to run/debug, tab Main, deselect the "Run built-in server" option. After that, it's your responsibility to generate the html/js/images of the GWT module you want to run, and place them somewhere where Tomcat or JBoss can see them. That usually means deploying a war at least.

How to redeploy the web app using the Eclipse IDE

Im new to Eclipse. I use Tomcat as my run time server, but every time I modified the jsp pages, Eclipse was still displaying the older one. Just wondering how to redeploy the application so the changes can be reflected.
Eclipse: Eclipse IDE for Java EE Developers 1.2.1.20090918-0703
Tomcat: Tomcat 6.0
Thanks
Doubleclick the server instance in question in the Servers view to open its configuration. Now, in the right top you should see a section called Publishing. Open it to verify and configure autopublishing settings.
Eclipse should do that automatically for you.
Otherwise, on the Servers view (Menu Window->Show View->Servers), you can right click on your Tomcat instance and hit "Publish" or "Restart"
Make sure you have the "JST Server Adapters" ("Web, XML and Java EE Development category") feature installed.
Eclipse's publishing functionality requries the project to be a "web project", and in some cases requires additional configurations.
Go to Windows > Preferences > Server > Runtime environments and add your tomcat
Either try using publishing, or (better I think) use the FileSync plugin. There you can tell which folders from your project should be copied (live) to what directory on your machine (the tomcat/webapps/yourapp). With a little more effort the filesync configuration can be made machine independent (only using one parameter as TOMCAT_ROOT), in case you want to check-in the project to a repository where others will use it.
Get the Tomcat plugin. It was nice because you can install Tomcat on your system and then associate your web app with that instance of Tomcat. The plugin will let you stop/start Tomcat and define a server such that when you do a build it knows how to deploy the changes. There may be some newer plugin but the Tomcat plugin worked for me and was fairly simple to install and use. Here is a page from IBM on using Eclipse and Tomcat. Inside that page it points you to the following: http://www.ibm.com/developerworks/opensource/library/os-eclipse-tomcat/