0

I want my servlet page to retrieve the information provided in textarea of jsp page and convert that text into voice and return to the jsp page. This piece of code is giving me this error

org.apache.catalina.core.StandardWrapperValve invokeSEVERE: Servlet.service() for servlet [Myclass] in context with path [/test] threw exception [Servlet execution threw an exception] with root cause java.lang.ClassNotFoundException: com.sun.speech.freetts.VoiceManager at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1365)

Any help or suggestion will be appreciated.

servlet page (Myclass.java)

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        //2nd approach
        final String VOICENAME ="kevin16" ;
        String button = request.getParameter("button");
        Voice voice;

        VoiceManager vm= VoiceManager.getInstance();
        voice =vm.getVoice(VOICENAME);

        voice.allocate();
        if ("text".equals(button)) {

        try {

            voice.speak(request.getParameter("box"));
        }
        catch( Exception e){
            System.out.println(e.getMessage());
        }   
        System.out.println("line 5");
        request.getRequestDispatcher("NewFile.jsp").forward(request, response);

        }

    }

}

jsp page (NewFile.jsp)

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>

 <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>


<form method="post" action="Myclass" enctype="multipart/form-data">

<textarea name ="box" rows="4" cols="50">

</textarea>
<button value="text" name ="button" type="submit" >Click Me!</button>
</form>
  </body>

</html>
Curiosa Globunznik
  • 3,129
  • 1
  • 16
  • 24
CodeOctal
  • 1
  • 3
  • Any suggestion what error there actually is, best with a call stack, will be appreciated. Now the official rant: Welcome to Stack Overflow. Please take the [tour](https://stackoverflow.com/tour) to learn how Stack Overflow works and read [How to Ask](https://stackoverflow.com/questions/how-to-ask) and how to improve the quality of your question. – Curiosa Globunznik Nov 02 '19 at 15:28
  • this is the error that I am getting org.apache.catalina.core.StandardWrapperValve invokeSEVERE: Servlet.service() for servlet [Myclass] in context with path [/test] threw exception [Servlet execution threw an exception] with root cause java.lang.ClassNotFoundException: com.sun.speech.freetts.VoiceManager at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1365) – CodeOctal Nov 02 '19 at 16:52
  • Possible duplicate of [HTTP Status 500 - Servlet execution threw an exception (java.lang.ClassNotFoundException)](https://stackoverflow.com/questions/30723181/http-status-500-servlet-execution-threw-an-exception-java-lang-classnotfounde) – Curiosa Globunznik Nov 02 '19 at 17:23

0 Answers0