Showing posts with label Debugging. Show all posts
Showing posts with label Debugging. Show all posts

Thursday, April 25, 2013

Tips - Some useful parameters for starting a WSO2 server

Before you start, first go to <CarbonHOME>/bin . Where <CarbonHOME> is the directory of the carbon server.


Start a carbon server with 1 port offset

(Useful when you need to start multiple servers (ESB, BPS, AS etc) at same time)

$ ./wso2server.sh -DportOffset=1



Start a Carbon server with remote-debug mode on port 5005


$ ./wso2server.sh debug 5005


 

Tips - Remote Debug with Maven 3 - Plug-in Debug

How to Debug a Maven Plug-in at Build time.

1) Open maven plug-in source code using your favorite IDE ( Eclipse, InterlliJ IDEA etc) and set break points in codes that you are going to debug.

2) Start build project using following command.

$ mvnDebug clean install 
 
3) maven starts to Listen on port 8000 till a remote debugger connects.

$ mvnDebug clean install
Preparing to Execute Maven in Debug Mode
Listening for transport dt_socket at address: 8000

 
4) Start remote debug on port 8000 using your IDE. It will trigger the build process with remote debug.

Tips - Remote Debug with Maven 3 - Test-cases

How To Debug Test-cases with Maven at maven run time

1) Open your Project with your favorite IDE ( eclipse, intellij IDEA etc) and set break points that you are going to debug.

2) Build the project using following parameters

$mvn clean install -Dmaven.surefire.debug

3) It starts to build your project and it will stop at test cases.

[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ org.wso2.bps.integration.tests ---
[INFO] Compiling 41 source files to /data/source/branch/carbon410/platform/products/bps/3.0.2/modules/integration/org.wso2.bps.integration.tests/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12:test (default-test) @ org.wso2.bps.integration.tests ---
[INFO] Surefire report directory: /data/source/branch/carbon410/platform/products/bps/3.0.2/modules/integration/org.wso2.bps.integration.tests/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Listening for transport dt_socket at address: 5005



4) Start remote debug on port 5005 using your IDE. It will trigger the build process with remote debug.


Source : http://maven.apache.org/surefire/maven-surefire-plugin/examples/debugging.html

Tuesday, September 6, 2011

Remote debugging problem (Tomcat): "Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options"


 Hi all,

Today I tried to remotely debug the Apache ODE source using Apache Tomcat 7 and Intellij IDEA. If you are interested in remotely debug,  follow this tutorial http://isharapremadasa.blogspot.com/2011/09/how-to-debug-apache-ode-with-apache.html.

Problem:

I tried it in windows 7. But i was unable to halt the Tomcat's the catalina script at ODE deployment. So i tried to set following windows environment variables (given by IDEA, and modified as suspend=y) for JAVA_OPTS using, 

set JAVA_OPTS=%JAVA_OPTS% -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000

and then tried to run catalina script by running,

catalina.bat jpda run

Then I got this;

ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options.
Error occurred during initialization of VM
agent library failed to init: jdwp

Why ? and Solution

Then I googled about this problem and found the error: when i am going to define both JPDA and environment variables at ones, it cause to generate two instance of debugger and that is not possible. By removing one of them will solve the problem.

So I tried it again removing jpda parameter, and finally I was able to halt the catalina script without ODE deployment.


Notes:


JPDA stands for The Java Platform Debugger Architecture. which is a collection of APIs to debug Java code. (see http://en.wikipedia.org/wiki/JPDA )