Search code examples
javatext-to-speechmarytts

MaryTTS Exception NoClassDefFoundError: com/google/common/bas e/Joiner


I am fetching data from Wikipedia and i give them to MaryTTS which is a text to speech library .

So for example i fetch the text from Wikipedia API like this : Wikipedia API Summary Searching for Donald Trump

Java code that produces the problem:


This line -> AudioInputStream audio = marytts.generateAudio(text); where MaryTTS is: MaryInterface marytts = new LocalMaryInterface();


Text that is causing error

Donald John Trump (born June 14, 1946) is the 45th and current President of the 
United States. Before entering politics, he was a businessman and television per
sonality.\nTrump was born and raised in Queens, New York City, and earned an eco
nomics degree from the Wharton School. He then took charge of The Trump Organiza
tion, the real estate and construction firm founded by his paternal grandmother,
 which he ran for 45 years until 2016. During his real estate career, Trump buil
t, renovated, and managed numerous office towers, hotels, casinos, and golf cour
ses. Besides real estate, he started several side ventures and has licensed the 
use of his name for the branding of various products and properties, including T
rump Entertainment Resorts. He was the founder of Trump University. He produced 
and hosted The Apprentice, a reality television series on NBC, from 2004 to 2015
. His net worth was estimated to be $3.5 billion as of 2017, making him the 544t
h richest person in the world.\nTrump first publicly expressed interest in runni
ng for political office in 1987. He won two Reform Party presidential primaries 
in 2000, but withdrew his candidacy early on. In June 2015, he launched his camp
aign for the 2016 presidential election and quickly emerged as the front-runner 
among seventeen candidates in the Republican primaries. His remaining opponents 
all suspended their campaigns by the end of May 2016, and in July he was formall
y nominated at the Republican National Convention along with Indiana governor Mi
ke Pence as his running mate. Many of his campaign statements were controversial
 or false, generating much free media coverage.\nTrump won the general election 
on November 8, 2016, in a surprise victory against Democratic opponent Hillary C
linton and commenced his presidency on January 20, 2017. He became the oldest an
d wealthiest person ever to assume the presidency, the first without prior milit
ary or government service, and the fifth to have won the election while losing t
he popular vote. His political positions have been described by scholars and com
mentators as populist, protectionist, and nationalist."}}}}

Error:

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/bas
e/Joiner
    at marytts.language.en.Preprocess.expandConsonants(Preprocess.java:497)
    at marytts.language.en.Preprocess.expand(Preprocess.java:382)
    at marytts.language.en.Preprocess.process(Preprocess.java:186)
    at marytts.server.Request.processOneChunk(Request.java:566)
    at marytts.server.Request.processOrLookupOneChunk(Request.java:403)
    at marytts.server.Request.process(Request.java:337)
    at marytts.LocalMaryInterface.process(LocalMaryInterface.java:438)
    at marytts.LocalMaryInterface.generateAudio(LocalMaryInterface.java:348)
    at application.TextToSpeech.speak(TextToSpeech.java:63)
    at application.WikipediaTalker.main(WikipediaTalker.java:52)
Caused by: java.lang.ClassNotFoundException: com.google.common.base.Joiner
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 10 more

Solution

  • This is very very strange from the side of MaryTTS team , they seem to ignore this error happens , solved this by adding Guava 22.0 on the project class path.

    Also i see nowhere on the depencities this to be mentioned :( .