Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2007

Tip: Looking for answers? Try searching our database.

source for servlet-api.jar

Thread view: 
Larry - 21 Aug 2007 18:14 GMT
My project uses servlet-api.jar.  When debugging, I wanted to step
into its classes (such as HttpServlet) but I got "Source code not
available".  I found what I thought was the source at
https://sdlc4e.sun.com/ECom/EComActionServlet/DownloadPage:~:com.sun.sunit.sdlc.
content.DownloadPageInfo;jsessionid=4582C4DED0562E245D9FE010014C316A;jsessionid=
4582C4DED0562E245D9FE010014C316A?DirOpen=ESD8%2Fcommsrc%2Fj2eeri%2F1.4.1&fileDir
ectoryHrefId_20=&LineItem=0


However, when I did "Attach Source" from the debugger, i found that
the source line numbers did not actually correspond to what's in my
version of servlet-api.jar.  I tried adding the relevant source code
directory to my project, but that messed me up somehow... I get a
ClassNotFound error on a class that's in my own project.

Help!  How do I step through servlet-api.jar ?
Daniel Pitts - 21 Aug 2007 18:29 GMT
> My project uses servlet-api.jar.  When debugging, I wanted to step
> into its classes (such as HttpServlet) but I got "Source code not
[quoted text clipped - 7 lines]
>
> Help!  How do I step through servlet-api.jar ?

servlet-api is implemented by your J2EE application container, so it
depends on which one you are using.  If your using resin, look at
there website, if you're using JBoss, look there, etc...
Larry - 21 Aug 2007 18:33 GMT
> > My project uses servlet-api.jar.  When debugging, I wanted to step
> > into its classes (such as HttpServlet) but I got "Source code not
[quoted text clipped - 11 lines]
> depends on which one you are using.  If your using resin, look at
> there website, if you're using JBoss, look there, etc...

I'm using WebSphere... is that the container?
Manish Pandit - 21 Aug 2007 18:46 GMT
> > > My project uses servlet-api.jar.  When debugging, I wanted to step
> > > into its classes (such as HttpServlet) but I got "Source code not
[quoted text clipped - 15 lines]
>
> - Show quoted text -

Yes, it would be the container. Also, unless you're running websphere
in-process with the debugger or doing remote debugging, you may not be
able to dive deep into container API.

-cheers,
Manish
Larry - 21 Aug 2007 18:52 GMT
> > > > My project uses servlet-api.jar.  When debugging, I wanted to step
> > > > into its classes (such as HttpServlet) but I got "Source code not
[quoted text clipped - 22 lines]
> -cheers,
> Manish

OK, but where do I get the correct source code, and what do I do with
it?
Manish Pandit - 21 Aug 2007 21:19 GMT
> > > > > My project uses servlet-api.jar.  When debugging, I wanted to step
> > > > > into its classes (such as HttpServlet) but I got "Source code not
[quoted text clipped - 27 lines]
>
> - Show quoted text -

Not sure about Websphere - I doubt its code is available.

If it were Tomcat, you can just download the source and attach the
source path in eclipse.

-cheers,
Manish
Daniel Pitts - 22 Aug 2007 21:52 GMT
> > > > > My project uses servlet-api.jar.  When debugging, I wanted to step
> > > > > into its classes (such as HttpServlet) but I got "Source code not
[quoted text clipped - 25 lines]
> OK, but where do I get the correct source code, and what do I do with
> it?

The real question is, are you sure you need to go into it? Perhaps
there is a way for you to debug your program without knowing the
containers source-code.
Larry - 23 Aug 2007 19:08 GMT
> > > > > > My project uses servlet-api.jar.  When debugging, I wanted to step
> > > > > > into its classes (such as HttpServlet) but I got "Source code not
[quoted text clipped - 29 lines]
> there is a way for you to debug your program without knowing the
> containers source-code.

FYI... what I ended up doing is downloading the Java Decompiler (JAD)
and running

 jad -sjava -lnc -nonlb HttpServlet.class

The "lnc" switch puts the line numbers from the original source as
comments in the output source code.  However, the debugger doesn't
know anything about these comments (or at least I don't know how to
get it to take advantage of that), so I ended up writing a Perl script
to rewrite the output from JAD to actually put each line on the same
physical line number that it was in the original source (by putting in
the right amount of blank lines), and that worked in the debugger.

(A cleaner method would be to go into the class file and renumber the
source lines, but I don't know enough about the format of the class
file to do that)
Roedy Green - 22 Aug 2007 09:34 GMT
>Help!  How do I step through servlet-api.jar ?

If you can't get it, you might be able to synthesize it by decompiling
and recompiling. see http://mindprod.com/jgloss/decompiler.html

It would probably take a lot of tweaking though.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Tzadik.Vanderhoof@gmail.com - 22 Aug 2007 19:35 GMT
On Aug 22, 4:34 am, Roedy Green <see_webs...@mindprod.com.invalid>
wrote:

> >Help!  How do I step through servlet-api.jar ?
>
[quoted text clipped - 5 lines]
> Roedy Green Canadian Mind Products
> The Java Glossaryhttp://mindprod.com

Thanks for the idea! I decompiled with jReversePro, but the line
numbers of the decompiled code apparently do not match up with the
line numbers in the .class file, because when I step through in the
debugger, it doesn't make sense.

To solve this, I thought of recompiling the decompiled .java files
back to new .class files, but they won't compile.

How can I solve the line number problem?


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.