3

I have a collection named docCollection and I want to perform a normal AQL query on for example:

FOR id IN docCollection FILTER id.center == "Germany" RETURN id

I have tried to use the example as stated here:

https://github.com/arangodb/docs/blob/2f0a96c23630719e09f1b7af6aaf106c44332555/drivers/java-examples-xml-data.md

But it didn't worked for me and it showed me

Exception in thread "main" java.lang.NullPointerException

5
  • Can you locate the stack trace where in the source this occured? Commented Mar 8, 2016 at 16:39
  • CursorResult<BaseDocument> rs = driver.executeAqlQuery(query, null, null, BaseDocument.class); -- here Commented Mar 9, 2016 at 11:27
  • you did see that the example you pasted uses executeAqlQueryRaw and not executeAqlQuery? Commented Mar 9, 2016 at 11:40
  • whats the difference ? Commented Mar 9, 2016 at 18:33
  • And also I have tried both ways Commented Mar 9, 2016 at 20:00

1 Answer 1

5

Normally you have to use driver.executeDocumentQuery(...) for document queries.

To illustrate the differences between driver.executeDocumentQuery(...) and driver.executeAqlQuery(...) I added an example.

Download the ArangoDB java driver on github and compile it with maven:

mvn clean install -DskipTests=true -Dgpg.skip=true -Dmaven.javadoc.skip=true -B

Maven creates the standalone driver JAR file (arangodb-java-driver-X.X.X-SNAPSHOT-standalone.jar) containing all dependencies in the target directory.

Fetch the example code:

 wget https://gist.githubusercontent.com/anonymous/bd68b523647548e5fb36d27c29561cfe/raw/f2922d431b9f1e5a3f3239e9024cf342536f55f7/AqlExample.java

Compile the example code:

 javac -classpath arangodb-java-driver-X.X.X-SNAPSHOT-standalone.jar AqlExample.java

Start the ArangoDB without authentication on the default port and run the example code:

 java -classpath arangodb-java-driver-X.X.X-SNAPSHOT-standalone.jar:. AqlExample
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.