Debug openMRS module in eclipse

coldwaterphewServers

Nov 17, 2013 (3 years and 10 months ago)

231 views

<GUIDE
LINE>

Environment:

-

Debug openMRS module in eclipse.

-

openMRS run on tomcat server.

Overview:

-

Using JPDA transport to communicate between
eclipse and virtual machine (JVM).

-

W
on’t use “startup.bat” (on Window) to start tomcat.

We will create another scr
ipt (.bat) file to
start tomcat server

and setup JPDA transport environment in it.

-

Create the remote debug instance in eclipse and connect to the tomcat process.

-

It’s
simple

with tomcat server.

Steps:

1.

Create a .bat file contains following information
:

set
JPDA_ADDRESS=8000

set JPDA_TRANSPORT=dt_socket

set JPDA_SUSPEND=y

D:
\
tomcat
\
bin
\
catalina.bat jpda start


Note:

-

set JPDA_ADDRESS=8000

: we will open the port 8000 for JPDA, eclipse will
connect to tomcat server through this port

-

set JPDA_TRANSPORT=dt_socke
t

: identify the name for socket

-

set JPDA_SUSPEND=y

: the process will suspend to wait for connecting.

-

D:
\
tomcat
\
bin
\
catalina.bat

: the path of catalina.bat file

(in
tomcat
\
bin

directory
)

-

Jpda start : start with jpda transport.

2.

Config
ure

an instance in
ecl
ipse for remote debug
:


Choose “
Debug Configurations…”



Choose
“Remote Java Application”

(in the left panel) and create a new instance for it.

3.

Start server and connect to debug:

-

Start the tomcat server by running the .bat file we have already made in st
ep 1

-

The command window will appear as the following image


-

Lay a breakpoint on the Java source code
and choose debug with the instance of debugger
that we
has configured

in step 2.

Verified with:

SpringSource Tool Suite

Version: 2.9.1.RELEASE

Build Id:
201203221000

jdk1.6.0_30

Apache Tomcat Version 6.0.29

openMRS 1.8
, HISP India registration 2.2.14
-
SNAPSHOT module

Reference:

http://docs.oracle.com/javase/1.4.2/docs/guide/jpda
/conninv.html

Author: Thai Chuong
, Vo Minh Luan

Thaichuong159@gmail.com

Vominhluan88@gmail.com

<
May 17
th

2012
>