Re: Classpath problem

[email protected] Fri, 28 Apr 2006 13:34:14 -0700 (PDT)
Newsgroups gmane.comp.java.jswat.user
Message-ID <[email protected]>
Two good points here, one is the Fix Imports action should be hidden.
Without a properly configured classpath it will zap many of the import
statements in your source file. Editing by hand is fine, that's up to you=
,
but the debugger should not expose actions that quickly lead to problems.
So, don't run the Fix Imports from JSwat; it will be removed in the next
release.

Second, about the classpath. It is poorly documented, but when you attach
to the debuggee, the classpath from the debuggee is what takes precedence
over anything you've set in the debugger. So, at a minimum that needs to
be more clearly documented. Ideally, the debugger should merge the paths
from the session settings and the debuggee.

Now, as to why you still see red error stripes: the Tomcat classpath is
probably only a minimum of the jars needed to bootstrap the system. From
that point onward, it uses custom classloaders to load everything else
(NetBeans has this same "problem"). As far as the debugger knows, the
classpath of the debuggee is just the stuff that's in the -cp argument
used to launch the debuggee.

You can work around this by getting the Tomcat source and adding it to th=
e
Sources session setting, but that would be overkill. The error stripes ar=
e
harmless and you can safely ignore them.

I'll look into the merge solution, since it seems easy and avoids the
misleading error stripes.

Thanks

n


Jay Burgess wrote:
> I've read the FAQ, searched the list archives, etc., but still can't
> resolve the following issue:
>
> I'm running a servlet in Tomcat 5.0.19 (on Windows XP) and seem to be
> able to connect and debug using JSwat 3.10.  However, there is one mino=
r
> problem, that I think is associated with the classpath.
>
> I first start Tomcat.  I then bring up JSwat and set my classpath and
> sourcepath in the Session Settings dialog.  Everything seems to resolve
> correctly, and I can see and open all of my source files from the
> Sources tab.
>
> However, sometimes after I "Attach" to Tomcat, I get hundreds of "canno=
t
> find symbol" errors in my source with wavy red lines below.  Oddly
> enough, I can still set breakpoints and step through the source, and it
> only seems to happen some of the time (though I can force it to happen
> by running "Fix Imports" at this point).
>
> I noticed specifically that the settings in the Classes tab change
> before and after I Attach.  Before, my correct .jars were present.
> After, only tools.jar and bootstrap.jar were listed. I believe this is
> fundamentally the root of the issue.
>
> So, is there a way to force my original classpath setting to stay fixed
> after Attach'ing?  Or is there some other solution that will allow me t=
o
> debug given my configuration?  I also tried launching Tomcat from JSwat=
,
> thinking that this would force it to hold onto the classpath I defined,
> but never could get the config details right. (For reference, I
> currently call "catalina.bat jpda start" after setting the necessary
> envvars.)
>
> Thanks.
>
> Jay