Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.1.1 -> 1.2.1 upgrade issue: java.lang.NoClassDefFoundError #147

Closed
lululombard opened this issue Aug 1, 2022 · 2 comments
Closed

1.1.1 -> 1.2.1 upgrade issue: java.lang.NoClassDefFoundError #147

lululombard opened this issue Aug 1, 2022 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@lululombard
Copy link

lululombard commented Aug 1, 2022

Hello!

I'm trying to upgrade from Lingua 1.1.1 to 1.2.1, but I get the following exception after the upgrade:

java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError
        at java.util.concurrent.ForkJoinTask.reportExecutionException(ForkJoinTask.java:605) ~[?:?]
        at java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:981) ~[?:?]
        at com.github.pemistahl.lingua.api.LanguageDetector.computeLanguageConfidenceValues(LanguageDetector.kt:160) ~[?:?]
        at com.github.pemistahl.lingua.api.LanguageDetector.detectLanguageOf(LanguageDetector.kt:72) ~[?:?]
        at org.redcraft.redcraftchat.detection.services.Lingua.getLanguage(Lingua.java:39) ~[?:?]
        at org.redcraft.redcraftchat.detection.DetectionManager.getLanguage(DetectionManager.java:14) ~[?:?]
        at org.redcraft.redcraftchat.translate.TranslationManager.getSourceLanguage(TranslationManager.java:84) ~[?:?]
        at org.redcraft.redcraftchat.bridge.MinecraftDiscordBridge.broadcastMessage(MinecraftDiscordBridge.java:107) ~[?:?]
        at org.redcraft.redcraftchat.bridge.MinecraftDiscordBridge.broadcastMessage(MinecraftDiscordBridge.java:89) ~[?:?]
        at org.redcraft.redcraftchat.runnables.MinecraftServerStatusWatcherTask.handleServerStatusChange(MinecraftServerStatusWatcherTask.java:51) ~[?:?]
        at org.redcraft.redcraftchat.runnables.MinecraftServerStatusWatcherTask.run(MinecraftServerStatusWatcherTask.java:60) ~[?:?]
        at net.md_5.bungee.scheduler.BungeeTask.run(BungeeTask.java:66) ~[server.jar:git:Waterfall-Bootstrap:1.19-R0.1-SNAPSHOT:42d9c68:500]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.NoClassDefFoundError
        at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[?:?]
        at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
        at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[?:?]
        at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:564) ~[?:?]
        at java.util.concurrent.ForkJoinTask.reportExecutionException(ForkJoinTask.java:604) ~[?:?]
        ... 14 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.github.pemistahl.lingua.internal.TrainingDataLanguageModel
        at com.github.pemistahl.lingua.api.LanguageDetector$Companion.loadLanguageModel(LanguageDetector.kt:531) ~[?:?]
        at com.github.pemistahl.lingua.api.LanguageDetector$Companion.loadLanguageModels(LanguageDetector.kt:520) ~[?:?]
        at com.github.pemistahl.lingua.api.LanguageDetector$Companion.access$loadLanguageModels(LanguageDetector.kt:501) ~[?:?]
        at com.github.pemistahl.lingua.api.LanguageDetector.lookUpNgramProbability-as5wtIs$lingua(LanguageDetector.kt:467) ~[?:?]
        at com.github.pemistahl.lingua.api.LanguageDetector.computeSumOfNgramProbabilities$lingua(LanguageDetector.kt:442) ~[?:?]
        at com.github.pemistahl.lingua.api.LanguageDetector.computeLanguageProbabilities$lingua(LanguageDetector.kt:429) ~[?:?]
        at com.github.pemistahl.lingua.api.LanguageDetector.computeLanguageConfidenceValues$lambda-4$lambda-3(LanguageDetector.kt:142) ~[?:?]
        at java.util.concurrent.ForkJoinTask$AdaptedInterruptibleCallable.exec(ForkJoinTask.java:1461) ~[?:?]
        at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?]
        at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?]
        at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?]
        at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?]
        at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?]

Here's my implementation of Lingua in my project: https://github.com/redcraft-org/RedCraftChat/blob/feature/first-release/src/main/java/org/redcraft/redcraftchat/detection/services/Lingua.java
And here's my pom.xml (I probably reverted the Lingua version now, but otherwise everything else is the same): https://github.com/redcraft-org/RedCraftChat/blob/feature/first-release/pom.xml

I'm running OpenJDK 17 and I include Lingua in my project using Maven, any idea what could cause this? Lingua 1.1.1 was working fine (except for some memory usage issues that 1.2.x seems to have fixed, but I can't get it to run). I tried mvn clean but nothing changed.

Any ideas?

Thanks!

@pemistahl pemistahl changed the title 1.1.1 -> 1.2.1 upgrade issue: java.lang.NoClassDefFoundError: Could not initialize class com.github.pemistahl.lingua.internal.TrainingDataLanguageModel 1.1.1 -> 1.2.1 upgrade issue: java.lang.NoClassDefFoundError Aug 2, 2022
@pemistahl pemistahl added the bug Something isn't working label Aug 2, 2022
@pemistahl pemistahl added this to the Lingua 1.2.2 milestone Aug 2, 2022
@pemistahl
Copy link
Owner

Hi @lululombard, I think this is the same problem as in #144. Its cause is a bug in the Moshi JSON serialization library which I introduced in Lingua 1.2. I've just fixed it so I think this will resolve your problems, too. I'm going to release Lingua 1.2.2 soon which includes this fix.

@lululombard
Copy link
Author

Thanks a lot, @pemistahl!

Lingua 1.2.2 totally fixed the issue including the memory issues I had with 1.1.x

Long live Lingua!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants