Friday 27 January 2017

WebSphere Liberty Profile on macOS - SuperSnooping

So I've run this on Liberty multiple times, including most recently on my Mac, natively.

This is what I have: -

Check Liberty Version

~/Downloads/wlp/bin/server version

objc[43120]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/bin/java (0x10761e4c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x1077184e0). One of the two will be used. Which one is undefined.
WebSphere Application Server 16.0.0.2 (1.0.13.cl160220160526-2258) on Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_112-b16 (en_GB)


Check server.xml

cat ~/Downloads/wlp/usr/servers/defaultServer/server.xml

<server description="new server">

    <!-- Enable features -->
    <featureManager>
        <feature>webProfile-7.0</feature>
        <feature>adminCenter-1.0</feature>
        <feature>localConnector-1.0</feature>
    </featureManager>

    <classloading useJarUrls="true"/>

    <quickStartSecurity userName="admin" userPassword="{xor}Lz4sLCgwLTs="/>

    <keyStore id="defaultKeyStore" password="{xor}EzY9Oi0rJg=="/>

    <!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
    <httpEndpoint httpPort="9080" httpsPort="9443" id="defaultHttpEndpoint"/>
                  
    <!-- Automatically expand WAR files and EAR files -->
    <applicationManager autoExpand="true"/>

    <remoteFileAccess>
        <writeDir>${server.config.dir}</writeDir>
    </remoteFileAccess>


    <applicationMonitor updateTrigger="mbean"/>

Check Dropins

ls -al ~/Downloads/wlp/usr/servers/defaultServer/dropins/

total 24
drwxr-x---   3 davidhay  staff    102 27 Jan 18:10 .
drwxr-x---  10 davidhay  staff    340  1 Sep 10:02 ..
-rw-------   1 davidhay  staff  11486  9 Aug  2004 SuperSnoopWeb.war


Start Liberty

~/Downloads/wlp/bin/server start

Watch the logs

tail -f ~/Downloads/wlp/usr/servers/defaultServer/logs/messages.log 

product = WebSphere Application Server 16.0.0.2 (wlp-1.0.13.cl160220160526-2258)
wlp.install.dir = /Users/davidhay/Downloads/wlp/
java.home = /Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/jre
java.version = 1.8.0_112
java.runtime = Java(TM) SE Runtime Environment (1.8.0_112-b16)
os = Mac OS X (10.12.3; x86_64) (en_GB)
process = 42629@Davids-MacBook-Pro-4.local

...
[27/01/17 18:10:59:702 GMT] 00000026 com.ibm.ws.webcontainer.osgi.webapp.WebGroup                 I SRVE0169I: Loading Web Module: SuperSnoopWeb.
[27/01/17 18:10:59:702 GMT] 00000026 com.ibm.ws.webcontainer                                      I SRVE0250I: Web Module SuperSnoopWeb has been bound to default_host.
[27/01/17 18:10:59:702 GMT] 00000026 com.ibm.ws.http.internal.VirtualHostImpl                     A CWWKT0016I: Web application available (default_host): http://localhost:9080/SuperSnoopWeb/
[27/01/17 18:10:59:704 GMT] 00000026 com.ibm.ws.app.manager.AppMessageHelper                      A CWWKZ0001I: Application SuperSnoopWeb started in 0.423 seconds.

...
[27/01/17 18:10:59:712 GMT] 00000019 com.ibm.ws.kernel.feature.internal.FeatureManager            A CWWKF0011I: The server defaultServer is ready to run a smarter planet.

Test SuperSnoop

http://localhost:9080/SuperSnoopWeb/SuperSnoop

Watch the logs

tail -f ~/Downloads/wlp/usr/servers/defaultServer/logs/messages.log 

...
[27/01/17 18:12:05:806 GMT] 00000039 com.ibm.ws.session.WASSessionCore                            I SESN0176I: A new session context will be created for application key default_host/SuperSnoopWeb
[27/01/17 18:12:05:816 GMT] 00000039 com.ibm.ws.util                                              I SESN0172I: The session manager is using the Java default SecureRandom implementation for session ID generation.
[27/01/17 18:12:05:827 GMT] 00000039 com.ibm.ws.jsp                                               I JSPG8502I: The value of the JSP attribute jdkSourceLevel is "15".
[27/01/17 18:12:05:916 GMT] 00000039 com.ibm.ws.cache.CacheServiceImpl                            I DYNA1056I: Dynamic Cache (object cache) initialized successfully.
[27/01/17 18:12:06:055 GMT] 00000039 com.ibm.ws.webcontainer.servlet                              I SRVE0242I: [SuperSnoopWeb] [/SuperSnoopWeb] [SuperSnoop]: Initialization successful.
[27/01/17 18:12:06:056 GMT] 00000039 SystemOut                                                    O SuperSnoop running

...

I also downloaded the latest WLP: -

-rw-r--r--@  1 davidhay  staff  69984067 27 Jan 18:21 wlp-webProfile7-16.0.0.4.zip

...
WebSphere Application Server 16.0.0.4 (1.0.15.cl160420161113-0206) on Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_112-b16 (en_GB)
...

from here: -

Get started with Liberty

and again SuperSnoopServlet worked without problems, with a default server.xml : -

<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">

    <!-- Enable features -->
    <featureManager>
        <feature>webProfile-7.0</feature>
    </featureManager>

    <!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
    <httpEndpoint id="defaultHttpEndpoint"
                  httpPort="9080"
                  httpsPort="9443" />
                  
    <!-- Automatically expand WAR files and EAR files -->
    <applicationManager autoExpand="true"/>

Fun, fun, fun

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...