0

I have a webapp that uses some adobe blazeds jars ie. flex-messaging-core.jar. I would like to step-in to methods contained within this jar (AMFConnection.java). I recompile this jar running an ant script from the source and place it in the WEB-INF\lib folder. What is the easiest way to debug this jar?

Amit Deshpande
  • 18,407
  • 4
  • 42
  • 69
MikeW
  • 4,599
  • 9
  • 38
  • 76
  • Flex Builder should provide you option of debugging. – Amit Deshpande Sep 25 '12 at 04:52
  • 1
    What tool do you use to debug? For instance with Eclipse you have to make sure Eclipse has access to the source code of the jar. Then you can add breakpoints. – jan.vdbergh Sep 25 '12 at 04:53
  • @AmitD, this is eclipse, attempting a pure java client for blazeds. – MikeW Sep 25 '12 at 04:55
  • 1
    You should do remote debugging as given in - http://stackoverflow.com/questions/975271/remote-debugging-java-application – randominstanceOfLivingThing Sep 25 '12 at 04:57
  • You should use remove debugging from eclipse.Add break point just before step in. Then use step in. It may ask you for sources provide jar file which contains sources. – Amit Deshpande Sep 25 '12 at 04:58
  • @Jan.vdbergh , I use catalina args to debug the web application and then attach through a new configuration. This works fine for the web app, but I want to also step into a jar that is inside the lib folder. – MikeW Sep 25 '12 at 04:59
  • @Suresh Koya, thanks that is the method I use for debugging the web app. I want to complicate that scenario by stepping into the jar - can I have 2 apps remotely debugged? – MikeW Sep 25 '12 at 05:01
  • 1
    Typically what I do to debug a thirdparty class is to compile it. Put it in WEB-INF/classes directory and debug that modified class. That way I am not debugging about the whole jar but just the class. – randominstanceOfLivingThing Sep 25 '12 at 05:09
  • Thank's Suresh, that's also really good info. – MikeW Sep 25 '12 at 23:26

1 Answers1

1

Conceptually debugging the source that resides in the jar and loaded by the war has nothing special about it. It should be easily done with IDE.

The only requirements are that your IDE will have the corresponding source files configured in the project.

Your project even doesn't have to contain all the sources - its enough that it will have the relevant sources and you'll be able to remotely debug your code.

In terms of application server/web server/any container whatsoever it boils down to running an application in the debug mode. Technically you supply some parameters to the JVM and it runs so that enabled connections from your favorite debugger - very flexible actually.

The only thing you should ensure (at least I would take a look on ant script for this :) ) - that you don't compile your sources with '-d' option.

This option, when given to the java compiler, makes it compile the byte code that doesn't contain debug information. This way you get the more optimized class but can't debug it. For example by default the classes coming with JRE (java.lang.. java.util., and so on) are compiled this way.

Hope this helps

Mark Bramnik
  • 31,144
  • 4
  • 41
  • 69