-
Notifications
You must be signed in to change notification settings - Fork 167
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
java.util.concurrent.TimeoutException on all tests #121
Comments
Hi Andres! This issue is related to #64. I also heard Automaton has or had the same issue. We need to initialize the JavaFX Somehow this does not work under Mac OS X. Unfortunately I have no Apple machine and cannot debug this. |
Here is a SSCCE for this bug. Works fine on Windows 7 with Java 7 and Guava 14 for me. Maybe package org.testfx;
import java.util.concurrent.TimeUnit;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import com.google.common.util.concurrent.SettableFuture;
public class PrimaryStageRetriever {
public static SettableFuture<Stage> primaryStageFuture = SettableFuture.create();
public static class ToolkitApplication extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
primaryStage.initStyle(StageStyle.UNDECORATED);
primaryStageFuture.set(primaryStage);
}
}
public static void main(String[] args) throws Exception {
System.out.println("Launching Application in new Thread...");
new Thread(new Runnable() {
@Override
public void run() {
Application.launch(ToolkitApplication.class);
}
}).start();
System.out.println("Waiting for primary Stage...");
Stage stage = primaryStageFuture.get(10, TimeUnit.SECONDS);
System.out.println(stage);
// OUTPUT:
// Launching Application in new Thread...
// Waiting for primary Stage...
// javafx.stage.Stage@5a07e868
}
} |
I finally got my hands on a OSX machine and could reproduce the exception under JDK 1.7. It worked fine under JDK 1.8. Interestingly the SSCCE worked fine under JDK 1.7 and 1.8.
|
I've found out that JDK 7u60, 7u65, 8u05, 8u11 behave differently when JavaFX is involved. Apprently 7u60 and 8u05 are more stable than the newer versions. |
I've identified the cause. Just comment or uncomment the line In package org.testfx;
import java.awt.Robot;
import java.util.concurrent.TimeUnit;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import com.google.common.util.concurrent.SettableFuture;
public class PrimaryStageRetriever {
public static void main(String[] args) throws Exception {
createAwtRobot();
System.out.println("Launching Application in new Thread...");
launchApplicationInThread();
System.out.println("Waiting for primary Stage...");
Stage stage = retrievePrimaryStage();
System.out.println(stage);
}
public static Robot createAwtRobot() {
try {
return new Robot();
}
catch (Exception exception) {
exception.printStackTrace();
return null;
}
}
public static void launchApplicationInThread() {
new Thread(new Runnable() {
@Override
public void run() {
Application.launch(ToolkitApplication.class);
}
}).start();
}
public static Stage retrievePrimaryStage() throws Exception {
return primaryStageFuture.get(10, TimeUnit.SECONDS);
}
public static SettableFuture<Stage> primaryStageFuture = SettableFuture.create();
public static class ToolkitApplication extends Application {
@Override
public void start(Stage primaryStage) throws Exception {
primaryStage.initStyle(StageStyle.UNDECORATED);
primaryStageFuture.set(primaryStage);
}
}
} |
Weird. If I instanciate If I instanciate System.setProperty("java.awt.headless", "false");
java.awt.Robot robot = createAwtRobot();
System.out.println(robot); com.sun.glass.ui.Robot robot = com.sun.glass.ui.Application.GetApplication().createRobot();
System.out.println(robot); Also MouseInfo.getPointerInfo().getLocation();
GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
robot.createScreenCapture(new Rectangle(0, 0, 100, 100)); [1] http://stackoverflow.com/questions/13487025/headless-environment-error-in-java-awt-robot-class-with-mac-os |
There was a lenghty discussion on https://javafx-jira.kenai.com/browse/RT-20784. It seems that the only valid option is to move to Java 1.8.
|
I had some issues with |
I consistently get java.util.concurrent.TimeoutException when running any tests on my environment :-(
Fork is at 308a2fe
Environment is
Full stack trace is
The text was updated successfully, but these errors were encountered: