ODL-yang-parser Could not deserialize ATN with version 3 (expected 4)

832 Views Asked by At

I upgraded my springboot application to springboot 3.

I see that hibernate uses the antlr version 4.10.1. But is have another dependency in my code called odl-yangtools-yang-parser which uses antlr version 4.7.1.

When I try to run my application and use the yang parser, I get the following exception

Caused by: java.lang.UnsupportedOperationException: java.io.InvalidClassException: org.antlr.v4.runtime.atn.ATN; Could not deserialize ATN with version 3 (expected 4).
at org.antlr.v4.runtime.atn.ATNDeserializer.deserialize(ATNDeserializer.java:56) ~[antlr4-runtime-4.10.1.jar!/:4.10.1]
at org.antlr.v4.runtime.atn.ATNDeserializer.deserialize(ATNDeserializer.java:48) ~[antlr4-runtime-4.10.1.jar!/:4.10.1]
at org.opendaylight.yangtools.antlrv4.code.gen.YangStatementLexer.<clinit>(YangStatementLexer.java:154) ~[yang-parser-impl-1.2.3.jar!/:?]
... 333 more
Caused by: java.io.InvalidClassException: org.antlr.v4.runtime.atn.ATN; Could not deserialize ATN with version 3 (expected 4).
at org.antlr.v4.runtime.atn.ATNDeserializer.deserialize(ATNDeserializer.java:56) ~[antlr4-runtime-4.10.1.jar!/:4.10.1]
at org.antlr.v4.runtime.atn.ATNDeserializer.deserialize(ATNDeserializer.java:48) ~[antlr4-runtime-4.10.1.jar!/:4.10.1]
at org.opendaylight.yangtools.antlrv4.code.gen.YangStatementLexer.<clinit>(YangStatementLexer.java:154) ~[yang-parser-impl-1.2.3.jar!/:?]
... 333 more

enter image description here

Is there a way to have both dependencies to suffice both cases?

Or is there any way to downgrade hibernate which uses 4.7.1 version of antlr4-runtime in springboot 3.

Please advice.

1

There are 1 best solutions below

0
manjosh On

I downgraded the hibernate and it is working fine with my old old parser implementation.

Here is my pom.xml change

<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-logging</artifactId>
            </exclusion>
            <exclusion>
                <artifactId>hibernate-commons-annotations</artifactId>
                <groupId>org.hibernate.common</groupId>
            </exclusion>
            <exclusion>
                <artifactId>spring-data-jpa</artifactId>
                <groupId>org.springframework.data</groupId>
            </exclusion>
            <exclusion>
                <artifactId>hibernate-core</artifactId>
                <groupId>org.hibernate.orm</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-jpa</artifactId>
        <version>3.0.10</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate.orm</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>6.0.0.Final</version>
    </dependency>