Skip to Content

When you develop a SAP Java application (Portal, PI, WDJ, Neo) you do not have to take too much care into the Java classes used by your project. The Eclipse SDK is already handling this. Nevertheless, from time to time you may want to know more about the Java classes packaged in JAR files used by your applications. Alternatively, you even get charged in providing reports detailing the class references your project is using, or even tasked with creating reports that show the Java classes used in a NetWeaver installation.

One tool that helps you in getting reports out of the content of JAR files is tattletale.A look at the feature list shows that several of it are appealing:

  • “Identify dependencies between JAR files
  • Spot if a class/package is located in multiple JAR files
  • Spot if the same JAR file is located in multiple locations
  • With a list of what each JAR file requires and provides
  • Locate a class in a JAR file” [1]

The most obvious use case where the reports tattletale provides helps you is finding “that CLASS” that is somehow missing (ex: JCA use cases). It reports the dependencies your application has as well as finding a duplicate (outdated) CLASS inside a JAR file.

Two directory that contain valuable JAR packages from SAP are:

SAP NetWeaver AS Java: 7.0x

  1. /usr/sap/<INST>/JC<##>/j2ee/cluster/server<N>/apps/sap.com/
  2. /usr/sap/<INST>/JC<##>/j2ee/cluster/server<N>/bin

SAP NetWeaver AS Java: 7.3x

  1. /usr/sap/<INST>/JC<##>/j2ee/cluster/apps/sap.com/
  2. /usr/sap/<INST>/JC<##>/j2ee/cluster/bin

To get a list of SAP jars you only have to run tattletale against these directories to get the reports.

Reports

It takes a time for tattletale to create the reports, but this is a one time task (per SP, EHP or even release). Still, in my case, the report generation took 30 minutes for the sap.com folder. The reports are rather large. For 7.0x it’s more than 320 MB.

Class location

/wp-content/uploads/2013/02/tattletale1_181100.jpg

The JAR files another JAR file depends on

/wp-content/uploads/2013/02/tattletale2_181101.jpg

Details about a JAR file

/wp-content/uploads/2013/02/tattletale3_181102.jpg

Tattletale can also be run against a single WAR or EAR file:

./java/bin/java -Xmx512m -jar tattletale.jar com.tobias.trn.test.war  ./reports/

/wp-content/uploads/2013/02/tattletale4_181103.jpg

/wp-content/uploads/2013/02/tattletale5_181104.jpg

Possible problems

There can be many, many JAR files inside a directory like apps/sap.com. If this is the case, tattletale will exit with an OOME:

./java/bin/java -jar tattletale.jar /usr/sap/CTB/JC00/j2ee/cluster/server0/apps/sap.com/ ./reports/

Exception in thread “main” java.lang.OutOfMemoryError: Java heap space

        at javassist.bytecode.ConstPool.readOne(ConstPool.java:1055)

        at javassist.bytecode.ConstPool.read(ConstPool.java:1033)

        at javassist.bytecode.ConstPool.<init>(ConstPool.java:149)

        at javassist.bytecode.ClassFile.read(ClassFile.java:764)

        at javassist.bytecode.ClassFile.<init>(ClassFile.java:108)

        at javassist.CtClassType.<init>(CtClassType.java:94)

        at javassist.ClassPool.makeClass(ClassPool.java:717)

        at javassist.ClassPool.makeClass(ClassPool.java:695)

        at org.jboss.tattletale.analyzers.AbstractScanner.scanClasses(AbstractScanner.java:179)

        at org.jboss.tattletale.analyzers.JarScanner.scan(JarScanner.java:106)

        at org.jboss.tattletale.analyzers.WarScanner.scan(WarScanner.java:175)

        at org.jboss.tattletale.Main.execute(Main.java:612)

        at org.jboss.tattletale.Main.main(Main.java:1099)

Adjust the heap size to a value high enough like [2]:

./java/bin/java -Xmx512m -jar tattletale.jar /usr/sap/CTB/JC00/j2ee/cluster/server0/apps/sap.com/ ./reports/

Tattletale needs Java 5 to run.  In case your NetWeaver is <7.1, you’ll have to install Java 5.

[1] Tattletale home page http://www.jboss.org/tattletale

[2] Documentation http://docs.jboss.org/tattletale/userguide/1.2/en-US/html_single/#running

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Robin van het Hof

    Nice blog Tobias, thanks for sharing!

    In addition, Tattletale may also help in finding duplicate classes with different versions — or duplicate jar files in different locations.

    (0) 
    1. Former Member Post author

      Hi Robin,

      yes, tattletale comes with additional reports like the ones you mentioned. I skipped them to prevent people running these reports against the JAR files used by NW AS Java. People might come to the right or wrong conclusion ๐Ÿ˜†

      (0) 
  2. Former Member

    Hi Tobias,

    I liked your blog.

    It is very good to find  a tool like http://www.jboss.org/tattletale

    which is not only helpful but also a great help to all Java Developers.

    It helps not only in finding the duplicate classes with different versions but also creates a reports based on the class files.

    Another point I need to ask from both you and Robin; is it feasible to change the SAP Standard onclick event to onkeypress event ?

    I have posted the below post in this regard.

    http://scn.sap.com/thread/3311732

    Thanks & Regards

    Kaushik Banerjee

    (0) 

Leave a Reply