Getting started, java.lang.NoClassDefFoundError: com/google/common/util/concurrent/SettableFuture

3,125 views
Skip to first unread message

Richard Gorowsky

unread,
Apr 5, 2014, 4:25:48 PM4/5/14
to testfx-...@googlegroups.com


Hi I am trying to get testfx to work, but I am getting this error with this code:

java.lang.NoClassDefFoundError: com/google/common/util/concurrent/SettableFuture
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
    at java.lang.Class.getDeclaredMethods(Unknown Source)
    at org.junit.internal.MethodSorter.getDeclaredMethods(MethodSorter.java:54)
    at org.junit.runners.model.TestClass.<init>(TestClass.java:45)
    at org.junit.runners.ParentRunner.<init>(ParentRunner.java:75)
    at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:57)
    at org.junit.internal.builders.JUnit4Builder.runnerForClass(JUnit4Builder.java:10)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
    at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:26)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassNotFoundException: com.google.common.util.concurrent.SettableFuture
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 20 more



package test;

import java.io.IOException;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import org.junit.Test;
import org.loadui.testfx.GuiTest;

public class CreateTestCollectionFromJUnitTest extends GuiTest {

    @Override
    protected Parent getRootNode() {
        FXMLLoader fxmlLoader = new FXMLLoader(this.getClass().getClassLoader().getResource("view/View.fxml"));

        try {
            fxmlLoader.load();
        } catch (IOException e) {
            e.printStackTrace();
        }

        return fxmlLoader.getRoot();
    }
   
    @Test
    public void test() {
        System.out.println("here");
    }
}


I am using eclipse with the testFX-3.1.2.jar file in the build path.  I found the jar file at <http://search.maven.org/#artifactdetails|org.loadui|testFx|3.1.2|jar>, one of the posts here had mentioned this site.  The code itself is also basically a copy-paste of a post on this site.  Can someone point me in the right direction?

Richard Gorowsky

unread,
Apr 9, 2014, 6:24:55 PM4/9/14
to testfx-...@googlegroups.com
I found a fix to the previous problem by downloading the guava 16.0.1 jar at https://code.google.com/p/guava-libraries/

I have two new problems, changing the test to:
    @Test
    public void test() {
        moveBy(10, 10);
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        moveBy(10, 10);
    }

I get a console printout
 [TestFX] User mouse movement detected. Aborting test.

with a stacktrace:
java.lang.ThreadDeath
    at java.lang.Thread.stop(Unknown Source)
    at org.loadui.testfx.utils.UserInputDetector.userInputDetected(UserInputDetector.java:58)
    at org.loadui.testfx.utils.UserInputDetector.assertPointsAreEqual(UserInputDetector.java:42)
    at org.loadui.testfx.utils.UserInputDetector.run(UserInputDetector.java:27)
    at java.lang.Thread.run(Unknown Source)

I didn't move my mouse at all, the program moved it for me.





if my test method is
    @Test
    public void test() {
        GuiTest click = click(".namefield");
    }

I get the stacktrace:
java.lang.NoSuchMethodError: com.google.common.collect.Lists.reverse(Ljava/util/List;)Ljava/util/List;
    at org.loadui.testfx.GuiTest.getWindows(GuiTest.java:163)
    at org.loadui.testfx.GuiTest.findAllRecursively(GuiTest.java:276)
    at org.loadui.testfx.GuiTest.findAll(GuiTest.java:249)
    at org.loadui.testfx.GuiTest.findByCssSelector(GuiTest.java:432)
    at org.loadui.testfx.GuiTest.find(GuiTest.java:300)
    at org.loadui.testfx.GuiTest.pointFor(GuiTest.java:1191)
    at org.loadui.testfx.GuiTest.move(GuiTest.java:854)
    at org.loadui.testfx.GuiTest.click(GuiTest.java:628)
    at test.CreateTestCollectionFromJUnitTest.test(CreateTestCollectionFromJUnitTest.java:44)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

I am not sure if "namefield" shoud have a '.' or not, but both variations give the same stack trace error.  Can someone help?



Nikhil Patil

unread,
Oct 29, 2014, 4:58:24 AM10/29/14
to testfx-...@googlegroups.com
Hi
Im facing the same problem as u. Can anyone plz help.

Benjamin Gudehus

unread,
Oct 29, 2014, 5:25:22 AM10/29/14
to testfx-...@googlegroups.com
Hi Nikhil Patil,

Please try to downgrade to TestFX 3.1.0 [1]. The feature causing the ThreadDeath wasn't implemented in this version.


Regards,
Benjamin

Nikhil Patil

unread,
Oct 29, 2014, 5:37:20 AM10/29/14
to testfx-...@googlegroups.com
I tried it but still getting the same problem.
Java.lang.NoSuchMethodError: com.google.common.collect.Lists.reverse(Ljava/util/List)

Benjamin Gudehus

unread,
Oct 29, 2014, 5:50:53 AM10/29/14
to Nikhil Patil, testfx-...@googlegroups.com
The pom.xml states, that you need Google Guava 14.0.1 and some other dependency jars:


You can download the dependency jars here:


--Benjamin

On Wed, Oct 29, 2014 at 10:37 AM, Nikhil Patil <nikhilpa...@gmail.com> wrote:
I tried it but still getting the same problem.
Java.lang.NoSuchMethodError: com.google.common.collect.Lists.reverse(Ljava/util/List)

--
You received this message because you are subscribed to the Google Groups "TestFX" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testfx-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages