简体   繁体   中英

Neo4j on aws instance with java Rest Binding

I have created an AWS EC2 instance running Neo4j(Community AMI) and i have connected to the end point successfully through the browser.now i want to access my db from java application through the Restbinding

    `RestAPI graphDB = new RestAPIFacade("EC2_ENDPOINT:7474/db/data/");
    QueryEngine engine=new RestCypherQueryEngine(graphDB); 

     QueryResult<Map<String,Object>> result = engine.query("start n=node(*) return count(n) as total", Collections.EMPTY_MAP); 

     Iterator<Map<String, Object>> iterator=result.iterator(); 

     if(iterator.hasNext()) { 

       Map<String,Object> row= iterator.next(); 

       System.out.print("Total nodes: " + row.get("total")); ` 

i have tested this code for localhost and got results but when i try this this Exception occurs!

 Exception in thread "main" java.lang.RuntimeException: Error reading as JSON '<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> <title>Error 404 Not Found</title> </head> <body><h2>HTTP ERROR 404</h2> <p>Problem accessing /db/data/cypher. Reason: <pre> Not Found</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/> <br/> <br/> <br/> <br/> <br/> <br/> 

can anyone help me here. Thank you

Can you access your database manually using http://EC2_ENDPOINT:7474/db/data/ ?

Did you open the port in the AWS security config. And did you configure your Neo4j server in conf/neo4j-server.properties to listen on the public interface?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM