测试 java-demo 报错

您好!
一: 环境说明:
1:个人本地搭建是nebula 2.5版本,服务并且正常启动。
2:Nebula-Studio 连接nebula 2.5正常,登录时HOST:192.168.43.133:9669,用户名:root 密码:hadoop 能正常登录。

二:下载官网DEMO并且测试。
1:将修改application.properties


nebula.hosts=192.168.43.133:9669
nebula.spaceName=mock_space
nebula.user=root
nebula.password=hadoop
nebula.executeTimeout=60000
nebula.poolInitNum=5
nebula.poolMaxNum=100


2:启动SPRINBOOT服务正常,控制台无报错
D:\nebulawork\nebula2-demo-main\src\main\java\myproject\dropping\nebulausage\AppMain.java

3:测试 官网DEMO报错,不知道什么原因,请说明下需要调整什么?

并且修改连接代码:
private static NebulaConfig getNebulaConfig() {
NebulaConfig nebulaConfig = new NebulaConfig();
nebulaConfig.setHosts(“192.168.43.133:9669”);
nebulaConfig.setSpaceName(“mock_space”);
nebulaConfig.setUser(“root”);
nebulaConfig.setPassword(“hadoop”);
nebulaConfig.setExecuteTimeout(3600 * 1000);
nebulaConfig.setPoolInitNum(5);
nebulaConfig.setPoolMaxNum(100);
return nebulaConfig;
}

run NebulaServiceMainTest.java 报错内容显示,

C:\java\jdk1.8.0_221\bin\java -Didea.launcher.port=7538 "-Didea.launcher.bin.path=D:\gongzuo\idea16.3\IntelliJ IDEA 2016.1.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\java\jdk1.8.0_221\jre\lib\charsets.jar;C:\java\jdk1.8.0_221\jre\lib\deploy.jar;C:\java\jdk1.8.0_221\jre\lib\ext\access-bridge-64.jar;C:\java\jdk1.8.0_221\jre\lib\ext\cldrdata.jar;C:\java\jdk1.8.0_221\jre\lib\ext\dnsns.jar;C:\java\jdk1.8.0_221\jre\lib\ext\jaccess.jar;C:\java\jdk1.8.0_221\jre\lib\ext\jfxrt.jar;C:\java\jdk1.8.0_221\jre\lib\ext\localedata.jar;C:\java\jdk1.8.0_221\jre\lib\ext\nashorn.jar;C:\java\jdk1.8.0_221\jre\lib\ext\sunec.jar;C:\java\jdk1.8.0_221\jre\lib\ext\sunjce_provider.jar;C:\java\jdk1.8.0_221\jre\lib\ext\sunmscapi.jar;C:\java\jdk1.8.0_221\jre\lib\ext\sunpkcs11.jar;C:\java\jdk1.8.0_221\jre\lib\ext\zipfs.jar;C:\java\jdk1.8.0_221\jre\lib\javaws.jar;C:\java\jdk1.8.0_221\jre\lib\jce.jar;C:\java\jdk1.8.0_221\jre\lib\jfr.jar;C:\java\jdk1.8.0_221\jre\lib\jfxswt.jar;C:\java\jdk1.8.0_221\jre\lib\jsse.jar;C:\java\jdk1.8.0_221\jre\lib\management-agent.jar;C:\java\jdk1.8.0_221\jre\lib\plugin.jar;C:\java\jdk1.8.0_221\jre\lib\resources.jar;C:\java\jdk1.8.0_221\jre\lib\rt.jar;D:\nebulawork\nebula2-demo-main\target\test-classes;D:\nebulawork\nebula2-demo-main\target\classes;D:\gongzuo\repository\org\springframework\boot\spring-boot-starter-web\2.0.0.RELEASE\spring-boot-starter-web-2.0.0.RELEASE.jar;D:\gongzuo\repository\org\springframework\boot\spring-boot-starter\2.0.0.RELEASE\spring-boot-starter-2.0.0.RELEASE.jar;D:\gongzuo\repository\org\springframework\boot\spring-boot\2.0.0.RELEASE\spring-boot-2.0.0.RELEASE.jar;D:\gongzuo\repository\org\springframework\spring-core\5.0.4.RELEASE\spring-core-5.0.4.RELEASE.jar;D:\gongzuo\repository\org\springframework\spring-context\5.0.4.RELEASE\spring-context-5.0.4.RELEASE.jar;D:\gongzuo\repository\org\springframework\boot\spring-boot-autoconfigure\2.0.0.RELEASE\spring-boot-autoconfigure-2.0.0.RELEASE.jar;D:\gongzuo\repository\org\springframework\boot\spring-boot-starter-logging\2.0.0.RELEASE\spring-boot-starter-logging-2.0.0.RELEASE.jar;D:\gongzuo\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;D:\gongzuo\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;D:\gongzuo\repository\org\slf4j\slf4j-api\1.7.26\slf4j-api-1.7.26.jar;D:\gongzuo\repository\org\apache\logging\log4j\log4j-to-slf4j\2.10.0\log4j-to-slf4j-2.10.0.jar;D:\gongzuo\repository\org\apache\logging\log4j\log4j-api\2.10.0\log4j-api-2.10.0.jar;D:\gongzuo\repository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;D:\gongzuo\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;D:\gongzuo\repository\org\springframework\spring-jcl\5.0.4.RELEASE\spring-jcl-5.0.4.RELEASE.jar;D:\gongzuo\repository\org\yaml\snakeyaml\1.19\snakeyaml-1.19.jar;D:\gongzuo\repository\org\springframework\boot\spring-boot-starter-json\2.0.0.RELEASE\spring-boot-starter-json-2.0.0.RELEASE.jar;D:\gongzuo\repository\org\springframework\spring-web\5.0.4.RELEASE\spring-web-5.0.4.RELEASE.jar;D:\gongzuo\repository\com\fasterxml\jackson\core\jackson-databind\2.9.4\jackson-databind-2.9.4.jar;D:\gongzuo\repository\com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations-2.9.0.jar;D:\gongzuo\repository\com\fasterxml\jackson\core\jackson-core\2.9.4\jackson-core-2.9.4.jar;D:\gongzuo\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.4\jackson-datatype-jdk8-2.9.4.jar;D:\gongzuo\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.4\jackson-datatype-jsr310-2.9.4.jar;D:\gongzuo\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.9.4\jackson-module-parameter-names-2.9.4.jar;D:\gongzuo\repository\org\springframework\boot\spring-boot-starter-tomcat\2.0.0.RELEASE\spring-boot-starter-tomcat-2.0.0.RELEASE.jar;D:\gongzuo\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.28\tomcat-embed-core-8.5.28.jar;D:\gongzuo\repository\org\apache\tomcat\embed\tomcat-embed-el\8.5.28\tomcat-embed-el-8.5.28.jar;D:\gongzuo\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.28\tomcat-embed-websocket-8.5.28.jar;D:\gongzuo\repository\org\hibernate\validator\hibernate-validator\6.0.7.Final\hibernate-validator-6.0.7.Final.jar;D:\gongzuo\repository\javax\validation\validation-api\2.0.1.Final\validation-api-2.0.1.Final.jar;D:\gongzuo\repository\org\jboss\logging\jboss-logging\3.3.0.Final\jboss-logging-3.3.0.Final.jar;D:\gongzuo\repository\com\fasterxml\classmate\1.3.1\classmate-1.3.1.jar;D:\gongzuo\repository\org\springframework\spring-beans\5.0.4.RELEASE\spring-beans-5.0.4.RELEASE.jar;D:\gongzuo\repository\org\springframework\spring-webmvc\5.0.4.RELEASE\spring-webmvc-5.0.4.RELEASE.jar;D:\gongzuo\repository\org\springframework\spring-aop\5.0.4.RELEASE\spring-aop-5.0.4.RELEASE.jar;D:\gongzuo\repository\org\springframework\spring-expression\5.0.4.RELEASE\spring-expression-5.0.4.RELEASE.jar;D:\gongzuo\repository\org\projectlombok\lombok\1.18.4\lombok-1.18.4.jar;D:\gongzuo\repository\com\vesoft\client\2.0.0\client-2.0.0.jar;D:\gongzuo\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;D:\gongzuo\repository\org\apache\commons\commons-lang3\3.8\commons-lang3-3.8.jar;D:\gongzuo\repository\org\slf4j\slf4j-log4j12\1.7.25\slf4j-log4j12-1.7.25.jar;D:\gongzuo\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar;D:\gongzuo\repository\com\google\guava\guava\14.0\guava-14.0.jar;D:\gongzuo\repository\commons-codec\commons-codec\1.13\commons-codec-1.13.jar;D:\gongzuo\repository\org\apache\commons\commons-pool2\2.2\commons-pool2-2.2.jar;D:\gongzuo\repository\com\alibaba\fastjson\1.2.70\fastjson-1.2.70.jar;D:\gongzuo\repository\org\mockito\mockito-core\2.8.47\mockito-core-2.8.47.jar;D:\gongzuo\repository\net\bytebuddy\byte-buddy\1.6.14\byte-buddy-1.6.14.jar;D:\gongzuo\repository\net\bytebuddy\byte-buddy-agent\1.6.14\byte-buddy-agent-1.6.14.jar;D:\gongzuo\repository\org\objenesis\objenesis\2.5\objenesis-2.5.jar;D:\gongzuo\repository\junit\junit\4.8.2\junit-4.8.2.jar;D:\gongzuo\idea16.3\IntelliJ IDEA 2016.1.3\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain myproject.dropping.nebulausage.test.NebulaServiceMainTest
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/gongzuo/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/gongzuo/repository/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
-------删除图谱空间-----------
11:18:17.449 [main] INFO myproject.dropping.nebulausage.service.impl.NebulaServiceImpl - 执行子句: 图谱:null, 子句:drop space if exists mock_space
11:18:17.664 [main] INFO myproject.dropping.nebulausage.service.impl.NebulaServiceImpl - 初始化连接池:192.168.43.133:9669
11:18:17.689 [main] INFO com.vesoft.nebula.client.graph.net.NebulaPool - Get connection to 192.168.43.133:9669
11:18:17.693 [main] ERROR myproject.dropping.nebulausage.service.impl.NebulaServiceImpl - 执行异常!
com.vesoft.nebula.client.graph.exception.AuthFailedException: Auth failed: Authenticate failed: Expected protocol id ffffff82 but got 0
	at com.vesoft.nebula.client.graph.net.SyncConnection.authenticate(SyncConnection.java:59)
	at com.vesoft.nebula.client.graph.net.NebulaPool.getSession(NebulaPool.java:108)
	at myproject.dropping.nebulausage.service.impl.NebulaServiceImpl.getOrCreateSession(NebulaServiceImpl.java:118)
	at myproject.dropping.nebulausage.service.impl.NebulaServiceImpl.getOrCreateSession(NebulaServiceImpl.java:107)
	at myproject.dropping.nebulausage.service.impl.NebulaServiceImpl.execute(NebulaServiceImpl.java:89)
	at myproject.dropping.nebulausage.test.NebulaServiceMainTest.runCases(NebulaServiceMainTest.java:61)
	at myproject.dropping.nebulausage.test.NebulaServiceMainTest.main(NebulaServiceMainTest.java:44)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
11:18:17.693 [main] ERROR myproject.dropping.nebulausage.test.NebulaServiceMainTest - 出错啦!可能需要调整一下时间间隔!
myproject.dropping.nebulausage.common.GraphDatabaseException: com.vesoft.nebula.client.graph.exception.AuthFailedException: Auth failed: Authenticate failed: Expected protocol id ffffff82 but got 0
	at myproject.dropping.nebulausage.service.impl.NebulaServiceImpl.execute(NebulaServiceImpl.java:98)
	at myproject.dropping.nebulausage.test.NebulaServiceMainTest.runCases(NebulaServiceMainTest.java:61)
	at myproject.dropping.nebulausage.test.NebulaServiceMainTest.main(NebulaServiceMainTest.java:44)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: com.vesoft.nebula.client.graph.exception.AuthFailedException: Auth failed: Authenticate failed: Expected protocol id ffffff82 but got 0
	at com.vesoft.nebula.client.graph.net.SyncConnection.authenticate(SyncConnection.java:59)
	at com.vesoft.nebula.client.graph.net.NebulaPool.getSession(NebulaPool.java:108)
	at myproject.dropping.nebulausage.service.impl.NebulaServiceImpl.getOrCreateSession(NebulaServiceImpl.java:118)
	at myproject.dropping.nebulausage.service.impl.NebulaServiceImpl.getOrCreateSession(NebulaServiceImpl.java:107)
	at myproject.dropping.nebulausage.service.impl.NebulaServiceImpl.execute(NebulaServiceImpl.java:89)
	... 7 common frames omitted
11:18:17.693 [main] INFO myproject.dropping.nebulausage.service.impl.NebulaServiceImpl - 关闭连接池

Process finished with exit code 0

nebula contrib 这个组织下的仓库都是社区用户贡献的,:thinking: 并非是官方开发的哈。

:thinking: java-demo 这个仓库是去年捐献过来的,应该适配了 v2.0.0,你内核的版本是 v2.5 版本,你这边是有什么需求想用 java-demo 吗?如果你的内核用的 2.5 的话,建议去下载使用 nebula-java 2.5 版本。

有官网DEMO吗?对nebula 连接、增、删、改、查例子吗?

这里是 nebula-java 的例子哈 nebula-java/examples at master · vesoft-inc/nebula-java · GitHub

这里还有一个 Java ORM https://github.com/nebula-contrib/graph-ocean

2 个赞

收到,谢谢!

此话题已在最后回复的 30 天后被自动关闭。不再允许新回复。