Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7775437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:37:54+00:00 2026-06-01T17:37:54+00:00

I have copied and pasted a simple neo4j example from the tutorial section but

  • 0

I have copied and pasted a simple neo4j example from the tutorial section but currently i got the messages:

[INFO] Surefire report directory: /home/kama/ws-git/neo4jexample/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running TestSuite
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNGMapConfigurator@17bd6a1
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 2.995 sec <<< FAILURE!

Results :

Failed tests:   firstTest(com.soebes.tutorials.Neo4JAppTest): com/soebes/tutorials/neo4jexample/RelationTypes

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0

The detailed error message:

java.lang.NoClassDefFoundError: com/soebes/tutorials/neo4jexample/RelationTypes
    at com.soebes.tutorials.neo4jexample.Neo4JApp.createDb(Neo4JApp.java:44)
    at com.soebes.tutorials.neo4jexample.Neo4JApp.main(Neo4JApp.java:25)
    at com.soebes.tutorials.Neo4JAppTest.firstTest(Neo4JAppTest.java:14)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:691)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:883)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1208)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
    at org.testng.TestRunner.privateRun(TestRunner.java:758)
    at org.testng.TestRunner.run(TestRunner.java:613)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
    at org.testng.SuiteRunner.run(SuiteRunner.java:240)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:87)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1137)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1062)
    at org.testng.TestNG.run(TestNG.java:974)
    at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:76)
    at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:161)
    at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:101)
    at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:115)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:103)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74)
Caused by: java.lang.ClassNotFoundException: com.soebes.tutorials.neo4jexample.RelationTypes
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

The source code of this looks like this:

public class Neo4JApp {

    private String greeting;

    private GraphDatabaseService graphDb;
    private Node firstNode;
    private Node secondNode;
    private Relationship relationship;

    public static void main(final String[] args) {
    Neo4JApp hello = new Neo4JApp();
    hello.createDb(args[0]);
    hello.removeData();
    hello.shutDown();
    }

    void createDb(String path) {
    clearDb(path);

    graphDb = new EmbeddedGraphDatabase(path);
    registerShutdownHook(graphDb);

    Transaction tx = graphDb.beginTx();
    try {

        firstNode = graphDb.createNode();
        firstNode.setProperty("message", "Hello, ");
        secondNode = graphDb.createNode();
        secondNode.setProperty("message", "World!");

        relationship = firstNode.createRelationshipTo(secondNode, RelationTypes.KNOWS);
        relationship.setProperty("message", "brave Neo4j ");

        System.out.print(firstNode.getProperty("message"));
        System.out.print(relationship.getProperty("message"));
        System.out.print(secondNode.getProperty("message"));

        greeting = ((String) firstNode.getProperty("message"))
            + ((String) relationship.getProperty("message"))
            + ((String) secondNode.getProperty("message"));

        tx.success();
    } finally {
        tx.finish();
    }
    }

    private void clearDb(String path) {
    try {
        FileUtils.deleteRecursively(new File(path));
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    }

    void removeData() {
    Transaction tx = graphDb.beginTx();
    try {
        firstNode.getSingleRelationship(RelationTypes.KNOWS, Direction.OUTGOING).delete();
        firstNode.delete();
        secondNode.delete();

        tx.success();
    } finally {
        tx.finish();
    }
    }

    void shutDown() {
    System.out.println();
    System.out.println("Shutting down database ...");
    graphDb.shutdown();
    }

    private static void registerShutdownHook(final GraphDatabaseService graphDb) {
    // Registers a shutdown hook for the Neo4j instance so that it
    // shuts down nicely when the VM exits (even if you "Ctrl-C" the
    // running example before it's completed)
    Runtime.getRuntime().addShutdownHook(new Thread() {
        @Override
        public void run() {
        graphDb.shutdown();
        }
    });
    }

And the used class RelationTypes looks like this:

public enum RelationTypes implements RelationshipType {
    KNOWS, 
    WHOKNOWS,
}

The project can be found at github.

Currently i don’t see the problem?…The RelationTypes are defined in the correct location…May be someone has a hint for me?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:37:55+00:00Added an answer on June 1, 2026 at 5:37 pm

    The problem was the directory of the unit test which is not allowed to be the target folder itself. It must be a separate folder under target.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following bash code, which is copied and pasted from bash cookbook
I have two pages - a simple HTML code example page from a jQuery
I have copied some files from project A to project B, both of which
I have copied zipped file from the playframework.org website and unzipped it at a
I have copied a project from my old XP machine to my new Win7
I am following the django tutorial here . I have copied everything exactly. After
I have a simple jquery script that copies a text from a html element
I have some 3rd party libraries and includes (I have copied them to the
I have an sqlite database called 'ProductDatabase.sql', which I have copied into my applications
I am processing some CSV file which i have copied in Bin folder of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.