You're starting to settle in at your job, things are going well and you feel the hard parts of learning development on your application(s) have been learned. You continue going about your days being agile and drinking way too much coffee then... BAM out of nowhere you inherit a new application. You're told the jist of what the application does, the reason it was written, and how it fits into your companies workflow, but you've never seen this app? What's inside it? THE DEVELOPERS WHO WROTE IT ARE GONE?! Looks like you have a big problem on your hands....
The WebSphere Application Migration Toolkit for Application Binaries (Binary Scanner) can solve this problem! If you've inherited a WAR or EAR application and need to have a quick, but comprehensive, peak inside you can use the Binary Scanner's Inventory Report:
- Download the Binary Scanner Installer from here.
- Unpack the Binary Scanner using
java -jar binaryAppScannerInstaller.jar
- Run the unpacked jar on your application
java -jar wamt/binaryAppScanner.jar /path/to/your/app/SampleApplication.ear --inventory
Above is an image of the Inventory Report overview for this application. Oh Great! After a quick look at the archive names, this EAR may include some of the source files we were missing in the SampleWebApplication_src.jar and Increment_src.jar as they end with "_src.jar." We'll have to take a further look at those source JAR files outside of this scan. Also, you can see this EAR consists of a few more Java archive files. Based on this tree you may gain insight on which Java archive files are good candidates for deletion or moving. It's time for some further investigation as it looks like most of the archives making up SampleApplication.ear are labeled with a blue "2" to signify they include JavaEE/JavaSE packages inside. Let's expand the Problem Details section below to get more information on the issue found.
Hmmm... 2 of the JAR files within the application are including an EJB package within the app. Knowing a small bit about EJB's this package could just include the EJB Stub classes for the EJB JAR files so this is likely a non issue. PHEW! Dodged a bullet there. At the same time, it looks like there are some Servlet packages being provided by the servlet-api.jar. This may be a good time to open an issue as there could be some class and package conflicts with the application server provided Servlet API. The problem might be as simple as your Maven dependency needs to be marked as "provided" by the application server.
Let's inspect the archive tree shown above for more insight on what to examine next. It seems there are two archives, commons.lang.jar and commons.lang-2.6.jar, with similar names at different levels within the EAR application. Let's scroll down to the Contained Archives section to investigate further.
Interesting! Luckily some recent additions to the Inventory Report include a file hash checksum for you to compare all archives within an application to see if there are duplicates down to a binary level. These Apache Commons JAR files seem to be exact duplicates! Another issue that we should open against the inherited application since there is no need for duplicate binaries.
Now that we are checking the subarchives contained within the application's larger EAR let's see if there is any additional information about the SampleWebApplication.war by expanding the dropdown.
This WAR isn't too complex containing just a few Servlets and JSP files. Not only does the application look straight forward, but it the environment in which it's deployed seems simple as well. I noticed this by viewing the Operational Considerations section of the report shown below. We lucked out with this inherited application as it is deployed to a standalone server. YAY! More simplicity!
The Binary Scanners Inventory Report can be used to look inside familiar and unfamiliar archives to see how your application breaks down to its lowest level. The examples shown are only a small piece of a full Binary Scanner Migration Report. Also check out the analysis and evaluation reports. It never hurts to know EXACTLY what is inside your application.
See the IBM Developer learning path Modernizing applications to use WebSphere Liberty to discover all the application modernization tools available with WebSphere Hybrid Edition.
Also, check out the other articles in this app modernization blog series.