Skip to content

[Question] 1.0 版无法使用mysql连接, 需要手动下载依赖 #2175

Closed

Description

@turkeymz

Bug Type (问题类型)

server status (启动/运行异常)

Before submit

  • 我已经确认现有的 Issues 与 FAQ 中没有相同 / 重复问题 (I have confirmed and searched that there are no similar problems in the historical issue and documents)

Environment (环境信息)

  • Server Version: 1.0.0 (Apache Release Version)
  • Backend: Mysql
  • OS: CentOS 7
  • Data Size: 初始化失败

Expected & Actual behavior (期望与实际表现)

使用1.0版本+mysql情况下,初始化环境失败。但配置基本从过去成功的0.12.0抄过来,请问新的1.0配置上是不是有修改?

backend=mysql
serializer=mysql
store=hugegraph

jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306
jdbc.username=root
jdbc.password=123456
jdbc.reconnect_max_times=3
jdbc.reconnect_interval=3
jdbc.sslmode=false
jdbc.connect_database=hugegraph
// 异常 info
Initializing HugeGraph Store...
2023-03-23 09:30:34 [main] [INFO] o.a.h.u.ConfigUtil - Scanning option 'graphs' directory './conf/graphs'
2023-03-23 09:30:34 [main] [INFO] o.a.h.c.InitStore - Init graph with config file: ./conf/graphs/hugegraph.properties
2023-03-23 09:30:34 [main] [WARN] o.a.h.c.HugeConfig - The config option 'jdbc.sslmode' is redundant, please ensure it has been registered
2023-03-23 09:30:34 [main] [WARN] o.a.h.c.HugeConfig - The config option 'jdbc.connect_database' is redundant, please ensure it has been registered
2023-03-23 09:30:34 [main] [INFO] o.a.h.b.s.m.MysqlSessions - Connect to the jdbc url: 'jdbc:mysql://localhost:3306/?socketTimeout=0&useSSL=false'
Exception in thread "main" java.lang.RuntimeException: GraphFactory could not instantiate this Graph implementation [class org.apache.hugegraph.HugeFactory]
	at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:84)
	at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:72)
	at org.apache.hugegraph.cmd.InitStore.initGraph(InitStore.java:96)
	at org.apache.hugegraph.cmd.InitStore.main(InitStore.java:80)
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:80)
	... 3 more
Caused by: org.apache.hugegraph.HugeException: Failed to open schema transaction
	at org.apache.hugegraph.StandardHugeGraph.openSchemaTransaction(StandardHugeGraph.java:436)
	at org.apache.hugegraph.StandardHugeGraph.access$2700(StandardHugeGraph.java:110)
	at org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction.getOrNewTransaction(StandardHugeGraph.java:1433)
	at org.apache.hugegraph.StandardHugeGraph$TinkerPopTransaction.doOpen(StandardHugeGraph.java:1342)
	at org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.open(AbstractTransaction.java:95)
	at org.apache.tinkerpop.gremlin.structure.Transaction$READ_WRITE_BEHAVIOR$1.accept(Transaction.java:213)
	at org.apache.tinkerpop.gremlin.structure.Transaction$READ_WRITE_BEHAVIOR$1.accept(Transaction.java:210)
	at org.apache.tinkerpop.gremlin.structure.util.AbstractThreadLocalTransaction.doReadWrite(AbstractThreadLocalTransaction.java:92)
	at org.apache.tinkerpop.gremlin.structure.util.AbstractTransaction.readWrite(AbstractTransaction.java:136)
	at org.apache.hugegraph.StandardHugeGraph.graphTransaction(StandardHugeGraph.java:506)
	at org.apache.hugegraph.StandardHugeGraph.backendStoreFeatures(StandardHugeGraph.java:253)
	at org.apache.hugegraph.StandardHugeGraph.<init>(StandardHugeGraph.java:213)
	at org.apache.hugegraph.HugeFactory.open(HugeFactory.java:88)
	at org.apache.hugegraph.HugeFactory.open(HugeFactory.java:66)
	... 8 more
Initialization finished.

Vertex/Edge example (问题点 / 边数据举例)

No response

Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)

No response

Activity

  1. changed the title [-][Bug] 1.0版本无法使用mysql连接[/-] [+][Question] 1.0 版无法使用mysql连接, 需要手动下载依赖[/+] on Mar 22, 2023
  2. imbajin commented on Mar 22, 2023

    @imbajin
    Member

    Due to mysql is under *GPL license, which is not compatible with Apache License indeed (GPL is strictly contagious)

    So we need download/copy mysql-connector-java*.jar to ./lib/ in server by ourselves like v8.0.30 (Apologize for lacking the relevant document before, could u submit a PR in doc repo? Thanks)

    image

    refer: https://mvnrepository.com/artifact/mysql/mysql-connector-java/8.0.30

  3. added
    dependenciesIncompatible dependencies of package
    docDocument expected
    and removed
    bugSomething isn't working
    on Mar 22, 2023
  4. turkeymz commented on Mar 22, 2023

    @turkeymz
    Author

    Due to mysql is under *GPL license, which is not compatible with Apache License indeed (GPL is strictly contagious)

    So we need download/copy mysql-connector-java*.jar by ourselves like v8.0.30 (Apologize for lacking the relevant document before, could u submit a PR in doc repo? Thanks)

    image

    refer: https://mvnrepository.com/artifact/mysql/mysql-connector-java/8.0.30

    不是的,看日志是生成的mysql连接是错误的。无法有效指定mysql的database

  5. imbajin commented on Mar 22, 2023

    @imbajin
    Member

    不是的,看日志是生成的 mysql 连接是错误的。无法有效指定 mysql 的 database

    But how could u get the mysql* jar in 1.0.0 now? (Or u just copy/download it by yourself?)

    @z7658329 could u help to ensure this problem?

  6. turkeymz commented on Mar 22, 2023

    @turkeymz
    Author

    不是的,看日志是生成的 mysql 连接是错误的。无法有效指定 mysql 的 database

    But how could u get the mysql* jar in 1.0.0 now? (Or u just copy/download it by yourself?)

    @z7658329 could u help to ensure this problem?

    我还没有导入那个什么jar,但从异常分析中看到:

    Connect to the jdbc url: 'jdbc:mysql://localhost:3306/?socketTimeout=0&useSSL=false'

    这看上去是从配置文件中jdbc.url+"/?socketTimeout=0&useSSL=false"。完全没有拼接数据库的意思。做过一下尝试,都无法有效的将拼出有效的数据库连接(jdbc:mysql://localhost:3306/{database}?socketTimeout=0&useSSL=false):

    1. 尝试过在url加上database
    2. 使用store
    3. 使用pgjdbc.connect_database

    正常来讲应该是jdbc.url+"/" + jdbc.database+"?socketTimeout=0&useSSL=false"

  7. imbajin commented on Mar 22, 2023

    @imbajin
    Member

    because the first time u init/connect to the mysql, we don't have exist database, so we need execute createDatabase() first, then u can connect to the specified database after init done 🔢

    And u could:

    1. check/grep the log(Connect to the jdbc url: xxx) in the old version to see the differ (when init graph)
    2. check if lib/*mysql-connector*.jar exist in the old version, if yes, try to copy it in 1.0.0 and retry

    some refer:

    https://github.com/apache/incubator-hugegraph/blob/9e4fb9647e76d8967c89056a33efa7d806bdd4de/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSessions.java#L111

    https://github.com/apache/incubator-hugegraph/blob/9e4fb9647e76d8967c89056a33efa7d806bdd4de/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSessions.java#L189

    https://github.com/apache/incubator-hugegraph/blob/9e4fb9647e76d8967c89056a33efa7d806bdd4de/hugegraph-mysql/src/main/java/org/apache/hugegraph/backend/store/mysql/MysqlSessions.java#L264

  8. JackyYangPassion commented on Apr 11, 2023

    @JackyYangPassion
    Contributor

    Due to mysql is under *GPL license, which is not compatible with Apache License indeed (GPL is strictly contagious)

    So we need download/copy mysql-connector-java*.jar to ./lib/ in server by ourselves like v8.0.30 (Apologize for lacking the relevant document before, could u submit a PR in doc repo? Thanks)

    after download mysql-connector-java-8.0.30.jar and cp jar to 1.0.0 lib

    ./bin/init-store.sh  
    

    running success!

  9. JackyYangPassion commented on Apr 11, 2023

    @JackyYangPassion
    Contributor

    不是的,看日志是生成的 mysql 连接是错误的。无法有效指定 mysql 的 database

    But how could u get the mysql* jar in 1.0.0 now? (Or u just copy/download it by yourself?)
    @z7658329 could u help to ensure this problem?

    我还没有导入那个什么jar,但从异常分析中看到:

    Connect to the jdbc url: 'jdbc:mysql://localhost:3306/?socketTimeout=0&useSSL=false'

    这看上去是从配置文件中jdbc.url+"/?socketTimeout=0&useSSL=false"。完全没有拼接数据库的意思。做过一下尝试,都无法有效的将拼出有效的数据库连接(jdbc:mysql://localhost:3306/{database}?socketTimeout=0&useSSL=false):

    1. 尝试过在url加上database
    2. 使用store
    3. 使用pgjdbc.connect_database

    正常来讲应该是jdbc.url+"/" + jdbc.database+"?socketTimeout=0&useSSL=false"

    You can try the operation process above cc @turkeymz

  10. turkeymz commented on Apr 12, 2023

    @turkeymz
    Author

    You can try the operation process above cc

    Thanks so much, will using this solution and update the status.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

apachedependenciesIncompatible dependencies of packagedocDocument expectedmysql

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions