WebSphere Application Server & Liberty

WebSphere Application Server & Liberty

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Liberty Application Client and GUI

    Posted 27 days ago
    Hello All,

    Is it possible to run a Java standalone application with some sort of GUI (i.e. Swing, AWT) inside a Liberty Application Client? I am successful in running non-GUI Java standalone applications inside Liberty Application Clients that send requests and receive responses from Liberty servers.  In this context, Java standalone applications are those with a main().

    I tried running one of these GUI based Java standalone applications deployed to a Liberty Application Client and got the following (expected) exception:

    ------Start of DE processing------ = [4/22/25, 13:58:45:489 CDT]
    Exception = java.lang.reflect.InvocationTargetException
    Source = com.ibm.ws.clientcontainer.internal.ClientRunnerImpl
    probeid = 99
    Stack Dump = java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at com.ibm.ws.clientcontainer.internal.ClientRunnerImpl.run(ClientRunnerImpl.java:97)
        at com.ibm.ws.kernel.launch.internal.FrameworkManager.launchClient(FrameworkManager.java:407)
        at com.ibm.ws.kernel.launch.internal.FrameworkManager.launchFramework(FrameworkManager.java:336)
        at com.ibm.ws.kernel.launch.internal.LauncherDelegateImpl.doFrameworkLaunch(LauncherDelegateImpl.java:116)
        at com.ibm.ws.kernel.launch.internal.LauncherDelegateImpl.launchFramework(LauncherDelegateImpl.java:102)
        at com.ibm.ws.kernel.boot.internal.KernelBootstrap.go(KernelBootstrap.java:215)
        at com.ibm.ws.appclient.boot.ClientLauncher.handleActions(ClientLauncher.java:66)
        at com.ibm.ws.kernel.boot.Launcher.createPlatform(Launcher.java:119)
        at com.ibm.ws.kernel.boot.cmdline.EnvCheck.main(EnvCheck.java:61)
        at com.ibm.ws.appclient.boot.cmdline.ClientEnvCheck.main(ClientEnvCheck.java:28)
    Caused by: java.awt.HeadlessException
        at java.desktop/java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:208)
        at java.desktop/java.awt.Window.<init>(Window.java:548)
        at java.desktop/java.awt.Frame.<init>(Frame.java:423)
        at java.desktop/javax.swing.JFrame.<init>(JFrame.java:224)
        at AppTestUI.<init>(AppTestUI.java:85)
        at TcrjAppTest.main(TcrjAppTest.java:7)
        ... 14 more

    As I said previously I sort of expected something bad to happen, however I am just wondering if there is way to circumvent this error so I thought I'd ask the experts out there. Thanks in advance for your thoughts.



    ------------------------------
    Octavio Echevarria
    ------------------------------


  • 2.  RE: Liberty Application Client and GUI

    Posted 27 days ago

    I thought I replied to the thread, but I guess I replied directly to Octavio, but here is what I said:

    The client runtime by default has -Djava.awt.headless=true set.  You should be able to add -Djava.awt.headless=false to your client.jvm.options file for your application client so that it is false.



    ------------------------------
    Jared Anderson
    ------------------------------



  • 3.  RE: Liberty Application Client and GUI

    Posted 25 days ago

    Jared's suggestion about using the JVM option worked. Strangely enough, the application starts (and displays the GUI), but within a few seconds it closes on its own. Not sure what is going on. So now I'm investigating further to see what is happening. Thanks 



    ------------------------------
    Octavio Echevarria
    ------------------------------



  • 4.  RE: Liberty Application Client and GUI

    Posted 24 days ago

    As a follow up to my last posting, if I need to trace the Application Client runtime itself, does anyone know what the traceSpecification attribute string of the logging element in the client.xml file should look like?

    For example:

    <logging consoleFormat="TBASIC" messageFormat="TBASIC"

    stackTraceSingleEntry="false" traceFormat="ADVANCED"

    traceSpecification="*=info:com.ibm.XYZ.*=fine" />



    ------------------------------
    Octavio Echevarria
    ------------------------------



  • 5.  RE: Liberty Application Client and GUI

    Posted 19 days ago

    Yes, you configure the trace in client.xml just like you would on server.xml.



    ------------------------------
    Jared Anderson
    ------------------------------



  • 6.  RE: Liberty Application Client and GUI

    Posted 19 days ago

    What does your main() method look like?  Will it end up exiting and as such cause the client to end or does it have a condition to keep the main method from exiting?



    ------------------------------
    Jared Anderson
    ------------------------------