我无法使用neo4j-java-driver版本Maven版本1.0.5连接到Neo4j VERSION 2.2.5
以下是我的代码
Exception in thread "main" org.neo4j.driver.v1.exceptions.ClientException: Unable to connect to 'localhost' on port 7687, ensure the database is running and that there is a working network connection to it.
但我得到了这个错误。
org.neo4j.server.webserver.address=0.0.0.0
我是否需要在neo4j-server.properties文件中编辑某些内容?因为我使用默认值。除了我编辑了行
package olympicrings;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Arc;
/**
* This helper class knows how to paint the next olympic ring into a {@code Pane}.
* It is not limited to 5 olympic rings, it can draw as many (or few) as desired.
* The algorithm it follows is:
* <ol>
* <li>Each ring consists of 2 arcs (half-circles) of the same color, of course.
* Imagine the line connecting the center of the previous ring to the center
* of the current: we place one arc on the LEFT of this line and one arc on
* the RIGHT. Let's call them arcs L and R. These need to be added to the
* children {@code Node}s of the {@code Pane} at the correct order.</li>
* <li>The placement of arc L depends on whether the current ring is at the top
* row or at the bottom:
* <ul>
* <li>TOP: It goes below arc L of the previous ring</li>
* <li>BOTTOM: It goes below arc R of the previous ring</li>
* </ul>
* </li>
* <li>Arc R is always placed last in the list of the children of the {@code Pane}.</li>
* <li>Advance the position of the next ring, taking into account the desired
* ring radius and stroke width.</li>
* </ol>
* <p>
* Usage:
* <pre><code>
* OlympicRingsPaintingContext ctx = new OlympicRingsPaintingContext(thePane, 50, 10);
* ctx.paintNextRing(Color.BLUE);
* ...
* </code></pre>
*/
public class OlympicRingsPaintingContext {
/**
* A handy constant containing the standard olympic colors. Could be used as follows
* to paint the standard olympic rings:
* <pre><code>
* OlympicRingsPaintingContext ctx = new OlympicRingsPaintingContext(thePane, 50, 10);
* OlympicRingsPaintingContext.STANDARD_OLYMPIC_COLORS.forEach(ctx::paintNextRing);
* </code></pre>
*/
public static final List<Color> STANDARD_OLYMPIC_COLORS = Collections.unmodifiableList(Arrays.asList(Color.BLUE, Color.YELLOW, Color.BLACK, Color.GREEN, Color.RED));
private static final double[] TOP_START_ANGLES = new double[] {45, 225};
private static final double[] BOTTOM_START_ANGLES = new double[] {315, 135};
private Pane pane;
private double radius;
private double strokeWidth;
private double curx;
private double cury;
private double topy;
private double bottomy;
private double startAngleL;
private double startAngleR;
private int prevIndexL;
private int prevIndexR;
public OlympicRingsPaintingContext(Pane pane, double radius, double strokeWidth) {
this.pane = pane;
this.radius = radius;
this.strokeWidth = strokeWidth;
topy = 2*radius;
bottomy = 3*radius;
curx = 2*radius;
cury = topy;
startAngleL = TOP_START_ANGLES[0];
startAngleR = TOP_START_ANGLES[1];
prevIndexL = 0;
prevIndexR = 0;
}
public void paintNextRing(Color color) {
addArcL(color);
addArcR(color);
advance();
}
private void addArcL(Color color) {
Arc arcL = makeArc(startAngleL, color);
if( cury == topy ) {
pane.getChildren().add(prevIndexL, arcL);
}
else {
pane.getChildren().add(prevIndexR, arcL);
prevIndexL = prevIndexR;
}
}
private void addArcR(Color color) {
Arc arcR = makeArc(startAngleR, color);
pane.getChildren().add(arcR);
prevIndexR = pane.getChildren().size() - 1;
}
private Arc makeArc(double startAngle, Color color) {
Arc arc = new Arc(curx, cury, radius, radius, startAngle, 180);
arc.setFill(null);
arc.setStroke(color);
arc.setStrokeWidth(strokeWidth);
return arc;
}
private void advance() {
curx += radius + strokeWidth;
if( cury == topy ) {
cury = bottomy;
startAngleL = BOTTOM_START_ANGLES[0];
startAngleR = BOTTOM_START_ANGLES[1];
}
else {
cury = topy;
startAngleL = TOP_START_ANGLES[0];
startAngleR = TOP_START_ANGLES[1];
}
}
}