简体   繁体   中英

Orientdb connection issue while connecting remote server

I am using tikerpop orient API, its working fine on local but when I try to connect remote IP, it get failed.

OrientGraphFactory factory = new OrientGraphFactory("remote:12.34.567.89:2480/demodb", "admin", "admin");
OrientGraph txGraph = factory.getTx();

I am able to access demodb on server using orient studio but can not connect from local spring boot application code. While bean creating getting following error.


org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getGraphDB' defined in class path resource [com/straviso/interaction/config/OrientDBConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.tinkerpop.blueprints.impls.orient.OrientGraph]: Factory method 'getGraphDB' threw exception; nested exception is com.orientechnologies.orient.core.exception.ODatabaseException: Cannot open database 'demodb'
    DB name="demodb"
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:590) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1247) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1096) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:759) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:780) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:333) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1277) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1265) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
    at com.straviso.interaction.SpringOrientDBApplication.main(SpringOrientDBApplication.java:10) [classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_221]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_221]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_221]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_221]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.0.5.RELEASE.jar:2.0.5.RELEASE]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.tinkerpop.blueprints.impls.orient.OrientGraph]: Factory method 'getGraphDB' threw exception; nested exception is com.orientechnologies.orient.core.exception.ODatabaseException: Cannot open database 'demodb'
    DB name="demodb"
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:582) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    ... 23 common frames omitted
Caused by: com.orientechnologies.orient.core.exception.ODatabaseException: Cannot open database 'demodb'
    DB name="demodb"
    at com.orientechnologies.orient.core.db.OrientDBRemote.open(OrientDBRemote.java:89) ~[orientdb-client-3.0.5.jar:3.0.5]
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.open(ODatabaseDocumentTx.java:898) ~[orientdb-core-3.0.5.jar:3.0.5]
    at com.orientechnologies.orient.core.db.OPartitionedDatabasePool$DatabaseDocumentTxPooled.internalOpen(OPartitionedDatabasePool.java:440) ~[orientdb-core-3.0.5.jar:3.0.5]
    at com.orientechnologies.orient.core.db.OPartitionedDatabasePool.openDatabase(OPartitionedDatabasePool.java:303) ~[orientdb-core-3.0.5.jar:3.0.5]
    at com.orientechnologies.orient.core.db.OPartitionedDatabasePool.acquire(OPartitionedDatabasePool.java:261) ~[orientdb-core-3.0.5.jar:3.0.5]
    at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.<init>(OrientBaseGraph.java:147) ~[orientdb-graphdb-3.0.5.jar:3.0.5]
    at com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.<init>(OrientTransactionalGraph.java:78) ~[orientdb-graphdb-3.0.5.jar:3.0.5]
    at com.tinkerpop.blueprints.impls.orient.OrientGraph.<init>(OrientGraph.java:137) ~[orientdb-graphdb-3.0.5.jar:3.0.5]
    at com.tinkerpop.blueprints.impls.orient.OrientGraphFactory$1.getGraph(OrientGraphFactory.java:87) ~[orientdb-graphdb-3.0.5.jar:3.0.5]
    at com.tinkerpop.blueprints.impls.orient.OrientGraphFactory.getTx(OrientGraphFactory.java:224) ~[orientdb-graphdb-3.0.5.jar:3.0.5]
    at com.straviso.interaction.config.OrientDBConfiguration.getGraphDB(OrientDBConfiguration.java:19) ~[classes/:na]
    at com.straviso.interaction.config.OrientDBConfiguration$$EnhancerBySpringCGLIB$$685f621b.CGLIB$getGraphDB$0(<generated>) ~[classes/:na]
    at com.straviso.interaction.config.OrientDBConfiguration$$EnhancerBySpringCGLIB$$685f621b$$FastClassBySpringCGLIB$$f9e7274.invoke(<generated>) ~[classes/:na]
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:365) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at com.straviso.interaction.config.OrientDBConfiguration$$EnhancerBySpringCGLIB$$685f621b.getGraphDB(<generated>) ~[classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_221]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_221]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_221]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_221]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    ... 24 common frames omitted
Caused by: com.orientechnologies.orient.core.exception.OStorageException: Cannot create a connection to remote server address(es): [12.34.567.89:2480]
    DB name="demodb"
    at com.orientechnologies.orient.client.remote.OStorageRemote.openRemoteDatabase(OStorageRemote.java:1559) ~[orientdb-client-3.0.5.jar:3.0.5]
    at com.orientechnologies.orient.client.remote.OStorageRemote.openRemoteDatabase(OStorageRemote.java:1413) ~[orientdb-client-3.0.5.jar:3.0.5]
    at com.orientechnologies.orient.client.remote.OStorageRemote.open(OStorageRemote.java:398) ~[orientdb-client-3.0.5.jar:3.0.5]
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentRemote.internalOpen(ODatabaseDocumentRemote.java:205) ~[orientdb-client-3.0.5.jar:3.0.5]
    at com.orientechnologies.orient.core.db.OrientDBRemote.open(OrientDBRemote.java:86) ~[orientdb-client-3.0.5.jar:3.0.5]
    ... 44 common frames omitted

What correct way to connect remote server?

If you are trying to connect to the Tinkerpop API for gremlin traversals this is exposed on port 8182.

So if you are, for example, running the server in docker you'll need to expose port 8182 first before you can establish a remote connection to it.

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