How can I debug Web Application with Eclipse?

2019-04-15 21:01发布

I would like to debug web application of my university mate because I am developing android application that it will interact with the web application.

I am using "debug" perspective and with andorid or normal Java application I don't have problem.. but with the web application I can't debug .. I put breackpoints and "debug as web application" in debug perspective... but it doesn't work...

It's my console

Initializing App Engine server

30-dic-2012 20.06.21 com.google.apphosting.utils.jetty.JettyLogger info
INFO: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
30-dic-2012 20.06.33 com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
INFO: Successfully processed C:\Users\alfo888_ibg\workspace\TablePlus\war\WEB-INF/appengine-web.xml
30-dic-2012 20.06.34 com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
INFO: Successfully processed C:\Users\alfo888_ibg\workspace\TablePlus\war\WEB-INF/web.xml
30-dic-2012 20.06.44 com.google.apphosting.utils.jetty.JettyLogger info
INFO: jetty-6.1.x
30-dic-2012 20.06.48 com.google.appengine.api.datastore.dev.LocalDatastoreService init
INFO: Local Datastore initialized: 
    Type: High Replication
    Storage: C:\Users\alfo888_ibg\workspace\TablePlus\war\WEB-INF\appengine-generated\local_db.bin
30-dic-2012 20.06.49 com.google.appengine.api.datastore.dev.LocalDatastoreService load
INFO: Time to load datastore: 297 ms
30-dic-2012 20.06.53 com.google.apphosting.utils.jetty.JettyLogger info
INFO: Started SelectChannelConnector@0.0.0.0:8888
30-dic-2012 20.06.53 com.google.appengine.tools.development.DevAppServerImpl start
INFO: The server is running at localhost:8888
30-dic-2012 20.06.53 com.google.appengine.tools.development.DevAppServerImpl start
INFO: The admin console is running at localhost:8888/_ah/admin

4条回答
萌系小妹纸
2楼-- · 2019-04-15 21:13

The above solution looks good, but will also need to attach to the server from the debugger through a JPDA port (ex. on setting it up via runtime arguments on port 4000 below).

For example.. before running your web application on Tomcat or Jetty, you need to set your java opts:

If you run your web application via the console you can do something like:

set JAVA_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n"

If you are running your application on Tomcat then you can these instructions of the "Java" tab in your tomcat config. (see image below)

Java options:

-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n

enter image description here

Then from the IDE you can run the debugger to debug the target VM on port 4000. (like in screenshot below)

enter image description here

This page shows you a little more in detail how to do it:

http://www.eclipsezone.com/eclipse/forums/t53459.html

查看更多
狗以群分
3楼-- · 2019-04-15 21:14

Altough I have not worked with appengine.

To local debug a gwt application i do the following procedure

  1. mvn gwt:debug (or use the IDE tools to start your application in debug mode)
  2. Right click on your project select Debug as -> Debug configurations...

Create a new java remote webapplication as example:

enter image description here

now your breakpoints should be reached.

查看更多
我只想做你的唯一
4楼-- · 2019-04-15 21:22

You should start the web application with the debug flag. In Tomcat you must set the flag jpdaand restart. In Jetty should be similar.

查看更多
虎瘦雄心在
5楼-- · 2019-04-15 21:27

The problem has been discussed at length, and the new version of appengine-maven-plugin 1.7.5-SNAPSHOT has just been released and allows for setting arguments in order to remote debug the application.

antony explains how to do that here

查看更多
登录 后发表回答