How do I debug MFP JAX-RS adapters when using the CLI?

187 Views Asked by At

I am using the MobileFirst CLI to start/stop a development server and push code to it. How do I connect a remote debugger (e.g. IntelliJ) to this server and debug a JAX-RS adapter with it?

Since the CLI does not seem to offer a way of starting the server in debug mode directly, I started the Liberty development server from its home with bin/server debug and was able to connect to it, but breakpoints do not seem to be working.

2

There are 2 best solutions below

0
On BEST ANSWER

To connect from IntelliJ to an MFP server started via the CLI with mfp start, select Run>Edit Configurations, Add New Configuration of type Remote and change the port to 10777. When you Run>Debug, you should see Connected to the target VM, address: 'localhost:10777', transport: 'socket' in the Console, and you can now start your debug session. Thanks to @mfunk for figuring it out!

Tested with IntelliJ 15.0.3 and MFP 7.1.

1
On

You can't really debug Java code from the CLI.

Best option is to install MobileFirst Studio to Eclipse and import the project to there in order to debug the Java code. Note that the MobileFirst Server starts also with port 10777 (debug port) by default, so no need for further configuration.