Is it possible to run a JanusGraph Docker Container with an AWS Keyspace as storage backend?
I tried to configure the Keyspace using Janus Graphs cassandra-es template. If I run the below docker-compose.yml JanusGraph logs exceptions and all queries return a ScriptEvaluationError: gremlin-groovy is not an available GremlinScriptEngine'. Maybe the connection to the Keyspace cannot be established?
version: "3"
services:
janusgraph:
image: janusgraph/janusgraph:latest
container_name: jce-janusgraph
environment:
JANUS_PROPS_TEMPLATE: cassandra-es
janusgraph.storage.backend: cql
janusgraph.storage.hostname: cassandra.eu-central-1.amazonaws.com
janusgraph.storage.password: <password>
janusgraph.storage.username: <username>
janusgraph.storage.cql.keyspace: janusgraphtest
# janusgraph.storage.cql.ssl.enabled: 'true'
janusgraph.index.search.hostname: jce-elastic
ports:
- "8182:8182"
networks:
- jce-network
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.6.0
container_name: jce-elastic
environment:
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- "http.host=0.0.0.0"
- "network.host=0.0.0.0"
- "transport.host=127.0.0.1"
- "cluster.name=docker-cluster"
- "xpack.security.enabled=false"
- "discovery.zen.minimum_master_nodes=1"
ports:
- "9200:9200"
networks:
- jce-network
networks:
jce-network:
volumes:
janusgraph-default-data:
Username and password for the aws keyspace are created according to the docs
Below are the startup logs (verbose)
jce-janusgraph | waiting for storage...
jce-janusgraph | waiting for storage...
jce-janusgraph | waiting for storage...
jce-janusgraph | SLF4J: Class path contains multiple SLF4J bindings.
jce-janusgraph | SLF4J: Found binding in [jar:file:/opt/janusgraph/lib/slf4j-log4j12-1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
jce-janusgraph | SLF4J: Found binding in [jar:file:/opt/janusgraph/lib/logback-classic-1.1.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
jce-janusgraph | SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
jce-janusgraph | SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
jce-janusgraph | 2 [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - 3.4.6
jce-janusgraph | \,,,/
jce-janusgraph | (o o)
jce-janusgraph | -----oOOo-(3)-oOOo-----
jce-janusgraph |
jce-janusgraph | 145 [main] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Configuring Gremlin Server from /etc/opt/janusgraph/gremlin-server.yaml
jce-janusgraph | 208 [main] INFO org.apache.tinkerpop.gremlin.server.util.MetricManager - Configured Metrics ConsoleReporter configured with report interval=180000ms
jce-janusgraph | 211 [main] INFO org.apache.tinkerpop.gremlin.server.util.MetricManager - Configured Metrics CsvReporter configured with report interval=180000ms to fileName=/tmp/gremlin-server-metrics.csv
jce-janusgraph | 261 [main] INFO org.apache.tinkerpop.gremlin.server.util.MetricManager - Configured Metrics JmxReporter configured with domain= and agentId=
jce-janusgraph | 264 [main] INFO org.apache.tinkerpop.gremlin.server.util.MetricManager - Configured Metrics Slf4jReporter configured with interval=180000ms and loggerName=org.apache.tinkerpop.gremlin.server.Settings$Slf4jReporterMetrics
jce-janusgraph | 670 [main] INFO com.datastax.driver.core - DataStax Java driver 3.8.0 for Apache Cassandra
jce-janusgraph | 690 [main] INFO com.datastax.driver.core.GuavaCompatibility - Detected Guava < 19 in the classpath, using legacy compatibility layer
jce-janusgraph | 700 [main] WARN org.apache.tinkerpop.gremlin.server.GremlinServer - Graph [graph] configured at [/etc/opt/janusgraph/janusgraph.properties] could not be instantiated and will not be available in Gremlin Server. GraphFactory message: GraphFactory could not instantiate this Graph implementation [class org.janusgraph.core.JanusGraphFactory]
jce-janusgraph | java.lang.RuntimeException: GraphFactory could not instantiate this Graph implementation [class org.janusgraph.core.JanusGraphFactory]
jce-janusgraph | at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:81)
jce-janusgraph | at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:69)
jce-janusgraph | at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:103)
jce-janusgraph | at org.apache.tinkerpop.gremlin.server.util.DefaultGraphManager.lambda$new$0(DefaultGraphManager.java:57)
jce-janusgraph | at java.util.LinkedHashMap$LinkedEntrySet.forEach(LinkedHashMap.java:671)
jce-janusgraph | at org.apache.tinkerpop.gremlin.server.util.DefaultGraphManager.<init>(DefaultGraphManager.java:55)
jce-janusgraph | at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
jce-janusgraph | at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
jce-janusgraph | at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
jce-janusgraph | at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
jce-janusgraph | at org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.<init>(ServerGremlinExecutor.java:80)
jce-janusgraph | at org.apache.tinkerpop.gremlin.server.GremlinServer.<init>(GremlinServer.java:122)
jce-janusgraph | at org.apache.tinkerpop.gremlin.server.GremlinServer.<init>(GremlinServer.java:86)
jce-janusgraph | at org.apache.tinkerpop.gremlin.server.GremlinServer.main(GremlinServer.java:345)
jce-janusgraph | Caused by: java.lang.reflect.InvocationTargetException
jce-janusgraph | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
jce-janusgraph | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
jce-janusgraph | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
jce-janusgraph | at java.lang.reflect.Method.invoke(Method.java:498)
jce-janusgraph | at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:77)
jce-janusgraph | ... 13 more
jce-janusgraph | Caused by: java.lang.IllegalArgumentException: Could not instantiate implementation: org.janusgraph.diskstorage.cql.CQLStoreManager
jce-janusgraph | at org.janusgraph.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:64)
jce-janusgraph | at org.janusgraph.diskstorage.Backend.getImplementationClass(Backend.java:440)
jce-janusgraph | at org.janusgraph.diskstorage.Backend.getStorageManager(Backend.java:411)
jce-janusgraph | at org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder.build(GraphDatabaseConfigurationBuilder.java:50)
jce-janusgraph | at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:161)
jce-janusgraph | at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:132)
jce-janusgraph | at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:112)
jce-janusgraph | ... 18 more
jce-janusgraph | Caused by: java.lang.reflect.InvocationTargetException
jce-janusgraph | at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
jce-janusgraph | at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
jce-janusgraph | at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
jce-janusgraph | at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
jce-janusgraph | at org.janusgraph.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:58)
jce-janusgraph | ... 24 more
jce-janusgraph | Caused by: java.lang.IllegalArgumentException: Invalid configuration value for [root.storage.cql.ssl.truststore.location]:
jce-janusgraph | at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145)
jce-janusgraph | at org.janusgraph.diskstorage.configuration.ConfigOption.verify(ConfigOption.java:240)
jce-janusgraph | at org.janusgraph.diskstorage.configuration.ConfigOption.get(ConfigOption.java:232)
jce-janusgraph | at org.janusgraph.diskstorage.configuration.BasicConfiguration.get(BasicConfiguration.java:69)
jce-janusgraph | at org.janusgraph.diskstorage.configuration.Configuration.get(Configuration.java:35)
jce-janusgraph | at org.janusgraph.diskstorage.cql.CQLStoreManager.initializeCluster(CQLStoreManager.java:277)
jce-janusgraph | at org.janusgraph.diskstorage.cql.CQLStoreManager.<init>(CQLStoreManager.java:181)
jce-janusgraph | ... 29 more
jce-janusgraph | 703 [main] INFO org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor - Initialized Gremlin thread pool. Threads in pool named with pattern gremlin-*
jce-janusgraph | 775 [main] INFO org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor - Initialized GremlinExecutor and preparing GremlinScriptEngines instances.
jce-janusgraph | 3661 [gremlin-server-exec-1] ERROR org.apache.tinkerpop.gremlin.jsr223.DefaultGremlinScriptEngineManager - Could not create GremlinScriptEngine for gremlin-groovy
jce-janusgraph | java.lang.IllegalStateException: javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: graph for class: Script1
jce-janusgraph | at org.apache.tinkerpop.gremlin.jsr223.DefaultGremlinScriptEngineManager.lambda$createGremlinScriptEngine$16(DefaultGremlinScriptEngineManager.java:464)
jce-janusgraph | at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
jce-janusgraph | at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
jce-janusgraph | at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
jce-janusgraph | at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:647)
jce-janusgraph | at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:272)
jce-janusgraph | at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
jce-janusgraph | at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
jce-janusgraph | at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
jce-janusgraph | at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
jce-janusgraph | at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
jce-janusgraph | at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
jce-janusgraph | at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485)
jce-janusgraph | at org.apache.tinkerpop.gremlin.jsr223.DefaultGremlinScriptEngineManager.createGremlinScriptEngine(DefaultGremlinScriptEngineManager.java:450)
jce-janusgraph | at org.apache.tinkerpop.gremlin.jsr223.DefaultGremlinScriptEngineManager.getEngineByName(DefaultGremlinScriptEngineManager.java:219)
jce-janusgraph | at org.apache.tinkerpop.gremlin.jsr223.CachedGremlinScriptEngineManager.lambda$getEngineByName$0(CachedGremlinScriptEngineManager.java:57)
jce-janusgraph | at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
jce-janusgraph | at org.apache.tinkerpop.gremlin.jsr223.CachedGremlinScriptEngineManager.getEngineByName(CachedGremlinScriptEngineManager.java:57)
jce-janusgraph | at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$0(GremlinExecutor.java:267)
jce-janusgraph | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
jce-janusgraph | at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
jce-janusgraph | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
jce-janusgraph | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
jce-janusgraph | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
jce-janusgraph | at java.lang.Thread.run(Thread.java:748)
jce-janusgraph | Caused by: javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: graph for class: Script1
jce-janusgraph | at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:378)
jce-janusgraph | at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
jce-janusgraph | at org.apache.tinkerpop.gremlin.jsr223.DefaultGremlinScriptEngineManager.lambda$createGremlinScriptEngine$16(DefaultGremlinScriptEngineManager.java:460)
jce-janusgraph | ... 24 more
jce-janusgraph | Caused by: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: graph for class: Script1
jce-janusgraph | at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:697)
jce-janusgraph | at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:376)
jce-janusgraph | ... 26 more
jce-janusgraph | Caused by: groovy.lang.MissingPropertyException: No such property: graph for class: Script1
jce-janusgraph | at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:65)
jce-janusgraph | at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:51)
jce-janusgraph | at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:309)
jce-janusgraph | at Script1.run(Script1.groovy:30)
jce-janusgraph | at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:674)
jce-janusgraph | ... 27 more
jce-janusgraph | 3663 [main] WARN org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor - Could not initialize gremlin-groovy GremlinScriptEngine as init script could not be evaluated
jce-janusgraph | java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: gremlin-groovy is not an available GremlinScriptEngine
jce-janusgraph | at java.util.concurrent.CompletableFuture.reportJoin(CompletableFuture.java:375)
jce-janusgraph | at java.util.concurrent.CompletableFuture.join(CompletableFuture.java:1947)
jce-janusgraph | at org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.lambda$new$4(ServerGremlinExecutor.java:141)
jce-janusgraph | at java.util.LinkedHashMap$LinkedKeySet.forEach(LinkedHashMap.java:559)
jce-janusgraph | at org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.<init>(ServerGremlinExecutor.java:136)
jce-janusgraph | at org.apache.tinkerpop.gremlin.server.GremlinServer.<init>(GremlinServer.java:122)
jce-janusgraph | at org.apache.tinkerpop.gremlin.server.GremlinServer.<init>(GremlinServer.java:86)
jce-janusgraph | at org.apache.tinkerpop.gremlin.server.GremlinServer.main(GremlinServer.java:345)
jce-janusgraph | Caused by: java.lang.IllegalArgumentException: gremlin-groovy is not an available GremlinScriptEngine
jce-janusgraph | at org.apache.tinkerpop.gremlin.jsr223.CachedGremlinScriptEngineManager.registerLookUpInfo(CachedGremlinScriptEngineManager.java:95)
jce-janusgraph | at org.apache.tinkerpop.gremlin.jsr223.CachedGremlinScriptEngineManager.getEngineByName(CachedGremlinScriptEngineManager.java:58)
jce-janusgraph | at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$0(GremlinExecutor.java:267)
jce-janusgraph | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
jce-janusgraph | at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
jce-janusgraph | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
jce-janusgraph | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
jce-janusgraph | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
jce-janusgraph | at java.lang.Thread.run(Thread.java:748)
jce-janusgraph | 3816 [main] WARN org.apache.tinkerpop.gremlin.server.AbstractChannelizer - The org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0 serialization class is deprecated.
jce-janusgraph | 3870 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - Configured application/vnd.gremlin-v3.0+gryo with org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0
jce-janusgraph | 3870 [main] WARN org.apache.tinkerpop.gremlin.server.AbstractChannelizer - The org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0 serialization class is deprecated.
jce-janusgraph | 3870 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - Configured application/vnd.gremlin-v3.0+gryo-stringd with org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0
jce-janusgraph | 3900 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - Configured application/vnd.gremlin-v3.0+json with org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0
jce-janusgraph | 3905 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - Configured application/json with org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0
jce-janusgraph | 3909 [main] WARN org.apache.tinkerpop.gremlin.server.AbstractChannelizer - The org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0 serialization class is deprecated.
jce-janusgraph | 3911 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - Configured application/vnd.gremlin-v1.0+gryo with org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0
jce-janusgraph | 3914 [main] WARN org.apache.tinkerpop.gremlin.server.AbstractChannelizer - The org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0 serialization class is deprecated.
jce-janusgraph | 3916 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - Configured application/vnd.gremlin-v1.0+gryo-lite with org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0
jce-janusgraph | 3917 [main] WARN org.apache.tinkerpop.gremlin.server.AbstractChannelizer - The org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0 serialization class is deprecated.
jce-janusgraph | 3918 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - Configured application/vnd.gremlin-v1.0+gryo-stringd with org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0
jce-janusgraph | 3919 [main] WARN org.apache.tinkerpop.gremlin.server.AbstractChannelizer - The org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0 serialization class is deprecated.
jce-janusgraph | 3931 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - Configured application/vnd.gremlin-v2.0+json with org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0
jce-janusgraph | 3936 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - application/json already has org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0 configured - it will not be replaced by org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0, change order of serialization configuration if this is not desired.
jce-janusgraph | 3952 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - Configured application/vnd.gremlin-v1.0+json with org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0
jce-janusgraph | 3954 [main] INFO org.apache.tinkerpop.gremlin.server.AbstractChannelizer - application/json already has org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0 configured - it will not be replaced by org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, change order of serialization configuration if this is not desired.
jce-janusgraph | 4111 [gremlin-server-boss-1] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Gremlin Server configured with worker thread pool of 1, gremlin pool of 8 and boss thread pool of 1.
jce-janusgraph | 4112 [gremlin-server-boss-1] INFO org.apache.tinkerpop.gremlin.server.GremlinServer - Channel started at port 8182.
jce-janusgraph | 168147 [gremlin-server-exec-2] ERROR org.apache.tinkerpop.gremlin.jsr223.DefaultGremlinScriptEngineManager - Could not create GremlinScriptEngine for gremlin-groovy
jce-janusgraph | java.lang.IllegalStateException: javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: graph for class: Script2
jce-janusgraph | at org.apache.tinkerpop.gremlin.jsr223.DefaultGremlinScriptEngineManager.lambda$createGremlinScriptEngine$16(DefaultGremlinScriptEngineManager.java:464)
jce-janusgraph | at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
jce-janusgraph | at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
jce-janusgraph | at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
jce-janusgraph | at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:647)
jce-janusgraph | at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:272)
jce-janusgraph | at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
jce-janusgraph | at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
jce-janusgraph | at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
jce-janusgraph | at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
jce-janusgraph | at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
jce-janusgraph | at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
jce-janusgraph | at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485)
jce-janusgraph | at org.apache.tinkerpop.gremlin.jsr223.DefaultGremlinScriptEngineManager.createGremlinScriptEngine(DefaultGremlinScriptEngineManager.java:450)
jce-janusgraph | at org.apache.tinkerpop.gremlin.jsr223.DefaultGremlinScriptEngineManager.getEngineByName(DefaultGremlinScriptEngineManager.java:219)
jce-janusgraph | at org.apache.tinkerpop.gremlin.jsr223.CachedGremlinScriptEngineManager.lambda$getEngineByName$0(CachedGremlinScriptEngineManager.java:57)
jce-janusgraph | at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
jce-janusgraph | at org.apache.tinkerpop.gremlin.jsr223.CachedGremlinScriptEngineManager.getEngineByName(CachedGremlinScriptEngineManager.java:57)
jce-janusgraph | at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$0(GremlinExecutor.java:267)
jce-janusgraph | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
jce-janusgraph | at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
jce-janusgraph | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
jce-janusgraph | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
jce-janusgraph | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
jce-janusgraph | at java.lang.Thread.run(Thread.java:748)
jce-janusgraph | Caused by: javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: graph for class: Script2
jce-janusgraph | at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:378)
jce-janusgraph | at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
jce-janusgraph | at org.apache.tinkerpop.gremlin.jsr223.DefaultGremlinScriptEngineManager.lambda$createGremlinScriptEngine$16(DefaultGremlinScriptEngineManager.java:460)
jce-janusgraph | ... 24 more
jce-janusgraph | Caused by: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: graph for class: Script2
jce-janusgraph | at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:697)
jce-janusgraph | at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:376)
jce-janusgraph | ... 26 more
jce-janusgraph | Caused by: groovy.lang.MissingPropertyException: No such property: graph for class: Script2
jce-janusgraph | at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:65)
jce-janusgraph | at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:51)
jce-janusgraph | at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:309)
jce-janusgraph | at Script2.run(Script2.groovy:30)
jce-janusgraph | at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:674)
jce-janusgraph | ... 27 more
jce-janusgraph | 168152 [gremlin-server-exec-2] WARN org.apache.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor - Exception processing a script on request [RequestMessage{, requestId=7ee95a3f-3ccc-4204-b0a7-30bc853020fe, op='eval', processor='', args={gremlin=g.V()}}].
jce-janusgraph | java.lang.IllegalArgumentException: gremlin-groovy is not an available GremlinScriptEngine
jce-janusgraph | at org.apache.tinkerpop.gremlin.jsr223.CachedGremlinScriptEngineManager.registerLookUpInfo(CachedGremlinScriptEngineManager.java:95)
jce-janusgraph | at org.apache.tinkerpop.gremlin.jsr223.CachedGremlinScriptEngineManager.getEngineByName(CachedGremlinScriptEngineManager.java:58)
jce-janusgraph | at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$0(GremlinExecutor.java:267)
jce-janusgraph | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
jce-janusgraph | at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
jce-janusgraph | at java.util.concurrent.FutureTask.run(FutureTask.java:266)
jce-janusgraph | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
jce-janusgraph | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
jce-janusgraph | at java.lang.Thread.run(Thread.java:748)
jce-janusgraph | 6/5/20 4:29:27 PM ==============================================================
Connecting JanusGraph to an AWS Keyspace appears to be currently not possible.
In order to connect with an AWS Keyspace SSL communication needs to be enabled. Namely, the following settings need to be configured for JanusGraph:
'storage.cql.ssl.truststore.location=<location>'
'storage.cql.ssl.truststore.password=<truststorepw>'
'storage.cql.ssl.enabled=true'
Unfortunately, even after enabling SSL, JanusGraph throws exceptions on startup (related):
java.lang.IllegalArgumentException: Unrecognized partitioner: com.amazonaws.cassandra.DefaultPartitioner
This appears to be caused by an explicit check for partitioner names in JanusGraphs' CQLStoreManager. So to sum up, AWS Keyspaces use a custom partitioner which is not supported by JanusGraph.
Related
Whenever there is nested object in Avro class schema is not getting saved
always get exception like
org.apache.kafka.connect.errors.ConnectException: Tolerance exceeded in error handler
connect_1 | at org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndHandleError(RetryWithToleranceOperator.java:223)
connect_1 | at org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execute(RetryWithToleranceOperator.java:149)
connect_1 | at org.apache.kafka.connect.runtime.WorkerSourceTask.convertTransformedRecord(WorkerSourceTask.java:330)
connect_1 | at org.apache.kafka.connect.runtime.WorkerSourceTask.sendRecords(WorkerSourceTask.java:356)
connect_1 | at org.apache.kafka.connect.runtime.WorkerSourceTask.execute(WorkerSourceTask.java:258)
connect_1 | at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:188)
connect_1 | at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:243)
connect_1 | at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
connect_1 | at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
connect_1 | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
connect_1 | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
connect_1 | at java.base/java.lang.Thread.run(Thread.java:829)
connect_1 | Caused by: org.apache.avro.SchemaParseException: Can't redefine: io.confluent.connect.avro.ConnectDefault
connect_1 | at org.apache.avro.Schema$Names.put(Schema.java:1550)
connect_1 | at org.apache.avro.Schema$NamedSchema.writeNameRef(Schema.java:813)
connect_1 | at org.apache.avro.Schema$RecordSchema.toJson(Schema.java:975)
connect_1 | at org.apache.avro.Schema$UnionSchema.toJson(Schema.java:1242)
connect_1 | at org.apache.avro.Schema$RecordSchema.fieldsToJson(Schema.java:1003)
connect_1 | at org.apache.avro.Schema$RecordSchema.toJson(Schema.java:987)
connect_1 | at org.apache.avro.Schema.toString(Schema.java:426)
connect_1 | at org.apache.avro.Schema.toString(Schema.java:398)
connect_1 | at org.apache.avro.Schema.toString(Schema.java:389)
connect_1 | at io.apicurio.registry.serde.avro.AvroKafkaSerializer.getSchemaFromData(AvroKafkaSerializer.java:108)
connect_1 | at io.apicurio.registry.serde.AbstractKafkaSerializer.lambda$serialize$0(AbstractKafkaSerializer.java:90)
connect_1 | at io.apicurio.registry.serde.LazyLoadedParsedSchema.getRawSchema(LazyLoadedParsedSchema.java:55)
connect_1 | at io.apicurio.registry.serde.DefaultSchemaResolver.resolveSchema(DefaultSchemaResolver.java:81)
connect_1 | at io.apicurio.registry.serde.AbstractKafkaSerializer.serialize(AbstractKafkaSerializer.java:92)
connect_1 | at io.apicurio.registry.serde.AbstractKafkaSerializer.serialize(AbstractKafkaSerializer.java:79)
connect_1 | at io.apicurio.registry.utils.converter.SerdeBasedConverter.fromConnectData(SerdeBasedConverter.java:111)
connect_1 | at org.apache.kafka.connect.storage.Converter.fromConnectData(Converter.java:64)
connect_1 | at org.apache.kafka.connect.runtime.WorkerSourceTask.lambda$convertTransformedRecord$3(WorkerSourceTask.java:330)
connect_1 | at org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndRetry(RetryWithToleranceOperator.java:173)
connect_1 | at org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndHandleError(RetryWithToleranceOperator.java:207)
connect_1 | ... 11 more
Tools useed
Debezium
Apicurio Schema registry
Avro format
Whenever there is nested object in Avro class schema is not getting saved
always get exception like
org.apache.kafka.connect.errors.ConnectException: Tolerance exceeded in error handler
connect_1 | at org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndHandleError(RetryWithToleranceOperator.java:223)
connect_1 | at org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execute(RetryWithToleranceOperator.java:149)
connect_1 | at org.apache.kafka.connect.runtime.WorkerSourceTask.convertTransformedRecord(WorkerSourceTask.java:330)
connect_1 | at org.apache.kafka.connect.runtime.WorkerSourceTask.sendRecords(WorkerSourceTask.java:356)
connect_1 | at org.apache.kafka.connect.runtime.WorkerSourceTask.execute(WorkerSourceTask.java:258)
connect_1 | at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:188)
connect_1 | at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:243)
connect_1 | at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
connect_1 | at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
connect_1 | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
connect_1 | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
connect_1 | at java.base/java.lang.Thread.run(Thread.java:829)
connect_1 | Caused by: org.apache.avro.SchemaParseException: Can't redefine: io.confluent.connect.avro.ConnectDefault
connect_1 | at org.apache.avro.Schema$Names.put(Schema.java:1550)
connect_1 | at org.apache.avro.Schema$NamedSchema.writeNameRef(Schema.java:813)
connect_1 | at org.apache.avro.Schema$RecordSchema.toJson(Schema.java:975)
connect_1 | at org.apache.avro.Schema$UnionSchema.toJson(Schema.java:1242)
connect_1 | at org.apache.avro.Schema$RecordSchema.fieldsToJson(Schema.java:1003)
connect_1 | at org.apache.avro.Schema$RecordSchema.toJson(Schema.java:987)
connect_1 | at org.apache.avro.Schema.toString(Schema.java:426)
connect_1 | at org.apache.avro.Schema.toString(Schema.java:398)
connect_1 | at org.apache.avro.Schema.toString(Schema.java:389)
connect_1 | at io.apicurio.registry.serde.avro.AvroKafkaSerializer.getSchemaFromData(AvroKafkaSerializer.java:108)
connect_1 | at io.apicurio.registry.serde.AbstractKafkaSerializer.lambda$serialize$0(AbstractKafkaSerializer.java:90)
connect_1 | at io.apicurio.registry.serde.LazyLoadedParsedSchema.getRawSchema(LazyLoadedParsedSchema.java:55)
connect_1 | at io.apicurio.registry.serde.DefaultSchemaResolver.resolveSchema(DefaultSchemaResolver.java:81)
connect_1 | at io.apicurio.registry.serde.AbstractKafkaSerializer.serialize(AbstractKafkaSerializer.java:92)
connect_1 | at io.apicurio.registry.serde.AbstractKafkaSerializer.serialize(AbstractKafkaSerializer.java:79)
connect_1 | at io.apicurio.registry.utils.converter.SerdeBasedConverter.fromConnectData(SerdeBasedConverter.java:111)
connect_1 | at org.apache.kafka.connect.storage.Converter.fromConnectData(Converter.java:64)
connect_1 | at org.apache.kafka.connect.runtime.WorkerSourceTask.lambda$convertTransformedRecord$3(WorkerSourceTask.java:330)
connect_1 | at org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndRetry(RetryWithToleranceOperator.java:173)
connect_1 | at org.apache.kafka.connect.runtime.errors.RetryWithToleranceOperator.execAndHandleError(RetryWithToleranceOperator.java:207)
connect_1 | ... 11 more
Tools useed
Debezium
Apicurio Schema registry
Avro format
I used SpringBoot rest api and MongoDB. I have three different DataBases such as player-db, game-db and score-db. for each services I have DockerFiles.
when I run docker-compose up I've Getting an Error:
The error in docker-shell:
game-docker_1 | 2020-06-12 09:12:03.795 INFO 1 --- [localhost:27017] org.mon
godb.driver.cluster : Exception in monitor thread while connecting
to server localhost:27017
game-docker_1 |
game-docker_1 | com.mongodb.MongoSocketOpenException: Exception opening socke
t
game-docker_1 | at com.mongodb.internal.connection.SocketStream.open(Soc
ketStream.java:70) ~[mongo-java-driver-3.11.2.jar!/:na]
game-docker_1 | at com.mongodb.internal.connection.InternalStreamConnect
ion.open(InternalStreamConnection.java:128) ~[mongo-java-driver-3.11.2.jar!/:na]
game-docker_1 | at com.mongodb.internal.connection.DefaultServerMonitor$
ServerMonitorRunnable.run(DefaultServerMonitor.java:117) ~[mongo-java-driver-3.1
1.2.jar!/:na]
game-docker_1 | at java.lang.Thread.run(Thread.java:748) [na:1.8.0_252]
game-docker_1 | Caused by: java.net.ConnectException: Connection refused (Con
nection refused)
game-docker_1 | at java.net.PlainSocketImpl.socketConnect(Native Method)
~[na:1.8.0_252]
game-docker_1 | at java.net.AbstractPlainSocketImpl.doConnect(AbstractPl
ainSocketImpl.java:350) ~[na:1.8.0_252]
game-docker_1 | at java.net.AbstractPlainSocketImpl.connectToAddress(Abs
tractPlainSocketImpl.java:206) ~[na:1.8.0_252]
game-docker_1 | at java.net.AbstractPlainSocketImpl.connect(AbstractPlai
nSocketImpl.java:188) ~[na:1.8.0_252]
game-docker_1 | at java.net.SocksSocketImpl.connect(SocksSocketImpl.java
:392) ~[na:1.8.0_252]
game-docker_1 | at java.net.Socket.connect(Socket.java:607) ~[na:1.8.0_2
52]
game-docker_1 | at com.mongodb.internal.connection.SocketStreamHelper.in
itialize(SocketStreamHelper.java:64) ~[mongo-java-driver-3.11.2.jar!/:na]
game-docker_1 | at com.mongodb.internal.connection.SocketStream.initiali
zeSocket(SocketStream.java:79) ~[mongo-java-driver-3.11.2.jar!/:na]
game-docker_1 | at com.mongodb.internal.connection.SocketStream.open(Soc
ketStream.java:65) ~[mongo-java-driver-3.11.2.jar!/:na]
game-docker_1 | ... 3 common frames omitted
game-docker_1 |
player-docker_1 | 2020-06-12 09:12:03.810 INFO 1 --- [localhost:27017] org.mon
godb.driver.cluster : Exception in monitor thread while connecting
to server localhost:27017
player-docker_1 |
player-docker_1 | com.mongodb.MongoSocketOpenException: Exception opening socke
t
player-docker_1 | at com.mongodb.internal.connection.SocketStream.open(Soc
ketStream.java:70) ~[mongo-java-driver-3.11.2.jar!/:na]
player-docker_1 | at com.mongodb.internal.connection.InternalStreamConnect
ion.open(InternalStreamConnection.java:128) ~[mongo-java-driver-3.11.2.jar!/:na]
player-docker_1 | at com.mongodb.internal.connection.DefaultServerMonitor$
ServerMonitorRunnable.run(DefaultServerMonitor.java:117) ~[mongo-java-driver-3.1
1.2.jar!/:na]
player-docker_1 | at java.lang.Thread.run(Thread.java:748) [na:1.8.0_252]
player-docker_1 | Caused by: java.net.ConnectException: Connection refused (Con
nection refused)
player-docker_1 | at java.net.PlainSocketImpl.socketConnect(Native Method)
~[na:1.8.0_252]
player-docker_1 | at java.net.AbstractPlainSocketImpl.doConnect(AbstractPl
ainSocketImpl.java:350) ~[na:1.8.0_252]
player-docker_1 | at java.net.AbstractPlainSocketImpl.connectToAddress(Abs
tractPlainSocketImpl.java:206) ~[na:1.8.0_252]
player-docker_1 | at java.net.AbstractPlainSocketImpl.connect(AbstractPlai
nSocketImpl.java:188) ~[na:1.8.0_252]
player-docker_1 | at java.net.SocksSocketImpl.connect(SocksSocketImpl.java
:392) ~[na:1.8.0_252]
player-docker_1 | at java.net.Socket.connect(Socket.java:607) ~[na:1.8.0_2
52]
player-docker_1 | at com.mongodb.internal.connection.SocketStreamHelper.in
itialize(SocketStreamHelper.java:64) ~[mongo-java-driver-3.11.2.jar!/:na]
player-docker_1 | at com.mongodb.internal.connection.SocketStream.initiali
zeSocket(SocketStream.java:79) ~[mongo-java-driver-3.11.2.jar!/:na]
player-docker_1 | at com.mongodb.internal.connection.SocketStream.open(Soc
ketStream.java:65) ~[mongo-java-driver-3.11.2.jar!/:na]
player-docker_1 | ... 3 common frames omitted
player-docker_1 |
score-docker_1 | 2020-06-12 09:12:03.893 INFO 1 --- [localhost:27017] org.mon
godb.driver.cluster : Exception in monitor thread while connecting
to server localhost:27017
score-docker_1 |
score-docker_1 | com.mongodb.MongoSocketOpenException: Exception opening socke
t
score-docker_1 | at com.mongodb.internal.connection.SocketStream.open(Soc
ketStream.java:70) ~[mongo-java-driver-3.11.2.jar!/:na]
score-docker_1 | at com.mongodb.internal.connection.InternalStreamConnect
ion.open(InternalStreamConnection.java:128) ~[mongo-java-driver-3.11.2.jar!/:na]
score-docker_1 | at com.mongodb.internal.connection.DefaultServerMonitor$
ServerMonitorRunnable.run(DefaultServerMonitor.java:117) ~[mongo-java-driver-3.1
1.2.jar!/:na]
score-docker_1 | at java.lang.Thread.run(Thread.java:748) [na:1.8.0_252]
score-docker_1 | Caused by: java.net.ConnectException: Connection refused (Con
nection refused)
score-docker_1 | at java.net.PlainSocketImpl.socketConnect(Native Method)
~[na:1.8.0_252]
score-docker_1 | at java.net.AbstractPlainSocketImpl.doConnect(AbstractPl
ainSocketImpl.java:350) ~[na:1.8.0_252]
score-docker_1 | at java.net.AbstractPlainSocketImpl.connectToAddress(Abs
tractPlainSocketImpl.java:206) ~[na:1.8.0_252]
score-docker_1 | at java.net.AbstractPlainSocketImpl.connect(AbstractPlai
nSocketImpl.java:188) ~[na:1.8.0_252]
score-docker_1 | at java.net.SocksSocketImpl.connect(SocksSocketImpl.java
:392) ~[na:1.8.0_252]
score-docker_1 | at java.net.Socket.connect(Socket.java:607) ~[na:1.8.0_2
52]
score-docker_1 | at com.mongodb.internal.connection.SocketStreamHelper.in
itialize(SocketStreamHelper.java:64) ~[mongo-java-driver-3.11.2.jar!/:na]
score-docker_1 | at com.mongodb.internal.connection.SocketStream.initiali
zeSocket(SocketStream.java:79) ~[mongo-java-driver-3.11.2.jar!/:na]
score-docker_1 | at com.mongodb.internal.connection.SocketStream.open(Soc
ketStream.java:65) ~[mongo-java-driver-3.11.2.jar!/:na]
score-docker_1 | ... 3 common frames omitted
score-docker_1 |
game-docker_1 | 2020-06-12 09:12:06.823 INFO 1 --- [ main] o.s.s.c
oncurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTas
kExecutor'
player-docker_1 | 2020-06-12 09:12:06.895 INFO 1 --- [ main] o.s.s.c
oncurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTas
kExecutor'
The docker-compose.yml:
version: "3"
services:
player-docker:
build:
context: ./
dockerfile: ./src/main/java/spring/multiple/mongo/project/player/DockerFile
restart: always
ports:
- 8080:8080
depends_on:
- db
game-docker:
build:
context: ./
dockerfile: ./src/main/java/spring/multiple/mongo/project/game/DockerFile
restart: always
ports:
- 8081:8080
depends_on:
- db1
score-docker:
build:
context: ./
dockerfile: ./src/main/java/spring/multiple/mongo/project/score/Dockerfile
restart: always
ports:
- 8082:8080
depends_on:
- db2
db:
image: mongo
volumes:
- mongodata:/data/db
ports:
- 27017:27017
restart: always
environment:
MONGO_INITDB_ROOT_DATABASE: player-db
db1:
image: mongo
volumes:
- mongodata:/data/db1
ports:
- 27018:27017
restart: always
environment:
MONGO_INITDB_ROOT_DATABASE: game-db
db2:
image: mongo
volumes:
- mongodata:/data/db2
ports:
- 27019:27017
restart: always
environment:
MONGO_INITDB_ROOT_DATABASE: score-db
volumes:
mongodata:
I do not know how to solve this problem.
I am beginner in Docker.
The problem here is with the network. Kindly understand that each container is a kind of a separate VM. Here, You are trying to connect to localhost. This will not work as each of the containers will resolve to it's own Loop back.
You can solve this in multiple ways:
Since all the containers are connected to the same docker network you can use container names to resolve respective ones. So here you can use db:27017 to connect to MongoDB.(Recommended)
Since you have port bonded all the containers you can use of the host machine instead of localhost. So if your host machine's private IP is 10.0.0.1 then use 10.0.0.1:27017 to connect to MongoDB.
Use host network, in this case, port binding instruction will be useless as it will be ignored and every service gets bonded automatically to their own port and you can use localhost to connect each of them (Not recommended)
References:
Networking overview
Use bridge networks
Networking in Compose
I have the problem when I'm trying to run docker-compose up on my server. Everything works on my localhost.
docker-compose.yml:
dictionary_app_prod_mongo:
image: mongo
container_name: springboot-mongo
ports:
- 27017:27017
volumes:
- $HOME/data/springboot-mongo-data:/data/db
- $HOME/data/springboot-mongo-bkp:/data/bkp
restart: always
application.properties:
#Mongo configuration
spring.data.mongodb.uri=mongodb://springboot-mongo:27017/springmongo-demo
Exception stacktrace:
dictionary_app_prod | 2019-11-23 11:28:41.789 INFO 1 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
dictionary_app_prod | 2019-11-23 11:28:42.595 INFO 1 --- [ main] org.mongodb.driver.cluster : Cluster created with settings {hosts=[127.0.0.1:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
dictionary_app_prod | 2019-11-23 11:28:42.736 INFO 1 --- [127.0.0.1:27017] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server 127.0.0.1:27017
dictionary_app_prod |
dictionary_app_prod | com.mongodb.MongoSocketOpenException: Exception opening socket
dictionary_app_prod | at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:67) ~[mongodb-driver-core-3.8.2.jar!/:na]
dictionary_app_prod | at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:126) ~[mongodb-driver-core-3.8.2.jar!/:na]
dictionary_app_prod | at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:117) ~[mongodb-driver-core-3.8.2.jar!/:na]
dictionary_app_prod | at java.lang.Thread.run(Thread.java:748) [na:1.8.0_212]
dictionary_app_prod | Caused by: java.net.ConnectException: Connection refused (Connection refused)
dictionary_app_prod | at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_212]
dictionary_app_prod | at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_212]
dictionary_app_prod | at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_212]
dictionary_app_prod | at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_212]
dictionary_app_prod | at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_212]
dictionary_app_prod | at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_212]
dictionary_app_prod | at com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:64) ~[mongodb-driver-core-3.8.2.jar!/:na]
dictionary_app_prod | at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:62) ~[mongodb-driver-core-3.8.2.jar!/:na]
dictionary_app_prod | ... 3 common frames omitted
CMD on server: docker-compose ps
dictionary_app_prod java -jar /app.jar Up 0.0.0.0:8888->8082/tcp
dictionaryapp_dictionary_app_prod_mysql_1 docker-entrypoint.sh mysqld Up 0.0.0.0:3306->3306/tcp, 33060/tcp
springboot-mongo docker-entrypoint.sh mongod Up 0.0.0.0:27017->27017/tcp
The system I use is centos7 and I had disabled selinux
docker-compose.yaml:
version: "2"
services:
web-service:
build:
context: .
dockerfile: springboot.dockerfile
container_name: smweb-container
ports:
- "8088:8888"
# networks:
# - net-spring-db
depends_on:
- db-service
db-service:
build:
context: .
dockerfile: sql.dockerfile
container_name: mysql-container
restart: always
ports:
- "3306:3306"
networks:
- net-spring-db
## environment:
## MYSQL_ROOT_PASSWORD: 123
environment:
MYSQL_DATABASE: rbac
MYSQL_USER: h2t
MYSQL_PASSWORD: 123456
networks:
net-spring-db:
driver: bridge
application.properties:
server.port=8888
## user container name to replace ip
spring.datasource.url=jdbc:mysql://mysql-container:3306/rbac?characterEncoding=utf8&useSSL=false
spring.datasource.username=h2t
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
mybatis-plus.mapper-locations=classpath*:/mapper/*.xml
mybatis-plus.type-aliases-package=com.h2t.study.pojo
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
mybatis-plus.global-config.db-config.logic-delete-value=1
mybatis-plus.global-config.db-config.logic-not-delete-value=0
When I use docker-compose up
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
smweb-container |
smweb-container | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
smweb-container | at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_111]
smweb-container | at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_111]
smweb-container | at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_111]
smweb-container | at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_111]
smweb-container | at com.mysql.jdbc.Util.handleNewInstance(Util.java:404) ~[mysql-connector-java-5.1.37.jar!/:5.1.37]
smweb-container | at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:983) ~[mysql-connector-java-5.1.37.jar!/:5.1.37]
smweb-container | at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:339) ~[mysql-connector-java-5.1.37.jar!/:5.1.37]
smweb-container | at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2252) ~[mysql-connector-java-5.1.37.jar!/:5.1.37]
smweb-container | at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2285) ~[mysql-connector-java-5.1.37.jar!/:5.1.37]
smweb-container | at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2084) ~[mysql-connector-java-5.1.37.jar!/:5.1.37]
smweb-container | at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:795) ~[mysql-connector-java-5.1.37.jar!/:5.1.37]
smweb-container | at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44) ~[mysql-connector-java-5.1.37.jar!/:5.1.37]
smweb-container | at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_111]
smweb-container | at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_111]
smweb-container | at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_111]
smweb-container | at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_111]
smweb-container | at com.mysql.jdbc.Util.handleNewInstance(Util.java:404) ~[mysql-connector-java-5.1.37.jar!/:5.1.37]
smweb-container | at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:400) ~[mysql-connector-java-5.1.37.jar!/:5.1.37]
smweb-container | at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:327) ~[mysql-connector-java-5.1.37.jar!/:5.1.37]
smweb-container | at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:136) ~[HikariCP-3.2.0.jar!/:na]
smweb-container | at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:369) ~[HikariCP-3.2.0.jar!/:na]
smweb-container | at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:198) ~[HikariCP-3.2.0.jar!/:na]
smweb-container | at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:467) [HikariCP-3.2.0.jar!/:na]
smweb-container | at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:541) [HikariCP-3.2.0.jar!/:na]
smweb-container | at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115) [HikariCP-3.2.0.jar!/:na]
smweb-container | at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) [HikariCP-3.2.0.jar!/:na]
I can use docker exec -it mysql-container bash command to enter mysql container and I can also use mysql -uh2t -p123456 to connect mysql.At the same time,I check the table,it was initialized,but SpringBoot App still can't connect to MySQL.
Can you help me,thanks in advance.