Upgrade your Brain

ServiceMix 4.2 – Debugging and more Gotchas

This is the sequel to Getting started with ServiceMix 4.2 and WebServices (with Maven and Eclipse on Windows). Remeber: I’m using Eclipse 3.5.2 on Windows 7 here.

If you want to debug OSGi-bundled code on ServiceMix 4.2, you’ll need to set the environment variable KARAF_DEBUG = true (in System –> Advanced –> Environment Variables, click the “add”-button in the lower list). Then make sure you the console you’re working on (using the “shutdown” command), kill the command window, start a new one (that now knows the environment variable is set) and re-run servicemix. In the console, a message should appear that now a remote debugging port was opened. If not, reread this paragraph (or restart your system).

Then go to the project you’re working on in Eclipse, right click on the project, “Debug As…” –> “Debug Configurations” go to “Remote Java Application”, enter the projects name and the host and port ServiceMix runs on (“localhost” here and the default port 5005). Then click Debug. You should now be able to set Breakpoints and Debug everything nicely. To have debug statements on my Eclipse Console I chose to use a Log4j default debugger. This one logs out to the console as default, which is the connected debug-console when debugging.

  • When re-deploying a bundle containing a WebService that was registered (and worked) before, the connection to the CXF-services break after the update command on the karaf console. The result of a request to the WebService is either a plaintext “No service was found.” or a XML SOAP Fault with the message “No such operation:  (HTTP GET PATH_INFO: /MyServicesName)”. I didn’t find a proper solution for this one yet, but restarting the CXF Service Engine bundle before restarting my own bundle (using osgi:restart [idOfCxfServiceEngineBundle]) containing the WebService works fine. (If someone finds a better solution, please drop a comment)

I’ll update when I find even more ServiceMix gotchas.

One thought on “ServiceMix 4.2 – Debugging and more Gotchas

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top