[opencms-dev] Remote debugging OpenCms with Eclipse

Jonathan Woods jonathan.woods at scintillance.com
Fri Jan 19 11:54:56 CET 2007


Martin -

There may be some useful documentation on the wiki
(http://opencms-wiki.org/); haven't checked it out for a while.

It's taken me the best part of a year to get my dev environment to where it
is now.  I use a heavily structured Eclipse tree, an Ant script of around
1000 lines, and lots of Ant-driven variable substitution to reproduce
environments quickly and easily - a new OpenCms environment within 5
minutes, and a fully rebuilt & updated module within 30 seconds.  (Yet I
still haven't cracked the remote JSP nut!)

Remote debugging itself is actually fairly easy to set up.  The command line
which kicks off OpenCms needs the following additional magic:

-agentlib:jdwp=transport={{runtime.jpda.transport}},server=y,address={{runti
me.jpda.address}},suspend=n

where {{runtime.jpda.transport}} has the value 'dt_socket' (without quotes)
and {{runtime.jpda.address}} is the port (sic) on which you want the
debugger to listen.

The other side of the equation is the Eclipse debug launch config.  Set up a
new Remote Java Application config with host =
{{runtime.servinghost.primaryname}} and port = {{runtime.jpda.address}},
substituting values for your case.

In case it's of any use, here's the whole command line which kicks off my
remote OpenCms, with my Ant script replacing the stuff in {{..}} with
appropriate values.

Windows (all on one line):

"{{runtime.java.home.string}}\bin\java"
-Dscintillance.instanceName={{app.name}}-{{runtime.servinghost.primaryname}}
{{runtime.java.localeString}}
-agentlib:jdwp=transport={{runtime.jpda.transport}},server=y,address={{runti
me.jpda.address}},suspend=n
-Djava.endorsed.dirs={{runtime.tomcat.home}}/common/endorsed
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file={{runtime.catalina.base}}/conf/logging.prope
rties -classpath {{runtime.java.classpath}} -Djava.awt.headless=true
-Dcatalina.home={{runtime.catalina.home}}
-Dcatalina.base={{runtime.catalina.base}}
-Djava.io.tmpdir={{runtime.catalina.base}}/temp
org.apache.catalina.startup.Bootstrap start >
{{runtime.catalina.base}}/logs/catalina.out

Linux (all on one line):

{{runtime.java.home}}/bin/java
-Dscintillance.instanceName={{app.name}}-{{runtime.servinghost.primaryname}}
{{runtime.java.localeString}}
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file={{runtime.catalina.base}}/conf/logging.prope
rties
-agentlib:jdwp=transport={{runtime.jpda.transport}},server=y,address={{runti
me.jpda.address}},suspend=n Djava.compiler=NONE
-Djava.endorsed.dirs={{runtime.tomcat.home}}/common/endorsed -classpath
{{runtime.java.classpath}} -Djava.awt.headless=true
-Dcatalina.home={{runtime.catalina.home}}
-Dcatalina.base={{runtime.catalina.base}}
-Djava.io.tmpdir={{runtime.catalina.base}}/temp
org.apache.catalina.startup.Bootstrap start >>
{{runtime.catalina.base}}/logs/catalina.out 2>&1 &

Jon 

-----Original Message-----
From: sfdbfoui at host2.scintillance.com
[mailto:sfdbfoui at host2.scintillance.com] On Behalf Of Martin Hoeller
Sent: 19 January 2007 08:06
To: The OpenCms mailing list
Subject: Re: [opencms-dev] Remote debugging OpenCms with Eclipse

Hi Jonathan!

> I use a decent Eclipse development environment to produce OpenCms 
> apps, and I'm able to remotely debug a running OpenCms instance.  The 
> only thing missing is JSP source attachment, and I'm wondering if 
> anyone else has managed to sort this out.

I had this working... somehow. As my eclipse workspace and my VFS were not
synchronized it happened, that the source code and the actually executing
code drifted some lines apart, but basically it worked.

However, I just tried to reproduce it and I'm not able to :( Na matter what
I choose to be the source folder Eclipse (3.2.1 BTW) doesn't find the
source. The only thing I can definitely say is that I didn't specify any
special folder for this to work. Eclipse just found it.

> I'm using Eclipse + J2EE/WTP, by the way, but not defining servers etc 
> that way.

That is different to what I used. I copied a working OpenCms instance in a
"Dynamic Web Project" of eclipse and had thus OpenCms running inside Tomcat
which was under control of Eclipse.

However, I don't like this way of running OpenCms too much. Setting it up is
quite a task and Eclipse does some magic behind the scenes that I'm not
totally aware of.

How did you set up your environment? Is there some documentation online
available?

regards,
- martin
-- 
    mailto:martin.hoeller at xss.co.at  | When the time comes, I want to
http://stud3.tuwien.ac.at/~e9926483  | die calmly in my sleep, like my
                       icq:45563199  | grandfather and not screaming and
                                     | scared like his passengers.




More information about the opencms-dev mailing list