Simple Test Startup Fails

6 views
Skip to first unread message

Matthew Holtzman

unread,
Jun 13, 2016, 4:25:32 AM6/13/16
to Neo4j
I'm attempting to get up and running and am putting together simple unit tests as I go, but I'm running into an exception right out of the gate when running this simple test as per the Java developer reference:

    @Test
    public void initNeo4J() {
        graphDb = new TestGraphDatabaseFactory().newImpermanentDatabase();
    }

I've included the dependencies mentioned in the documentation, but I'm seeing a runtime exception with this root cause:
 
 Caused by: java.lang.NoClassDefFoundError: com/google/inject/Injector

When I add Guava to the classpath, everything seems to work. Is this a necessary (and undocumented) step, or am I just missing something?

Here is what's on my classpath now:

<dependency>
      <groupId>org.neo4j</groupId>
      <artifactId>neo4j</artifactId>
      <version>3.0.0</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.neo4j</groupId>
      <artifactId>neo4j-kernel</artifactId>
      <version>3.0.0</version>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.neo4j</groupId>
      <artifactId>neo4j-io</artifactId>
      <version>3.0.0</version>
      <type>test-jar</type>
      <scope>test</scope>
  </dependency>

thanks,
Matt

Chris Vest

unread,
Jun 13, 2016, 10:35:06 AM6/13/16
to ne...@googlegroups.com
We have a test dependency on jimfs, which has a dependency on guava. And Maven doesn’t resolve transitive test dependencies for some reason.
So I guess this is an omission in the documentation.

--
Chris Vest
System Engineer, Neo Technology
[ skype: mr.chrisvest, twitter: chvest ]


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

Reply all
Reply to author
Forward
0 new messages