Reputation: 1
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>
Upvotes: 0
Views: 160