How to debug WSO2 ESB code - wso2

How do you typically debug the ESB code? I am using log statements but they are kind of lost in system logs. Is there a better mechanism to be used?
Thanks,

You can do remote debugging from your IDE with ESB code.
First start the ESB server script with debug option as follows.
wso2server.sh -debug 5005
where the number is any port number used for remote debugging from your IDE.
Then run debug in your IDE with whatever the port number you assigned.

First, you have to setup debug configurations in your IDE which is can be learned using this wso2 article
Then start the ESP server with debug option as follows.
<esb_home>/bin/wso2server.sh -debug 5005
After you start the server you will get this message:
Listening for transport dt_socket at address: 5005
Then start debugging from your IDE!
This is the debug configuration I used:

You can use eclipse IDE.
Start ESB using below command.
wso2server.bat debug 8000 -Desb.debug=true
Setup eclipse remote java application.setup ESB server.

Related

Weblogic 12 remote debug

I want to connect to Weblogic from IDE in remote debug mode. I have added set JAVA_OPTIONS=-Xdebug -Xrunjdwp:transport=dt_socket,address=54840,suspend=n,server=y
to startWebLogic.cmd. After the start the weblogic server print out Listening for transport dt_socket at address: 54840. But when I try to connect I get an error:
Unable to open debugger port : java.net.ConnectException "Connection refused: connect"
I checked the remote debug on 54840 port with Apache Tomcat and everything is good. Please, tell me what is wrong with Weblogic.
WebLogic Server Version: 12.1.2.0.0 development mode.
Check the position of this added message. Noticed in File startWeblogic.cmd,
set DOMAIN_HOME=C:\Oracle\Middleware\Oracle_Home\user_projects\domains\ebilling_domain
for %%i in ("%DOMAIN_HOME%") do set DOMAIN_HOME=%%~fsi
call "%DOMAIN_HOME%\bin\setDomainEnv.cmd" %*
If you add this message before the above. The message will be override by the related code in setDomainEnv.cmd.
if "%debugFlag%"=="true" (
set JAVA_DEBUG=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=%DEBUG_PORT%,server=y,suspend=n -Djava.compiler=NONE
set JAVA_OPTIONS=%JAVA_OPTIONS% %enableHotswapFlag% -ea -da:com.bea... -da:javelin... -da:weblogic... -ea:com.bea.wli... -ea:com.bea.broker... -ea:com.bea.sbconsole...
) else (
set JAVA_OPTIONS=%JAVA_OPTIONS% %enableHotswapFlag% -da
)
I have connected the remote server successfully.
Despite the fact the thread is kind of ancient, maybe I still can help a bit.
It seems weblogic comes ready to run in debug mode. I was able to use it setting the following environment variable:
Windows powershwell
$env:debugFlag = 'true'
Linux
export debugFlag=true
It happens that weblogic start scripts come ready to use this variable and it sets port 8453 as default for you to attach your debugger (probably with any moddern IDE).
If you still need to change that default port you can use another env variable (follow the above patterns for windows ad linux):
DEBUG_PORT = 54840
This way you probably wont have to mess with weblogic scripts.
I'm using weblogic 12c (12.1.3), folowing this article, and it worked fine for my case: https://www.linkconsulting.com/oracle/weblogic-remote-debugging-using-jdeveloper
Regards!

Unable to point VMC to my local cloud: HTTP exception: Errno::ECONNREFUSED:No connection could be made because the target machine actively refused it

WHAT AM I TRYING TO DO
Trying to setup a VCAP on a UBUNTU SERVER VM on my machine by following the steps mentioned at https://github.com/cloudfoundry/vcap/
WHAT IS THE ISSUE
Things seemed to be working fine but at step5 (https://github.com/cloudfoundry/vcap/#step-5-validate-that-you-can-connect-and-tests-pass) I got an exception while trying to execute the following command - vmc target api.vcap.me
The exception that I see on my console is:
Host is not available or is not valid: 'http://api.vcap.me'
Would you like see the response? [yN]: y
HTTP exception: Errno::ECONNREFUSED:No connection could be made because the target machine actively refused it. - connect(2)
ANY OTHER RELEVANT INFO
For some earlier experiments I was using MicroCloud (provided as a download by CloudFoundry). I am having issues in pointing my VMC to this Microcloud as well.
On the Micro Cloud console I see the following message:
To access your Micro Cloud Foundry instance, use:
vmc target http://api.agoel.cloudfoundry.me
When I run this vmc command from the Ruby Command Prompt setup on my Windows7 I get following error:
Host is not available or is not valid: 'http://api.agoel.cloudfoundry.me'
Would you like see the response? [yN]: y
HTTP exception: Errno::ETIMEDOUT:A connection attempt failed because the connected party did not properly respond after a period of time, or
ost has failed to respond. - connect(2)
WHATS DOES VMC INFO DISPLAY
I ran vmc info command on command prompt. It displayed following info
VMware's Cloud Application Platform
For support visit support DOT cloudfoundry DOT com
Target: http:// api DOT cloudfoundry DOT com (v0.999)
Client: v0.3.18
User: ankitgoel1987#gmail.com
Usage: Memory (1.1G of 2.0G total)
Services (2 of 16 total)
Apps (2 of 20 total)
MY SETUP DETAILS
Windows7 running on 4GB RAM
Microcloud from Cloudfoundry already installed (this was done as part of some other exercise. My recent experiment requires me to setup a Ubuntu server with VCAP on it. So this MicroCloud should not really matter)
vmc 0.3.18 (installed on my Windows7 machine)
ruby 1.9.2p290 (2011-07-09) [i386-mingw32]
add in your hosts files the following entry:
IP_of_ubuntu_server vcap.me api.vcap.me
If you want to avoid having to edit your hosts file every time you deploy a new app and depending on what virtualisation platform you are using you may be able to forward all traffic on port 80 for your own computer on to the VM.
*.vcap.me is set to resolve to 127.0.0.1 so this is an ideal solution. To do this you should set the network settings to NAT rather than Bridged (maybe you have done this already) and then set port 80 to forward to the IP of the guest OS. In VMWare Fusion for example this is as simple as editing a settings file.

eclipse listening on port 8000

My eclipse somehow starts listening on port 8000. I have no idea why it does so. I am using Eclipse for Python development (using PyDev tools).
This default port conflicts with default Django development server port viz 8000. I am not able to start Django development version. Off course I can shutdown eclipse, start Django and then restart eclipse, but I would prefer to disable the usage of port 8000 by Eclipse.
On Internet I saw some references to remote debugging capabilities of Eclipse, but could not figure out how to change this default port number.
I figured out that this problem was happening because of Aptana JavaScript Debug Console which attempts to start a builtin HTTP server in port range (8000 onwards whichever port it finds available first). I just changed this port range in preferences and now I am good.
If you want to start Django's development server on a another port, just add this parameter:
python manage.py runserver 8001

Cannot get Step Debugging to work in Eclipse/CF 8

I just can't seem to get step debugging to work in CF 8 and Eclipse. Eclipse is running on my local machine and CF 8 is running on a non-local "intraweb" development server.
I think I have everything setup correctly:
RDS Working fine
Server configured to allow line debugging on port 5005 (port 5005 is not being used on server)
Added -DDEBUGGER_SERVER_PORT=5005 to the jvm.config file to force the debugging service to use port 5005.
In the RDS Configuration in Eclipse, the "test connection" is successful.
In RDS configuration, the "Test Debugger" button returns "Test debugger failed" with details that the server is listening on port 5005 but is not the port set in CF Administrator, which doesn't make sense since it IS the port that is set in CF Administrator.
If I restart the CF Server and hit the "test debugger" button, I will get the "test debugger was successful" message, but if I then hit it again a second time and on subsequent times, the connection will fail. (Trying to run the debug configuration directly after a restart will also fail.)
Would anyone have any ideas?
Thanks Jeff
The problem is solved. We had a special firewall setup (outside of windows server) and the port was being blocked. Unblocked the port, and everything works.
We had this problem too. If you are using IIS, turn off compression for Application Files (found in the "Service" tab in properties).

Using Eclipse to remotely debug with gdbserver

Does anyone know why I can't use Eclipse CDT to remotely debug a device when I manage it on the command-line with gdb using target remote command? I do get a warning when connecting, but other than that it seems to work fine.
With Eclipse I should have the correct settings and gdbserver informs me on the remote machine that a connection was establised but after that Eclipse gives an error: 'Launching Debug' has encountered a problem. The request failed: Target is not responding (timed out). Remote device also says "Killing inferior" (which I don't get with gdb). The error log shows nothing else either.
I am using the same process, binary and gdb executable in both cases and connecting to the same device & port. I'm using gdb 7.1 and the host is 64-bit Ubuntu Lucid.
I had same issue and found that iptables was generating issues.
Have you tried stopping or disabling your firewall? In case of iptables you have to do:
/etc/init.d/iptables stop
On the other hand, after you start your application (before connecting your debugger) have you checked the debug port availability through netstat?
#On linux
netstat -nap
#On windows
netstat -nab
Hope to help.