使用eclipse在tomcat上调试GWT [英] debug GWT on tomcat using eclipse

查看:173
本文介绍了使用eclipse在tomcat上调试GWT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用GWT 2.4,并且已经编写了大量的代码。我了解GWT插件附带的Jetty服务器对于可以在项目中使用的罐子进行非常严格的控制,以尽可能地模仿应用程序引擎。我需要部署到tomcat 7.我修改了我的项目在eclipse和祝福它作为一个动态Web项目,所以我可以导出... WAR并将其上传到我的QA和生产tomcat。



我需要帮助让应用程序在嵌入式tomcat上运行(和调试)(如一个诚实的动态Web项目)。我已经在eclipse中安装了tomcat,并且已经部署了我的CAS服务器Web应用程序。



我已经准备好了这些旧的或混乱的帖子在这里和其他地方。基本上,我正在寻找与包装Jetty服务器相同的调试环境,但是在我自己的tomcat中配置了Eclipse中的WTP ...所以我可以模仿我的生产环境(就像Jetty模拟应用程序引擎)



任何帮助都不胜感激。

解决方案

,但这是可能的。这是我如何做的:



1。设置Web服务器




  • 使用Eclipse的 JavaEE 版本,我设置了Tomcat 7.0服务器适配器,并在首选项>中定义一个环境服务器>运行环境

  • 文件>新>项目...> Web /动态Web项目


    • 选择我在第一步设置的目标运行时间

    • 重要提示在上下文根中,输入 /


  • 我创建一个HTML文件和一个Servlet,然后尝试使用 Debug As>在服务器上调试



2。添加GWT代码服务器




  • 项目>属性> Google> Web工具包>使用Google Web Toolkit

  • 重要提示:我总是需要更改Java构建路径中的顺序(项目>属性> Java构建路径>订单和导出),请参阅 http://code.google.com/p/google-web-toolkit/issues/detail?id=4479 - gwt-dev.jar必须几乎路径顶部。

  • 项目>属性> Google> Web应用程序:War directory =WebContent,还检查从此目录启动并部署

  • 我创建一些示例GWT内容(我创建一个示例GWT项目,并复制大部分)

  • 我尝试GWT编译项目。这显示了我,如果我得到了正确的构建路径顺序 - 否则编译器早期失败了java.lang.NoSuchFieldError:warningThreshold。

  • 调试为> ; Web应用程序 - 只是创建一个调试配置。停止调试。编辑调试配置(运行>调试配置... ),取消选择运行内置服务器。再次启动调试。



最后,我可以调试服务器和客户端部分(我还需要点击两个Debug图标启动两者!)我可以从开发模式视图,服务器端从服务器视图管理客户端。在一天结束时,它的效果非常好,使用自动发布资源更改功能(服务器视图> myServerName>打开>发布),有时甚至比集成码头更好。


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.

解决方案

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.

这篇关于使用eclipse在tomcat上调试GWT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆