开发者

Debug a Webservice locally in Eclipse

开发者 https://www.devze.com 2023-03-21 07:37 出处:网络
I\'ve got a service which I\'m trying to debug. I can debug the client-side of the service ie to the point the WS is called and results returned by the WS but not the service/server-side of that servi

I've got a service which I'm trying to debug. I can debug the client-side of the service ie to the point the WS is called and results returned by the WS but not the service/server-side of that service.

I've had a look at several articles on this and have strictly followed instructions but I'm still not able to achieve the desired result. I'm running the WS on Tomcat an dusing Eclipse IDE. Can somebody help? The steps that I've followed

A) Setting tomcat in debug mode

set JPDA_ADDRESS=8000 set JPDA_TRANSPORT=dt_socket c开发者_高级运维atalina.bat jpda start I've added the following lines to the catalina.bat files located at {catalina_home}/bin directory.

B) Deploying your application to Tomcat I wasnt sure whether needed or not but I've had already added the war file in the webapps folder previously and hence have the corresponding folder

C) Connecting Eclipse to Tomcat for debugging Now this is where I'm not I'm not sure of the settings.

1) Start Eclipse 2) open the project containing the service that you want to debug 3) click on the arrow close to the debug button (the little bug) to see the drop down menu click on open debug dialog... (may also be labeled "Debug Configurations...") 4) in the debug window double click on the Remote Java Application on the left hand side list. This will create a new debug profile.

5) choose a name for the debug profile 6) select the project you want to debug (Which project should I be using?? I've selected the webservice project although its a different project that is used for starting the application and from there the webservice is called from) 7) the host is the address for your tomcat ie localhost 8) the port is the one you configured in when starting Tomcat, 8000 by default 9) Click on debug

On doing that I get the error "Failed to connect to remote VM. Connection refused. Connection refused"

I have the source code for both service and client and have them as separate projects in my eclipse.

What needs to be done differently??


It looks like you haven't started Tomcat first with remote debugging options (A) and after that connect Eclipse via remote debugging (C).

But you do not necessarily have to use remote debugging. Another option is to launch your server-side (service) project from within Eclipse in debug mode: Your project must be dynamic web project (Dynamic Web Module facet) and then on this project's context menu choose Debug As > Debug on Server (you can define here a server that it will use such as Tomcat).

0

精彩评论

暂无评论...
验证码 换一张
取 消