MaintainJ Blog

December 9, 2009

Installing MaintainJ.war on WebLogic

Filed under: Uncategorized — maintainj @ 6:42 am

Install MaintainJ.war to WebLogic server through the admin console and not using the WebLogic Eclipse plug-in. There are some issues when it is installed using the WebLogic Eclipse plug-in.

Choudary Kothapalli.

November 4, 2009

MaintainJ V3 Milestone 1 is out

Filed under: Uncategorized — maintainj @ 11:51 pm

Check here for the release details and what’s coming in next few months.

Choudary Kothapalli.

October 15, 2009

A bug affecting MaintainJ in multi-threaded applications

Filed under: Uncategorized — maintainj @ 10:14 pm

MaintainJ detects loop and recursive calls and filters out those calls to keep the diagrams uncluttered. If a method is called in a for loop of 1000 iterations, the call is shown only once in the diagram.

To implement this, once a loop or recursive call is detected, MaintainJ automatically turns off tracing until that call returns. It should turn off tracing just for the current thread, but currently tracing is turned off for all active threads. This is leading to some missed calls in diagrams in multi-threaded applications.

The fix is in MaintainJAspect.jar. Replace the MaintainJAspect.jar in eclipse\plugins\com.maintainj.launcher.core_x.x.x and eclipse\plugins\com.maintainj.umlDiagram_x.x.x. If you are using MaintainJ.war to instrument web applications, replace the MaintainJAspect.jar copied by MaintainJ.war.

Choudary Kothapalli.

September 27, 2009

How to analyze non-UI applications like socket servers?

Filed under: Uncategorized — maintainj @ 6:23 pm

All the MaintainJ video demos show analyzing GUI applications, but you can also analyze non-GUI applications (for that matter any non-J2ME Java code). One query I got was how to use MaintainJ on a socket server application. Socket server applications typically do not have a GUI and it is not easy to define the start and end points of a use case. This post addresses this issue. The same procedure can be applied to GUI applications as well when you do not want to manually click the Start and Stop Tracing buttons.

The key here is to identify a entry call to the application after which all the calls must be traced. Tracing will be turned on before this method is entered and turned off immediately after this method exits. The call trace is written to a file with name ‘traceFileXX_threadName.ser, where XX is the trace file count starting from 1.

For a Servlet based application, this could be MyAbstractServlet.service(..) method, where all the Servlets in the application override or implement service(..) method. Typically this will be a ‘facade’ or ‘entry’ method in an abstract class or interface where all processing starts with a call to this method.

Once such a method is identified, you need to manually change the aspect (aop.xml) file as follows:

<aspectj>
<aspects>
<concrete-aspect name=”com.maintainj.inst.MyAspect” extends=“com.maintainj.aspect.HeadlessExecutionAspect”>
<pointcut name=”anyExecution” expression=”execution(* *.*(..)) || execution(*.new(..))”/>
<pointcut name=”entryCall” expression=”execution( * com.xxx.MyAbstractServlet.service(..))”/>
</concrete-aspect>
</aspects>
<weaver options=”-proceedOnError -nowarn”>
<include within=”com.xxx..*”/>
<exclude within=”com.maintainj..*”/>
</weaver>
</aspectj>

Pay attention to the changes in blue. The first change is the super aspect that is extended, which is HeadlessExecutionAspect. This is same for any type of application, Java/J2EE/Eclipse plug-in, as long as you want to generate the trace files in headless mode. You also need to use a different version of MaintainJAspect.jar. Replace the MaintainJAspect.jar in eclipse\plugins\com.maintainj.launcher.core_x.x.x and eclipse\plugins\com.maintainj.umlDiagram_x.x.x. If you are using MaintainJ.war to instrument web applications, replace the MaintainJAspect.jar copied by MaintainJ.war.

The second change is the pointcut. If in the auto generated aop.xml there is a second pointcut below ‘anyExecution’ pointcut, delete that and add the new ‘entryCall’ pointcut. This is where you are defining the entry call to your application. The class name here can either be an abstract class or interface or a concrete class. Ensure that the ‘facade’ class is included in the instrumentation scope.

You can start with the auto generated aop.xml and then change it. The location of the auto generated aop.xml for various wizards is discussed in this post. If you are using one of the MaintainJ Run Configurations, in the ‘Aspect’ tab check the ‘Do not regenerate aop.xml’ so that your changes will not be overwritten.

The trace files are written to the current folder from where the application is started. Locate the trace files and copy them to a project in Eclipse workspace to view the beautiful MaintainJ diagrams!

This process will be automated in the next release of MaintainJ. Until then, this little tweaking of the aop.xml should get you going.

Choudary Kothapalli.

Next Page »

Powered by WordPress