首页 > 其他分享 >ANTLR Tool version 4.13.1 used for code generation does not match the current runtime version 4.7.2

ANTLR Tool version 4.13.1 used for code generation does not match the current runtime version 4.7.2

时间:2024-09-20 17:35:56浏览次数:1  
标签:4.13 code java APOC version org neo4j runtime

ANTLR Tool version 4.13.1 used for code generation does not match the current runtime version 4.7.2

当我使用neo4j过程中,遇到了该问题:

ANTLR Tool version 4.13.1 used for code generation does not match the current runtime version 4.7.2ANTLR Runtime version 4.13.1 used for parser compilation does not match the current runtime version 4.7.2Exception

该问题是因为我使用了neo4j-5.23.0apoc-4.4.0.31-all.jar, 经过设置当我再重启 neo4j 时遇到的,这会导致neo4j-5.23.0 启动失败,具体信息如下:

 Changed password for user 'neo4j'. IMPORTANT: this change will only take effect if performed before the database is started for the first time.
  Logging config in use: File '/var/lib/neo4j/conf/user-logs.xml'
  INFO  Starting...
  INFO  This instance is ServerId{e3a155a0} (e3a155a0-30e3-4c1a-b886-00fd12321f2b)
 ANTLR Tool version 4.13.1 used for code generation does not match the current runtime version 4.7.2ANTLR Runtime version 4.13.1 used for parser compilation does not match the current runtime version 4.7.2Exception in thread "main" java.lang.ExceptionInInitializerError
     at org.neo4j.cypher.internal.parser.v5.ast.factory.Cypher5AstParser.newLexer(Cypher5AstParser.scala:50)
     at org.neo4j.cypher.internal.parser.ast.AntlrAstParser.preparsedTokens(AntlrAstParser.scala:107)
     at org.neo4j.cypher.internal.parser.ast.AntlrAstParser.parse(AntlrAstParser.scala:45)
     at org.neo4j.cypher.internal.parser.ast.AntlrAstParser.parse$(AntlrAstParser.scala:43)
     at org.neo4j.cypher.internal.parser.v5.ast.factory.Cypher5AstParser.parse(Cypher5AstParser.scala:34)
     at org.neo4j.cypher.internal.parser.v5.ast.factory.Cypher5AstParser.expression(Cypher5AstParser.scala:41)
     at org.neo4j.cypher.internal.evaluator.SimpleInternalExpressionEvaluator$ExpressionParser$.parse(SimpleInternalExpressionEvaluator.scala:159)
     at org.neo4j.cypher.internal.evaluator.SimpleInternalExpressionEvaluator.$anonfun$evaluate$1(SimpleInternalExpressionEvaluator.scala:70)
     at org.neo4j.cypher.internal.evaluator.SimpleInternalExpressionEvaluator.errorContext(SimpleInternalExpressionEvaluator.scala:83)
     at org.neo4j.cypher.internal.evaluator.SimpleInternalExpressionEvaluator.evaluate(SimpleInternalExpressionEvaluator.scala:69)
     at org.neo4j.cypher.internal.evaluator.SimpleExpressionEvaluator.evaluate(SimpleExpressionEvaluator.java:43)
     at org.neo4j.procedure.impl.MapConverter.apply(MapConverter.java:41)
     at org.neo4j.procedure.impl.MapConverter.apply(MapConverter.java:30)
     at org.neo4j.procedure.impl.TypeCheckers$DefaultValueConverter.defaultValue(TypeCheckers.java:282)
     at org.neo4j.procedure.impl.MethodSignatureCompiler.signatureFor(MethodSignatureCompiler.java:83)
     at org.neo4j.procedure.impl.ProcedureCompiler.compileProcedure(ProcedureCompiler.java:272)
     at org.neo4j.procedure.impl.ProcedureCompiler.compileProcedure(ProcedureCompiler.java:243)
     at org.neo4j.procedure.impl.ProcedureCompiler.compileProcedure(ProcedureCompiler.java:358)
     at org.neo4j.procedure.impl.GlobalProceduresRegistry$BulkRegistration.registerProcedure(GlobalProceduresRegistry.java:320)
     at org.neo4j.graphdb.factory.module.edition.AbstractEditionModule.registerProcedures(AbstractEditionModule.java:96)
     at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.lambda$setupProcedures$7(DatabaseManagementServiceFactory.java:404)
     at org.neo4j.graphdb.factory.module.edition.AbstractEditionModule.tryResolveOrCreate(AbstractEditionModule.java:221)
     at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.setupProcedures(DatabaseManagementServiceFactory.java:414)
     at org.neo4j.graphdb.facade.DatabaseManagementServiceFactory.build(DatabaseManagementServiceFactory.java:177)
     at org.neo4j.server.CommunityBootstrapper.createNeo(CommunityBootstrapper.java:38)
     at org.neo4j.server.NeoBootstrapper.start(NeoBootstrapper.java:184)
     at org.neo4j.server.NeoBootstrapper.start(NeoBootstrapper.java:99)
     at org.neo4j.server.CommunityEntryPoint.main(CommunityEntryPoint.java:30)
 Caused by: java.lang.UnsupportedOperationException: java.io.InvalidClassException: org.antlr.v4.runtime.atn.ATN; Could not deserialize ATN with version 4 (expected 3).
     at org.antlr.v4.runtime.atn.ATNDeserializer.deserialize(ATNDeserializer.java:187)
     at org.neo4j.cypher.internal.parser.v5.Cypher5Lexer.<clinit>(Cypher5Lexer.java:3154)
     ... 28 more
 Caused by: java.io.InvalidClassException: org.antlr.v4.runtime.atn.ATN; Could not deserialize ATN with version 4 (expected 3).
     ... 30 more
 INFO  Neo4j Server shutdown initiated by request
 INFO  Stopped.

这个问题的解答在2. 使用适合版本neo4j安装AOPC插件.

在说这个问题的解答之前,我先说一下更前面的一个问题.

ValueError: Could not use APOC procedures. Please ensure the APOC plugin is installed in Neo4j and that 'apoc.meta.data()' is allowed in Neo4j configuration

1. 在neo4j上安装APOC插件

**ValueError**: Could not use APOC procedures. Please ensure the APOC plugin is installed in Neo4j and that 'apoc.meta.data()' is allowed in Neo4j configuration

刚才这个错误提示我们需要在Neo4j上安装APOC (Awesome Procedures On Cypher) 程序.

因为我们已经通过docker启用了neo4j-523容器,于是接下来需要将APOC作为插件安装到neo4j-5.23.0对应版本的容器即可.

1.1 下载并安装APOC插件

Neo4j APOC GitHub repository 上下载最新版本的apoc-4.4.0.31-all.jar,并将其放置到neo4jplugins 目录下.

1.2 配置并启用APOC程序

我们只需执行两步, 第一步编辑 conf/neo4j.conf文件填入下面两行配置:

  1. dbms.security.procedures.unrestricted=apoc.*
    dbms.security.procedures.allowlist=apoc.meta.data
    
  2. 重启 Neo4j:

    docker restart neo4j-523
    

通过这些步骤,我们确实可以消除 ValueError 并且正确启动 Neo4jGraph 类.不过,我们又遇到了最开始的问题.

2. 使用适合版本neo4j安装AOPC插件

ANTLR Tool version 4.13.1 used for code generation does not match the current runtime version 4.7.2ANTLR Runtime version 4.13.1 used for parser compilation does not match the current runtime version 4.7.2Exception

仔细分析不难得知这是一个版本冲突问题,要解决这个问题,还得从版本上着手.幸运的是,仔细阅读 AOPC官方文档,我们可以找到一个对应版本关系:

这是 neo4j-apoc-procedures所支持的对应版本关系表:

apoc version neo4j version
4.4.0.1 4.4.0 (4.3.x)
4.3.0.4 4.3.7 (4.3.x)
4.2.0.9 4.2.11 (4.2.x)
4.1.0.10 4.1.11 (4.1.x)
4.0.0.18 4.0.12 (4.0.x)
3.5.0.15 3.5.30 (3.5.x)
3.4.0.8 3.4.18 (3.4.x)
3.3.0.4 3.3.9 (3.3.x)
3.2.3.6 3.2.14 (3.2.x)
3.1.3.9 3.1.9 (3.1.x)
3.0.8.6 3.0.12 (3.0.x)
3.5.0.0 3.5.0-beta01
3.4.0.2 3.4.5
3.3.0.3 3.3.5
3.2.3.5 3.2.3
3.1.3.8 3.1.5

根据该表,我们可以使用4.4.0版本的neo4j以及下载对应的APOC程序文件apoc-4.4.0.1-all.jar.

2.1 安装4.4.0版本neo4j

  1. 我们先下载对应镜像, 这里我们下载4.4社区版.

    docker pull neo4j:4.4-community
    
  2. 创建并启动镜像:

    docker run -d \
        --name=neo4j-44 \
        --publish=7474:7474 --publish=7687:7687 \
        --env NEO4J_AUTH=neo4j/neo4j123 \
        --volume=/home/lunyu/neo4j/data:/data \
        neo4j:4.4-community
    

这时名为neo4j-44的容器已启动.

2.2 下载并安装APOC插件

我们将4.4.0.1版本的APOC插件下载下来,并将其放置到neo4jplugins 目录下.

2.3 配置并启用APOC程序

我们只需执行两步, 第一步编辑 conf/neo4j.conf文件填入下面两行配置:

  1. dbms.security.procedures.unrestricted=apoc.*
    dbms.security.procedures.allowlist=apoc.meta.data
    
  2. 重启 Neo4j:

    docker restart neo4j-44
    

经过这些步骤,ANTLR工具版本冲突问题得以解决。

标签:4.13,code,java,APOC,version,org,neo4j,runtime
From: https://www.cnblogs.com/lunyu/p/18422916

相关文章

  • 我在 Marscode 用了 3 天,转行成为 Python 程序员
    以下是「 豆包MarsCode 体验官」优秀文章,作者不惑_。豆包MarsCode 项目实战Java程序员转行Python学习之路俗话说:工欲善其事,必先利其器。在历史的长河中,新手程序员最大的痛点之一就是搭建开发环境。先就是今天,如果你没有VSCode,甚至也没有其他IDE,那么也没有关系。豆包......
  • 闯关leetcode——58. Length of Last Word
    大纲题目地址内容解题代码地址题目地址https://leetcode.com/problems/length-of-last-word/description/内容Givenastringsconsistingofwordsandspaces,returnthelengthofthelastwordinthestring.Awordisamaximalsubstringconsisting......
  • Educational Codeforces Round 135 (Rated for Div. 2)D. Letter Picking
    注意读题,每次拿完之后是放在开头。所以先手不败,因为最后剩下两个的时候,先手一定可以取较小值。考虑怎样会出现平局?首先已经知道了先手不败,那么对于后手来说,他追求的就是平局,也就是尽可能的保证每一步都都与先手相同。所以,如果是回文串,或者两两相同,或者回文串包两两相同的情况,才......
  • VSCode 定义Java类注释
    在使用VSCode开发Java时,输入/**生成的类注释如下:/****/这样的注释一片空白,无法标注类的作者、创建时间等信息。可以通过如下设置实现更贴合Java类的注释:进入Java配置输入settings.json​ 选择Preferences:OpenUserSettings(JSON)添加Java配......
  • VSCode 定义代码模板
    在使用编写代码的过程中,经常会写一些固定代码段。以Java为例,定义实体类时一般都会编写序列化版本号:@SerialprivatestaticfinallongserialVersionUID=1L;这段代码是固定写法,基本不会变,如果每次都手写的话,就比较繁琐了。VSCode提供了生成代码段的功能,为我们提供了便......
  • Educational Codeforces Round 136 (Rated for Div. 2) D. Reset K Edges
    这道题目我们可以考虑二分做,二分出最终的深度,然后尝试是否能使用不超过\(k\)次操作使得深度符合条件。考虑如何和判断,我们可以从根节点开始搜索,如果当前点的深度为\(mid+1\),就对当前点进行操作。但很可惜,这种贪心方法可以很容易的举出反例,比如深度为\(mid\)的点下面有很多个叶......
  • VSCode配置STM32HAL库开发环境
    1.开发工具下载下载STM32CubeMX:https://www.st.com.cn/zh/development-tools/stm32cubemx.html(可通过访客方式下载)安装时一直默认即可下载stm32固件库:在线下载方式(需要登陆):安装好STM32CubeMX后,在菜单栏【Help】->【ManageEmbeddedSoftwarePackages】里选择合适的固......
  • 每日一题:Leetcode-347 前K个高频元素
    力扣题目解题思路java代码力扣题目:给你一个整数数组 nums 和一个整数 k ,请你返回其中出现频率前 k 高的元素。你可以按 任意顺序 返回答案。示例1:输入:nums=[1,1,1,2,2,3],k=2输出:[1,2]示例2:输入:nums=[1],k=1输出:[1]提示:1<=nu......
  • 关于codepage
    codepage就是各国的文字编码和Unicode之间的映射表。系统使用映射表就可以在各种编码中做转换。查表以gbk为例,它的codepage=936,可以从ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP936.TXT下载映射表。“中”字的映射为验证https://www.toolhelper.c......
  • 代码随想录算法训练营第十六天 | Javascript | 力扣Leetcode | 回溯 | 77. 组合、216.
    目录前言简介题目链接:77.组合题目链接:216.组合总和3题目链接:17.电话号码的字母组合前言踏平坎坷成大道,斗罢艰险又出发!自律的尽头是自控,自控的尽头是硬控。愿道友们披荆斩棘,终能得偿所愿。简介本人是小几年经验的前端开发,算法基础只有力扣几十道题,非常薄......