Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm using GWT 2.4 and have a ton of code already written. I understand the Jetty server that comes with the GWT plugin has very tight control over the jars that can be used in a project to mimic app engine as closely as possible. I need to deploy to tomcat 7. I modified my project in eclipse and "blessed" it as a dynamic web project so I can export...WAR and upload it to my QA and production tomcat.

I need help with getting the app to run (and debug) on an embedded tomcat (like an honest dynamic web project would). I already have tomcat setup in eclipse and I have my CAS server web app deployed to it.

I've ready tons of either old or confusing posts here and elsewhere. Basically, I'm looking for the same debugging environment I would get with the packaged Jetty server, but on my own tomcat configured with WTP in eclipse...so I can mimic my production environment (just like Jetty mimics app engine)

any help is appreciated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
821 views
Welcome To Ask or Share your Answers For Others

1 Answer

It should probably a little bit easier, but it's possible. Here's how I do it:

1. Setting up the web server

  • Using the JavaEE edition of Eclipse, I set up the Tomcat 7.0 server adapter, and define an environment in Preferences > Server > Runtime Environments
  • File > New > Project... > Web/Dynamic Web Project
    • Select the target runtime I set up in the first step
    • Important: In Context Root, enter /
  • I create an HTML file and a Servlet, and then try running the setup using Debug As > Debug On Server

2. Adding the GWT code server

  • Project > Properties > Google > Web Toolkit > Use Google Web Toolkit
  • Important: I always need to change the order in the Java Build Path (Project > Properties > Java Build Path > Order and Export), see http://code.google.com/p/google-web-toolkit/issues/detail?id=4479 - gwt-dev.jar must be pretty much on top of the path.
  • Project > Properties > Google > Web Application: War directory = "WebContent", also check "Launch and deploy from this directory"
  • I create some sample GWT content (I create a sample GWT project, and copy most of it over)
  • I try to GWT compile the project. This shows me, if I got the build path order right - otherwise, the compiler fails early with "java.lang.NoSuchFieldError: warningThreshold".
  • Debug As > Web Application - just to create a debug configuration. Stop the debug. Edit the debug configuration (Run > Debug Configurations...), deselect "Run built-in server". Start the debug again.

Now, finally, I can debug both the server and the client part (I still need to click two Debug icons to start both!) I can manage the client side from the "Development Mode" view, and the server side from the "Servers" view. At the end of the day, it works great, and using the "Automatically publish when resources change" feature (Servers view > myServerName > Open > Publishing), sometimes even better than with the integrated Jetty.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...