Wednesday 6 December 2017

WebSphere Liberty Profile - Snooping About

I've written about the SuperSnoop Servlet before: -

and it's one tool that I use, and reuse, whenever I'm testing a build of WebSphere Application Server etc.

However, it niggled me that, whilst it DOES run on WebSphere Liberty Profile, it doesn't actually work.

Having deployed it: -

cp SuperSnoopWeb.war /opt/ibm/WebSphere/Liberty/usr/servers/defaultServer/dropins/

( I *SO* love the Dropin support on WLP )

and watched the logs: -

[AUDIT   ] CWWKT0016I: Web application available (default_host): http://mfp.uk.ibm.com:9080/SuperSnoopWeb/
[AUDIT   ] CWWKZ0001I: Application SuperSnoopWeb started in 0.085 seconds.


I see this: -


when I hit it, and this in the logs: -

SuperSnoop running
[ERROR   ] SRVE0777E: Exception thrown by application class 'SuperSnoop.getAppServerName:46'
java.lang.NoClassDefFoundError: com/ibm/websphere/management/AdminServiceFactory
        at SuperSnoop.getAppServerName(SuperSnoop.java:46)
        at SuperSnoop.doGet(SuperSnoop.java:160)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
        at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1255)
        at [internal classes]


This developerWorks Answer thread covered the specific issue - that of the AdminServiceFactory class not being available to me: -


The full profile AdminService API is not provided in the Liberty profile as it relates to an administration model that is not provided, nor compatible with the Liberty profile.

but also said this: -

Have you tried using the liberty migration tool (tech preview) to scan your application? If so this may be a package we are missing from the list. If you haven't tried it, there are more details on the tool here; you may find it useful: https://www.ibmdw.net/wasdev/2014/04/23/websphere-application-server-migration-toolkit-liberty-tech-preview/

Taking this good advice, I downloaded the Migration Toolkit for Application Binaries: -


and ran it: -

java -jar binaryAppScanner.jar SuperSnoopWeb.war

Processing the SuperSnoopWeb.war application.
Scanning files.........
The report was saved to the following file: /Users/davidhay/Downloads/wamt/SuperSnoopWeb.war_MigrationReport.html


The resulting HTML document said, in part: -


*BUT*




which is good intel.

So I'll continue to deploy it, in part to test my deployment practices, but won't expect it to do owt :-(

However, one of my blog correspondents, Jeremy Hughes from IBM, did rightly point out that there's a more recent Github project called Ferret: -

A sample servlet application which responds to HTTP requests with information about the request and server


which doesn't have the same drawback re unavailable APIs: -



etc.

and also runs happily on Liberty: -




No comments:

Visual Studio Code - Wow 🙀

Why did I not know that I can merely hit [cmd] [p]  to bring up a search box allowing me to search my project e.g. a repo cloned from GitHub...