Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to launch a jnlp file #45

Open
jsa34 opened this issue Jun 18, 2021 · 7 comments
Open

Unable to launch a jnlp file #45

jsa34 opened this issue Jun 18, 2021 · 7 comments

Comments

@jsa34
Copy link

jsa34 commented Jun 18, 2021

Issue: When trying to start a JNLP file (launching), I come across the following issue:


javax.jnlp.UnavailableServiceException: uninitialized
	at javax.jnlp.ServiceManager.lookup(Unknown Source)
	at oracle.apps.fnd.formsClient.jnlp.FndFormsEngine.<init>(FndFormsEngine.java:53)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at java.lang.Class.newInstance(Class.java:442)
	at netx.jnlp.Launcher.createApplet(Launcher.java:376)
	at netx.jnlp.Launcher.launchApplet(Launcher.java:337)
	at netx.jnlp.Launcher$TgThread.run(Launcher.java:468)

The JNLP is of type Oracle Forms: https://oracle-base.com/articles/11g/oracle-forms-11g-and-java-web-start
The JNLP file retrieved as a local file using:

SwingDriver.getSwingDriver("file:///C:/Users/test/Downloads/frmservlet.jnlp", true);

This then leads to...

java.lang.ExceptionInInitializerError
	at com.test.SwingExtensionServletTest.setUp(SwingExtensionServletTest.java:38)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.RunBefores.invokeMethod(RunBefores.java:33)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: com.axway.ats.uiengine.exceptions.ElementNotFoundException: Unable to find frame with title 'Oracle Forms'
	at com.axway.ats.uiengine.elements.swing.SwingElementLocator.getWindowFixture(SwingElementLocator.java:596)
	at com.axway.ats.uiengine.engine.SwingEngine.goToWindow(SwingEngine.java:475)
	at com.axway.ats.uiengine.SwingDriver.start(SwingDriver.java:144)
	at com.test.rmi.SwingApplication.<init>(SwingApplication.java:26)
	at com.test.extensions.node.SwingExtensionServlet.<clinit>(SwingExtensionServlet.java:24)
	... 28 more
Caused by: org.fest.swing.exception.WaitTimedOutError: Timed out waiting for component to be found using matcher com.axway.ats.uiengine.elements.swing.SwingElementLocator$6@68044f4
Unable to find component using matcher com.axway.ats.uiengine.elements.swing.SwingElementLocator$6@68044f4.

Component hierarchy:
java.awt.Frame[name='frame0', title='Oracle Forms - Applet', enabled=true, visible=true, showing=true]
  oracle.apps.fnd.formsClient.jnlp.FndFormsEngine[name='FndFormsEngine0']

	at org.fest.swing.timing.Pause.timeoutExpired(Pause.java:83)
	at org.fest.swing.timing.Pause.pause(Pause.java:75)
	at org.fest.swing.finder.ComponentFinderTemplate.findComponentWith(ComponentFinderTemplate.java:116)
	at org.fest.swing.finder.FrameFinder.using(FrameFinder.java:86)
	at com.axway.ats.uiengine.elements.swing.SwingElementLocator.getWindowFixture(SwingElementLocator.java:563)
	... 32 more


java.lang.NullPointerException
	at com.test.extensions.node.SwingExtensionServletTest.tearDown(SwingExtensionServletTest.java:45)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.RunAfters.invokeMethod(RunAfters.java:46)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)


@svilen-d
Copy link
Collaborator

Hello jsa34,

There are several exceptions pasted but most probably the cause is that you search for frame with title Oracle Forms:

Caused by: com.axway.ats.uiengine.exceptions.ElementNotFoundException: Unable to find frame with title 'Oracle Forms'
whereas later in the printed elements hierarchy it seems to be named differently (with '- Applet' at the end ):
Component hierarchy:
java.awt.Frame[name='frame0', title='Oracle Forms - Applet',

Note that ATS is using FEST-Swing library (org.fest.swing package, https://github.com/alexruiz/fest-swing-1.x) which is not recently updated. Also we have not tested with with applets so it might not be compatible.

Hope that helps!

@jsa34
Copy link
Author

jsa34 commented Jun 22, 2021

Yes - I could see this, however I have not set the expected window title - it seems to be self-derived when instantiating the SwingDriver

@svilen-d
Copy link
Collaborator

The windows title searched comes from the title defined in the JNLP file.
For more technical details you may check the source of com.axway.ats.uiengine.SwingDriver.start() method for example. There ATS uses netx-hunson library to parse and start the app defined in the JNLP file.

@jsa34
Copy link
Author

jsa34 commented Jun 28, 2021

Ah - Apologies, I really should have looked at the source... I was just going by the possible constructors, and it looks like it's just missing a constructor for setting the window title when setting the app type as JNLP.

I have done this by creating a custom class for instantiating the SwingDriver:

public CustomSwingDriver(String jnlpLocation, String windowTitle, boolean cacheEnabled ) {
    this.windowTitle = windowTitle;
    this.jnlpLocation = jnlpLocation;
    this.isJnlpCached = cacheEnabled;
}

But, when I try and use the inspector, it returns:

CustomSwingDriver cannot be cast to com.axway.ats.uiengine.internal.driver.SwingDriverInternal

@dslaveykov
Copy link
Contributor

Hello,
could you provide a little bit more of the stack-trace.

@jsa34
Copy link
Author

jsa34 commented Jun 28, 2021

That's all I have:

java.lang.ClassCastException: com.test.driver.CustomSwingDriver cannot be cast to com.axway.ats.uiengine.internal.driver.SwingDriverInternal
	at com.axway.ats.uiengine.engine.SwingEngine.useComponentInspector(SwingEngine.java:570)
	at com.test.DriverManager.createJavaDriver(DriverManager.java:96)

Custom constructor used:

package com.test.driver;

import com.axway.ats.uiengine.SwingDriver;

public class CustomSwingDriver extends SwingDriver {
    public CustomSwingDriver(String jnlpLocation, String windowTitle, boolean cacheEnabled) {
        super(jnlpLocation, cacheEnabled);
        this.windowTitle = windowTitle;
    }
}

Usage:

        String jnlpFileName = "test.jnlp";
        File jnlpFile = new File("C:\\Users\\Me\\Downloads\\" + jnlpFileName);

        String startWindowTitle = "Window Title";

        SwingDriver javaDriver = new CustomSwingDriver(jnlpFile.getAbsolutePath(), startWindowTitle, false);
        if (jnlpFile.exists()) {
            jnlpFile.delete();
        }
        SwingEngine swingEngine = javaDriver.getSwingEngine();
        swingEngine.useComponentInspector();


@jsa34
Copy link
Author

jsa34 commented Jun 28, 2021

I've raised a PR for the SwingDriver constructors that should resolve this (the ability to set the window title to something other than the default derived from the JNLP file)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants