You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm upgrading a code base that uses cqengine to Jakarta EE 9.0. It uses Hibernate, and that uses ANTLR 4.10.1. This causes problems for CQEngine like this:
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)
at org.antlr.v4.runtime.atn.ATNDeserializer.deserialize(ATNDeserializer.java:48)
at com.googlecode.cqengine.query.parser.sql.grammar.SQLGrammarLexer.<clinit>(SQLGrammarLexer.java:809)
... 126 more
Caused by: java.io.InvalidClassException: org.antlr.v4.runtime.atn.ATN; Could not deserialize ATN with version 3 (expected 4).
... 129 more
We also get warnings like this:
ANTLR Tool version 4.7 used for code generation does not match the current runtime version 4.10.1
ANTLR Runtime version 4.7.2 used for parser compilation does not match the current runtime version 4.10.1
@npgall to give a bit of background. Because of this change in Hibernate hibernate/hibernate-orm#4975 - people that use Hibernate 6.0.1 and up cannot use cqengine. The change I made and that you merged is super simple, it would really mean a lot if a new release could be cut.
Sorry again for the delay on this. I had a new baby, which has reduced my free time! But I should have some time this week and next to work on this.
In the meantime, you should be able to work around this - or any situation where CQEngine's own dependencies conflict with other dependencies needed by the application - by using the CQEngine "shaded" jar instead of the regular jar.
The shaded jar bundles the CQEngine classes and all of CQEngine's own dependencies into a single jar. The classes from CQEngine's dependencies are then relocated to a different Java package name which is prefixed with com.googlecode.cqengine.lib.
This will allow CQEngine to use its own version of Antlr while the application uses a different version.
Something like this in your pom.xml should work:
<dependency>
<!-- Add a dependency on CQEngine's shaded jar instead of regular jar, and exclude all of CQEngine's transitive dependencies -->
<groupId>com.googlecode.cqengine</groupId>
<artifactId>cqengine</artifactId>
<version>x.x.x</version>
<classifier>all</classifier>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
Let me know if that works, or if you have any problems with it.
@npgall, informing you that the suggested workaround of using shaded version of cqengine indeed works (obviously at the cost of a bigger distribution).
@npgall , I noticed that this project hasn't been updated in a couple years, any chance we will see this release happen or should I suggest that the upstream i am using (apereo CAS) switch to some other API (given that they also depend on hibernate)?
Activity
npgall#307 - add support for ANLTR 4.10.1
npgall commentedon Nov 2, 2022
Thank you for this PR! I am planning to take some time to prepare a CQEngine release in the next few weeks, and will include this.
jvissers commentedon Nov 2, 2022
That's great news! Really looking forward to it.
jvissers commentedon Dec 20, 2022
Gentle reminder/question: any projection on when a new version of CQEngine will be cut that fixes this issue?
#307 - add support for ANLTR 4.10.1 (#308)
npgall commentedon Dec 23, 2022
I am working on CQEngine today, and hopefully will get some more time to cut a release over the holidays.
I have merged your pull request. Thank you very much! It will be included in the next release.
I will keep this issue open though until I have actually made that release.
jvissers commentedon Dec 25, 2022
Thanks a lot! 🎄
jvissers commentedon Jan 24, 2023
@npgall is there something I can help you with, to get a new release cut?
jvissers commentedon Feb 3, 2023
@npgall to give a bit of background. Because of this change in Hibernate hibernate/hibernate-orm#4975 - people that use Hibernate 6.0.1 and up cannot use cqengine. The change I made and that you merged is super simple, it would really mean a lot if a new release could be cut.
Thanks.
akarnok commentedon Feb 9, 2023
@npgall When do you plan to release the new version of CQEngine?
npgall commentedon Feb 20, 2023
Sorry again for the delay on this. I had a new baby, which has reduced my free time! But I should have some time this week and next to work on this.
In the meantime, you should be able to work around this - or any situation where CQEngine's own dependencies conflict with other dependencies needed by the application - by using the CQEngine "shaded" jar instead of the regular jar.
The shaded jar bundles the CQEngine classes and all of CQEngine's own dependencies into a single jar. The classes from CQEngine's dependencies are then relocated to a different Java package name which is prefixed with
com.googlecode.cqengine.lib.This will allow CQEngine to use its own version of Antlr while the application uses a different version.
Something like this in your
pom.xmlshould work:Let me know if that works, or if you have any problems with it.
jvissers commentedon Feb 20, 2023
First of all: congrats on the new arrival! Hope all is well and you and your family can enjoy this time.
Second: Thanks for informing us about this possible work-around. I'll try it out as soon as possible and let you know when I get stuck.
jvissers commentedon Mar 9, 2023
@npgall, informing you that the suggested workaround of using shaded version of cqengine indeed works (obviously at the cost of a bigger distribution).
npgall commentedon Apr 7, 2023
Thanks for the update Jan. Hoping to make a new release soon.
lucastheisen commentedon Dec 27, 2024
@npgall , I noticed that this project hasn't been updated in a couple years, any chance we will see this release happen or should I suggest that the upstream i am using (apereo CAS) switch to some other API (given that they also depend on hibernate)?