Zac*_*ach 1 maven-package cassandra-3.0 docker-container janusgraph java-11
为什么在包含依赖项时会出现此错误?
\nCould not find implementation class: org.janusgraph.diskstorage.cql.CQLStoreManager\nRun Code Online (Sandbox Code Playgroud)\nCould not find implementation class: org.janusgraph.diskstorage.cql.CQLStoreManager\nRun Code Online (Sandbox Code Playgroud)\n请注意,我对 JanusGraph 和 GraphDB 以及 Cassandra 都是新手。
\ndocker run --name jg-cassandra -d -e CASSANDRA_START_RPC=true -p 9160:9160 -p 9042:9042 -p 7199:7199 -p 7001:7001 -p 7000:7000 cassandra:3.11janusgraph.cql.properties到 Cassandra [Docker 容器]\ndocker exec -i jg-cassandra mkdir -p /opt/janusgraph/confdocker cp janusgraph-cql.properties jq-cassandra:/opt/janusgraph/confJanusGraph janusGraph = JanusGraphFactory.build().set("storage.backend", "cql").set("storage.hostname", "localhost:9042").open();Could not instantiate implementation: org.janusgraph.diskstorage.cql.CQLStoreManager <dependency>\n <groupId>org.janusgraph</groupId>\n <artifactId>janusgraph-cql</artifactId>\nRun Code Online (Sandbox Code Playgroud)\n\xe2\x94\x82 pom.xml\n\xe2\x94\x82\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80src\n\xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80main\n\xe2\x94\x82 \xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80java\n\xe2\x94\x82 \xe2\x94\x82 \xe2\x94\x82 Main.java\n\xe2\x94\x82 \xe2\x94\x82 \xe2\x94\x82\n\xe2\x94\x82 \xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80resources\n\xe2\x94\x82 \xe2\x94\x82 \xe2\x94\x82 log4j2.xml\n\xe2\x94\x82 \xe2\x94\x82 \xe2\x94\x82\n\xe2\x94\x82 \xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80conf\n\xe2\x94\x82 \xe2\x94\x82 \xe2\x94\x82 remote-graph.properties\n\xe2\x94\x82 \xe2\x94\x82 \xe2\x94\x82 remote-objects.yaml \nRun Code Online (Sandbox Code Playgroud)\nMain.java2023-05-08 10:52:10,722 [INFO] [c.d.o.d.i.c.ContactPoints.main] :: Contact point localhost:9042 resolves to multiple addresses, will use them all ([localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1])\nException in thread "main" java.lang.IllegalArgumentException: Could not instantiate implementation: org.janusgraph.diskstorage.cql.CQLStoreManager\n at org.janusgraph.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:79)\n at org.janusgraph.diskstorage.Backend.getImplementationClass(Backend.java:537)\n at org.janusgraph.diskstorage.Backend.getStorageManager(Backend.java:498)\n at org.janusgraph.graphdb.configuration.builder.GraphDatabaseConfigurationBuilder.build(GraphDatabaseConfigurationBuilder.java:64)\n at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:176)\n at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:147)\n at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:137)\n at org.janusgraph.core.JanusGraphFactory$Builder.open(JanusGraphFactory.java:277)\n at Main.main(Main.java:6)\nCaused by: java.lang.reflect.InvocationTargetException\n at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)\n at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)\n at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)\n at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)\n at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)\n at org.janusgraph.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:73)\n ... 8 more\nCaused by: java.lang.NoClassDefFoundError: com/datastax/oss/protocol/internal/SegmentCodec\n at com.datastax.oss.driver.internal.core.context.DefaultDriverContext.<init>(DefaultDriverContext.java:170)\n at com.datastax.oss.driver.api.core.session.SessionBuilder.buildContext(SessionBuilder.java:968)\n at com.datastax.oss.driver.api.core.session.SessionBuilder.buildDefaultSessionAsync(SessionBuilder.java:904)\n at com.datastax.oss.driver.api.core.session.SessionBuilder.buildAsync(SessionBuilder.java:817)\n at com.datastax.oss.driver.api.core.session.SessionBuilder.build(SessionBuilder.java:835)\n at org.janusgraph.diskstorage.cql.builder.CQLSessionBuilder.build(CQLSessionBuilder.java:81)\n at org.janusgraph.diskstorage.cql.CQLStoreManager.<init>(CQLStoreManager.java:137)\n at org.janusgraph.diskstorage.cql.CQLStoreManager.<init>(CQLStoreManager.java:118)\n ... 14 more\nCaused by: java.lang.ClassNotFoundException: com.datastax.oss.protocol.internal.SegmentCodec\n at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)\n at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)\n at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)\n ... 22 more\n\nProcess finished with exit code 1\nRun Code Online (Sandbox Code Playgroud)\nremote-graph.properties\xe2\x94\x82 pom.xml\n\xe2\x94\x82\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80src\n\xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80main\n\xe2\x94\x82 \xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80java\n\xe2\x94\x82 \xe2\x94\x82 \xe2\x94\x82 Main.java\n\xe2\x94\x82 \xe2\x94\x82 \xe2\x94\x82\n\xe2\x94\x82 \xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80resources\n\xe2\x94\x82 \xe2\x94\x82 \xe2\x94\x82 log4j2.xml\n\xe2\x94\x82 \xe2\x94\x82 \xe2\x94\x82\n\xe2\x94\x82 \xe2\x94\x82 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80conf\n\xe2\x94\x82 \xe2\x94\x82 \xe2\x94\x82 remote-graph.properties\n\xe2\x94\x82 \xe2\x94\x82 \xe2\x94\x82 remote-objects.yaml \nRun Code Online (Sandbox Code Playgroud)\nimport org.janusgraph.core.JanusGraph;\nimport org.janusgraph.core.JanusGraphFactory;\n\npublic class Main {\n public static void main(String[] args) {\n JanusGraph janusGraph = JanusGraphFactory.build().set("storage.backend", "cql").set("storage.hostname", "localhost:9042").open();\n janusGraph.close();\n }\n}\nRun Code Online (Sandbox Code Playgroud)\npom.xmlgremlin.remote.remoteConnectionClass=org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection\ngremlin.remote.driver.clusterFile=src/main/resources/conf/remote-objects.yaml\ngremlin.remote.driver.sourceName=g\nRun Code Online (Sandbox Code Playgroud)\njanusgraph-cql.properties# Copyright 2019 JanusGraph Authors\n#\n# Licensed under the Apache License, Version 2.0 (the "License");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an "AS IS" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n# JanusGraph configuration sample: Cassandra over a socket\n#\n# This file connects to a Cassandra daemon running on localhost via\n# CQL. Cassandra must already be started before starting JanusGraph\n# with this file.\n\n# The implementation of graph factory that will be used by gremlin server\n#\n# Default: org.janusgraph.core.JanusGraphFactory\n# Data Type: String\n# Mutability: LOCAL\ngremlin.graph=org.janusgraph.core.JanusGraphFactory\n\n# The primary persistence provider used by JanusGraph. This is required. \n# It should be set one of JanusGraph\'s built-in shorthand names for its\n# standard storage backends (shorthands: berkeleyje, cql, hbase, inmemory)\n# or to the full package and classname of a custom/third-party\n# StoreManager implementation.\n#\n# Default: (no default value)\n# Data Type: String\n# Mutability: LOCAL\nstorage.backend=cql\n\n# The hostname or comma-separated list of hostnames of storage backend\n# servers. This is only applicable to some storage backends, such as\n# cassandra and hbase.\n#\n# Default: 127.0.0.1\n# Data Type: class java.lang.String[]\n# Mutability: LOCAL\nstorage.hostname=127.0.0.1\n\n# The name of JanusGraph\'s keyspace. It will be created if it does not\n# exist.\n#\n# Default: janusgraph\n# Data Type: String\n# Mutability: LOCAL\nstorage.cql.keyspace=janusgraph\n\n# The name of the local or closest Cassandra datacenter. This value will\n# be passed into CqlSessionBuilder.withLocalDatacenter.\n#\n# Default: datacenter1\n# Data Type: String\n# Mutability: MASKABLE\nstorage.cql.local-datacenter=datacenter1\n\n# Whether to enable JanusGraph\'s database-level cache, which is shared\n# across all transactions. Enabling this option speeds up traversals by\n# holding hot graph elements in memory, but also increases the likelihood\n# of reading stale data. Disabling it forces each transaction to\n# independently fetch graph elements from storage before reading/writing\n# them.\n#\n# Default: false\n# Data Type: Boolean\n# Mutability: MASKABLE\ncache.db-cache = true\n\n# How long, in milliseconds, database-level cache will keep entries after\n# flushing them. This option is only useful on distributed storage\n# backends that are capable of acknowledging writes without necessarily\n# making them immediately visible.\n#\n# Default: 50\n# Data Type: Integer\n# Mutability: GLOBAL_OFFLINE\n#\n# Settings with mutability GLOBAL_OFFLINE are centrally managed in\n# JanusGraph\'s storage backend. After starting the database for the first\n# time, this file\'s copy of this setting is ignored. Use JanusGraph\'s\n# Management System to read or modify this value after bootstrapping.\ncache.db-cache-clean-wait = 20\n\n# Default expiration time, in milliseconds, for entries in the\n# database-level cache. Entries are evicted when they reach this age even\n# if the cache has room to spare. Set to 0 to disable expiration (cache\n# entries live forever or until memory pressure triggers eviction when set\n# to 0).\n#\n# Default: 10000\n# Data Type: Long\n# Mutability: GLOBAL_OFFLINE\n#\n# Settings with mutability GLOBAL_OFFLINE are centrally managed in\n# JanusGraph\'s storage backend. After starting the database for the first\n# time, this file\'s copy of this setting is ignored. Use JanusGraph\'s\n# Management System to read or modify this value after bootstrapping.\ncache.db-cache-time = 180000\n\n# Size of JanusGraph\'s database level cache. Values between 0 and 1 are\n# interpreted as a percentage of VM heap, while larger values are\n# interpreted as an absolute size in bytes.\n#\n# Default: 0.3\n# Data Type: Double\n# Mutability: MASKABLE\ncache.db-cache-size = 0.5\nRun Code Online (Sandbox Code Playgroud)\n已更新janusgraph-core并janusgraph-cql成为相同版本:1.0.0-20230504-014643.988c094。\n这仍然会产生相同的错误。
@李博轩 谢谢!这确实解决了我的问题!
\nDatastax.dse 似乎在添加后自行修复JanusGraph-CQL。\n我一直在尝试解决注销时的错误。而且,我没有想到现在要删除它们,因为出现了不同的错误日志。
看起来像是库冲突问题。不确定这是否能解决问题,但我的建议是:
janusgraph-core对和使用相同的版本janusgraph-cql。目前您正在使用不同的(可能是冲突的)版本。dse-java-driver-core依赖性。您需要的驱动程序作为 的依赖项包含在内janusgraph-cql。pom.xml
<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j2-impl</artifactId>
<version>2.20.0</version>
</dependency>
<dependency>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph-core</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.janusgraph</groupId>
<artifactId>janusgraph-cql</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
176 次 |
| 最近记录: |