无法将WrappingNeoServerBootstrapper解析为某种类型

时间:2013-04-22 22:15:38

标签: neo4j

我在嵌入式Java中使用neo4j。

我想通过我拥有的应用程序启动进程内服务器管理实例。我现在无法在Eclipse中编译应用程序,因为它正在抨击它

“WrappingNeoServerBootstrapper无法解析为类型”。它无法解决下面的行

private WrappingNeoServerBootstrapper srv;

我很感激这方面的任何帮助。

请参阅下面的课程

import org.neo4j.graphalgo.GraphAlgoFactory;
import org.neo4j.graphalgo.PathFinder;
import org.neo4j.graphdb.DynamicRelationshipType;
import org.neo4j.graphdb.Expander;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Path;
import org.neo4j.kernel.Traversal;
import org.neo4j.server.plugins.Description;
import org.neo4j.server.plugins.Parameter;
import org.neo4j.server.plugins.PluginTarget;
import org.neo4j.server.plugins.ServerPlugin;
import org.neo4j.server.plugins.Source;
import org.neo4j.graphdb.factory.GraphDatabaseFactory;
import org.neo4j.graphdb.RelationshipType;      // interface
import org.neo4j.graphdb.Relationship;
import org.neo4j.graphdb.GraphDatabaseService;  // interface
import org.neo4j.graphdb.Transaction;
import org.neo4j.server.*;

public class DBFacade {

    private static enum RelTypes implements RelationshipType { KNOWS }

    private GraphDatabaseService graphDb;
    private WrappingNeoServerBootstrapper srv; 

    public void WriteNode(java.lang.String message)
    {
        Transaction tx = graphDb.beginTx(); 
        try
        {     
            // Updating operations go here     
            Node node = graphDb.createNode();
            node.setProperty( "message", message );
            tx.success();
        }
        finally
        {     
            tx.finish(); 
        }
    }

    public void WriteRelationship(Node firstNode, Node secondNode, RelTypes type)
    {
        Relationship relationship = firstNode.createRelationshipTo( secondNode, RelTypes.KNOWS ); 
        relationship.setProperty( "message", "brave Neo4j " ); 
    }

    public void CreateDB(java.lang.String path)
    {
        //newEmbeddedDatabase is an implemetation of GraphDatabaseService
        this.graphDb = new GraphDatabaseFactory().newEmbeddedDatabase( path ); 
    }

    public void Close()
    {
        graphDb.shutdown(); 
    }

    public void StartAdminInstance()
    {
        // start web admin in process
        srv = new WrappingNeoServerBootstrapper( this.graphDb ); 
        srv.start(); // The server is now running // 
        //until we stop it: 
        srv.stop(); 
    }

    public void StopAdminInstance()
    {
        srv.stop(); 
    }
}

1 个答案:

答案 0 :(得分:0)

您是否正在使用像Maven这样的依赖管理框架?您必须包含neo4j-server jar,其中包含该类。

您还需要将StartAdminInstance更新为WrappingNeoServerBootstrapper srv = new WrappingNeoServerBootstrapper((AbstractGraphDatabase) graphDb);