cancel
Showing results for 
Search instead for 
Did you mean: 

How to debug .java file in E-Commerce

Former Member
0 Kudos

Hi Experts, again I need your help:

I tried to debug into the code of an action (.java) file in E-Commerce but my Debug prospective did not work. Here is what I did:

1) enable debugging of process for local J2EE engine

2) setup a line breakpoint

3) select Debug prospective

4) run b2b application http://localhost:50200/b2b/b2b/init.do? (should I put some debug paramenter in this url?)

Can anyone advise me what's wrong / what I missed?

Thanks, Jin

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

[How to Debug in J2EE through NWDS|https://service.sap.com/sap/support/notes/1154496]

Regards,

Sateesh Chandra

Former Member
0 Kudos

Thanks Sateesh for your help.

I Run->Debug, set localhost as Host and 50221 (it's debug port) as Port. when clicking on Debug I got "Failed to connect to remote VM. Connection refused" error.

Here is my local J2EE process:

dispatcher Debug Mode Off Debug Port 50000

SDM Debug Mode On Debug Port 50002

Server0 Debug Mode On Debug Port 50221

Any advise / suggestions?

Thanks, Jin

Former Member
0 Kudos

Hi Jin,

It looks like that your Local J2EE engine is not in debug mode.

Please set your local J2EE engine in debug mode then start debug in NWDS. You will not get the error "Failed to connect to remote VM. Connection refused" which you are getting right now.

Regards.

eCommerce Developer.

Former Member
0 Kudos

Make sure that the J2EE is set to debug mode correctly and you have the correct debug port. You can get the debug port details in many different ways. One way is to run http://localhost:<port>/nwa and get the system information with all these details. Another way is to go through J2EE engine's Config Tool. If you followed the note 1154496, then take a moment to look at the J2EE configuration. In the config tool, see if the following parameters are in place.

-Xrunjdwp:transport=dt_socket,address=<debug_port>,server=y,suspend=n

If you get an error such as "Failed to connect to remote VM. Connection Refused". This normally means that J2EE server isn't started, or there is already a debugging session started via jpda. Check J2EE is running, and check the Debug perspective to make sure that it isn't running.

Former Member
0 Kudos

Thank yo both very much for your help.

I ran it more than once and that's why I got the error (Easwar, you're right). now no more errors.

Sorry I have one more question (the last one): now the project crmhomeshrext~sap.com is in debug mode, I started http://localhost:50200/b2b/b2b/init.do (my b2b web application) and it's waiting ..... , how can I know which breakpoint is reached? how to continue (F5/6/7/8 commands are grayedout)?

Please advise and help.

Thanks, Jin

Former Member
0 Kudos

Go To "Debug" Perspective. Create new "Remote Java Application" Configuration.

On Right side you have 3 Tab

1) Connect

2) Source

3) Common

Click on "Connect" tab.

Click on "Browse" button on right side and select "~home-shr-"

Connection type "Standard(Socket Attach)

Connection propert

Host:- Your Host name

Port:- 50221

Click on "Common" tab

Type of launch configuration - Local

Debug Mode:- Default

Debug in fav menu :- selected.

Click on Apply.

Now go to Java Prespective.

Double click on line number in your JAVA file where you want to put Break point. Click on Debug icon or select your recent debug configuration to start.

Once you start your debug in NWDS, now go to browser access your application and when your application hit the Java file to process your NWDS window will blink in the "Task Bar" click on NWDS.

Done you are at your break point in debug perspective.

Regards.

eCommerce Developer.

Former Member
0 Kudos

Wow, What a detail steps! Thank you so much eCommerce Developer!

I did miss one step: select Debug in fav menu. I selected it now but I still have the same problem. I know one breakpoint is reached the Appl is waiting for something but NWDS window is not blink and all debug commands are not avaiable.

You and everyone help me so much, so that I close this thread and open new one for further help.

Thanks alot again, Jin

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Jin,

have you set up a local project and created a debug configuration in NWDS?

Then running the debug configuration as just choosing the Debug prospective does nothing on its own.

There is an SAP note that has an attachment on the required settings for debugging.

Cheers

Andrew

Former Member
0 Kudos

Hi Andrew,

Thanks for your help. I did not create a debug configuration in NWDS. Could you please provide me some info on how to?

Thanks, Jin

Former Member
0 Kudos

Hope you enabled Debug in the IDE also. Is that what you meant by (3)? Check if the debug port actually gets active when you enable debug in the IDE. Check the ports. In a DOS command use netstat -a and see if the debug port is listed.

Former Member
0 Kudos

Hi Easwar,

Thanks for your quick reply and help. I am using NWDS, the Debug Port is on the list amd status is Listening.

Any advise / suggestions?

Thanks, Jin