dialogos-project / dialogos

The DialogOS dialog system.
https://www.dialogos.app
GNU General Public License v3.0
21 stars 8 forks source link

Recent Java versions #207

Closed alexanderkoller closed 4 years ago

alexanderkoller commented 4 years ago

DialogOS does not seem to work with recent Java versions. Here is the error that I get with Java version "12" 2019-03-19 on MacOS.

My guess is that both our own code and MaryTTS use reflection in a way that is not supported by Java >= 9.

Do others have the same problem? Then we should fix this.

dhcp104-201:dialogos koller$ ./gradlew run

> Task :run
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.clt.dialogos.DialogOS (file:/Users/koller/Documents/workspace/dialogos/dialogos/Diamant/build/libs/Diamant-2.1.4-SNAPSHOT.jar) to field java.nio.charset.Charset.defaultCharset
WARNING: Please consider reporting this to the maintainers of com.clt.dialogos.DialogOS
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2020-01-28 18:41:06.088 java[89904:5193678] ApplePersistence=YES
marytts.exceptions.MaryConfigurationException: Cannot start MARY server
        at marytts.LocalMaryInterface.<init>(LocalMaryInterface.java:66)
        at de.saar.coli.dialogos.marytts.MaryTTS.<init>(MaryTTS.java:57)
        at de.saar.coli.dialogos.marytts.plugin.Plugin$MaryHolder.<clinit>(Plugin.java:91)
        at de.saar.coli.dialogos.marytts.plugin.Plugin.getSynthesizer(Plugin.java:98)
        at de.saar.coli.dialogos.marytts.plugin.Plugin.initialize(Plugin.java:29)
        at com.clt.dialogos.plugin.PluginLoader.loadPlugins(PluginLoader.java:41)
        at com.clt.dialogos.DialogOS.run(DialogOS.java:146)
        at com.clt.dialogos.DialogOS.main(DialogOS.java:108)
Caused by: java.lang.StringIndexOutOfBoundsException: begin 0, end 3, length 2
        at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3410)
        at java.base/java.lang.String.substring(String.java:1883)
        at marytts.server.EnvironmentChecks.check(EnvironmentChecks.java:46)
        at marytts.server.Mary.startup(Mary.java:286)
        at marytts.server.Mary.startup(Mary.java:204)
        at marytts.util.MaryRuntimeUtils.ensureMaryStarted(MaryRuntimeUtils.java:72)
        at marytts.LocalMaryInterface.<init>(LocalMaryInterface.java:64)
        ... 7 more
Exception in thread "main" java.lang.ExceptionInInitializerError
        at de.saar.coli.dialogos.marytts.plugin.Plugin.getSynthesizer(Plugin.java:98)
        at de.saar.coli.dialogos.marytts.plugin.Plugin.initialize(Plugin.java:29)
        at com.clt.dialogos.plugin.PluginLoader.loadPlugins(PluginLoader.java:41)
        at com.clt.dialogos.DialogOS.run(DialogOS.java:146)
        at com.clt.dialogos.DialogOS.main(DialogOS.java:108)
Caused by: java.lang.NullPointerException
        at de.saar.coli.dialogos.marytts.MaryTTS.getMaryVoices(MaryTTS.java:218)
        at de.saar.coli.dialogos.marytts.MaryTTS.initProperties(MaryTTS.java:66)
        at de.saar.coli.dialogos.marytts.MaryTTS.<init>(MaryTTS.java:61)
        at de.saar.coli.dialogos.marytts.plugin.Plugin$MaryHolder.<clinit>(Plugin.java:91)
        ... 5 more
timobaumann commented 4 years ago

it's the classloading and I believe it's >9 but yes.

alexanderkoller commented 4 years ago

@akoehn This may be more urgent than we think: Up-to-date versions of JEP do not work with Java 8.

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: jep/Run has been compiled by a more recent version of the Java Runtime (class file version 56.0), this version of the Java Runtime only recognizes class file versions up to 52.0
timobaumann commented 4 years ago

pro-tip: set your JAVA_HOME to something java-8 based but use java-11 binary...

The issue is with how MaryTTS, I wonder if there's a bug filed against that.

alexanderkoller commented 4 years ago

I just checked the MaryTTS issues, and the problem is not with reflection or classloading, it is with the way Java reports version strings. They have fixed the issue; now let's find out when they can make a new release.

alexanderkoller commented 4 years ago

More specifically, our issue is mentioned here.

alexanderkoller commented 4 years ago

See #208 for the rest of the "reflection" problems.

timobaumann commented 4 years ago

try something like this to avoid the issue with Jampack (and to avoid pulling in 5.2 via the voices -- I just fixed this for one voice but should work for all; make sure to pull in lang-en explicitly and exclude it from voices for English):

diff --git a/plugins/DialogOS_MaryTTSPlugin/build.gradle b/plugins/DialogOS_MaryTTSPlugin/build.gradle
index f6eed86..248a014 100644
--- a/plugins/DialogOS_MaryTTSPlugin/build.gradle
+++ b/plugins/DialogOS_MaryTTSPlugin/build.gradle
@@ -5,7 +5,21 @@ dependencies {
   implementation project(':com.clt.xml')
   implementation project(':com.clt.script')

-  implementation group: 'de.dfki.mary', name: 'voice-dfki-prudence-hsmm', version: '5.2'
+  implementation 'gov.nist.math:Jampack:1.0'
+  implementation('com.github.marytts.marytts:marytts-runtime:1df2faf45a') {
+    exclude group: 'com.github.marytts.marytts', module: 'Jampack'
+  }
+  implementation('com.github.marytts.marytts:marytts-lang-de:1df2faf45a') {
+    exclude group: 'com.github.marytts.marytts', module: 'Jampack'
+    exclude group: 'de.dfki.mary', module: 'marytts-runtime'
+  }
+  implementation(group: 'de.dfki.mary', name: 'voice-bits1-hsmm', version: '5.2') {       //Deutsch,weiblich
+    exclude group: 'de.dfki.mary', module: 'marytts-lang-de'
+    exclude group: 'de.dfki.mary', module: 'marytts-runtime'
+  }
+//  implementation group: 'de.dfki.mary', name: 'voice-bits3-hsmm', version: '5.2'       //Deutsch,männlich
+
+/*  implementation group: 'de.dfki.mary', name: 'voice-dfki-prudence-hsmm', version: '5.2'
   implementation group: 'de.dfki.mary', name: 'voice-dfki-obadiah-hsmm', version: '5.2'
   implementation group: 'de.dfki.mary', name: 'voice-dfki-spike-hsmm', version: '5.2'
   implementation group: 'de.dfki.mary', name: 'voice-dfki-poppy-hsmm', version: '5.2'
@@ -17,6 +31,6 @@ dependencies {
   implementation group: 'de.dfki.mary', name: 'voice-bits3-hsmm', version: '5.2'       //Deutsch,männlich
   implementation group: 'de.dfki.mary', name: 'voice-dfki-pavoque-neutral-hsmm', version: '5.2'
   implementation group: 'de.dfki.mary', name: 'voice-upmc-pierre-hsmm', version: '5.2' //Französisch,männlich
-
+*/
 }
alexanderkoller commented 4 years ago

This is fixed for now in b76f36f21fd82c109ac87b316dfc72451b659b90, using a variant of Timo's patch. Once there is a new MaryTTS release, we should change the dependencies to that.

alexanderkoller commented 4 years ago

I have added a bit of documentation for this on the Wiki.

timobaumann commented 2 weeks ago

this is fixed by the move to MaryTTS master (hoping for a 5.3 release to come soon) which re-enables MaryTTS with Java>9. However, at present there are hardly any voices on public maven repositories and they can't be built via jitpack :-|