[opencms-dev] Remote debugging OpenCms with Eclipse

Jonathan Woods jonathan.woods at scintillance.com
Fri Jan 19 15:07:50 CET 2007


Martin -

Hooray!  Thanks to your prompting, I've solved it for myself too and I'm now
debugging JSPs nearly as easily as Java source.  I'm using Eclipse 3.2.1
too, with WTP - though not entirely sure that WTP is even necessary for this
to work.

Some observations/thoughts/instructions for others:

1.  Under OpenCms's control, the JSP compiler produces intermediate Java
source and then Java .class bytecode.  These are accessible to OpenCms on
the filesystem of the machine hosting it.

2.  The bytecode is as usual annotated with the source file path and line
number information.  That's what the JVM feeds back to the attached
debugger, in my case running remotely; and that's how Eclipse knows what
source to try to open/show even though it hasn't got filesystem access to
OpenCms's filesystem copies of JSPs, intermediate Java and .class bytecode
files.

3.  The 'source file path' which is annotated into compiled JSPs happens to
be this:

	WEB-INF/jsp/offline<VFS path to JSP file, beginning with / and
ending with the file name like 'myJSP.jsp'>

(and the online equivalent).

For example,

	WEB-INF/jsp/offline/system/modules/elements/pageheader.jsp

4.  This is therefore the path which Eclipse must be able to find.  It looks
for this path in (underneath) any source folders you've defined in the
workspace, and in any other source locations (e.g. real filesystem folders,
archives etc) which you've defined on the Source tab of the Debug launch
configuration in use.

5.  I know what you mean about having JSPs under more than one location -
seems naff.  On the other hand, being forced to hold JSPs within workspace
folders which mimic the structure required above is even worse.  Here's what
I'm now doing:

(i) Whenever I build a new instance of the app, I get Ant to copy JSPs to a
filesystem folder on the dev machine which is nothing to do with the Eclipse
workspace.  Let's call this folder jspsrc.  The JSPs are copied in a
structure which mimics that given above.

(ii) In my debug launch configuration, I've added the filesystem folder
jspsrc as a source search path.  I haven't bothered linking a workspace
folder to this filesystem folder, because I don't need it there.

6.  With this set-up, there are 2 problems:

(i) Breakpoint markers appear only in the 'real' workspace version of the
file

(ii) Not only can you not edit the JSP file and expect changes to be
propagated to the remove server (it _is_ remote, after all), but if you're
debugging a JSP and in error you make a change to its copied version rather
than to the 'real' workspace version, then of course that isn't reflected in
the 'real' version.  In other words, edit only the workspace-hosted JSPs.

Does this all sound right to you?

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:33
To: The OpenCms mailing list
Subject: Re: [opencms-dev] Remote debugging OpenCms with Eclipse

Hi again!

> > 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 can reproduce it now: I have to put the JSPs under
<eclipse-workspace>/<project>/WebContent/WEB-INF/jsp/offline/sites/defaults/
<jsp-name>

Still not happy with this, as I definitely don't want to maintain the JSPs
on two different locations.

Let me know if you find out anything new.

- martin
-- 
    mailto:martin.hoeller at xss.co.at  |
http://stud3.tuwien.ac.at/~e9926483  |  Make it idiot proof and someone
                       icq:45563199  |  will build a better idiot.




More information about the opencms-dev mailing list