question

Noel Portugal avatar image
Noel Portugal asked

Deploying to Tomcat7

I have hit a wall. No matter what I do I always get the this exception after deploying to Tomcat7 message Class com.noelportugal.echo.SessionSpeechlet is not a Servlet description The server encountered an internal error that prevented it from fulfilling this request. exception javax.servlet.ServletException: Class com.noelportugal.echo.SessionSpeechlet is not a Servlet org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Thread.java:745) root cause java.lang.ClassCastException: com.noelportugal.echo.SessionSpeechlet cannot be cast to javax.servlet.Servlet org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Thread.java:745)
alexa skills kitdebugging
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Noel Portugal avatar image
Noel Portugal answered
BTW.. I have added ALL the dependency libs. Even the jetty ones (even though im not using them). Here is my WEB-INF/lib contents: DeeSdkInterface-1.0.jar jetty-server-9.0.6.v20130930.jar JakartaCommons-IO-2.4.jar jetty-servlet-9.0.6.v20130930.jar commons-codec-1.6.jar jetty-servlets-9.0.6.v20130930.jar commons-lang3-3.x.jar jetty-setuid-java-1.0.1.jar jackson-annotations-2.3.2.jar jetty-util-9.0.6.v20130930.jar jackson-core-2.3.2.jar jetty-webapp-9.0.6.v20130930.jar jackson-databind-2.3.2.jar jetty-xml-9.0.6.v20130930.jar jetty-annotations-9.0.6.v20130930.jar joda-time-2.3.jar jetty-client-9.0.6.v20130930.jar log4j-1.2.17.jar jetty-continuation-9.0.6.v20130930.jar servlet-api-3.0.jar jetty-deploy-9.0.6.v20130930.jar slf4j-api-1.7.4.jar jetty-http-9.0.6.v20130930.jar slf4j-log4j12-1.7.4.jar jetty-io-9.0.6.v20130930.jar spdy-client-9.0.6.v20130930.jar jetty-jaas-9.0.6.v20130930.jar spdy-core-9.0.6.v20130930.jar jetty-jmx-9.0.6.v20130930.jar spdy-http-server-9.0.6.v20130930.jar jetty-jndi-9.0.6.v20130930.jar spdy-server-9.0.6.v20130930.jar jetty-monitor-9.0.6.v20130930.jar websocket-api-9.0.6.v20130930.jar jetty-plus-9.0.6.v20130930.jar websocket-client-9.0.6.v20130930.jar jetty-proxy-9.0.6.v20130930.jar websocket-common-9.0.6.v20130930.jar jetty-rewrite-9.0.6.v20130930.jar websocket-server-9.0.6.v20130930.jar jetty-security-9.0.6.v20130930.jar websocket-servlet-9.0.6.v20130930.jar It all seems related to DeeSdkInterface-1.0.jar and an issue with javax.servlet.Servlet . BTW Tomcat comes already with javax.servlet so it just gets ignored.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Noel Portugal avatar image
Noel Portugal answered
Ok I finally got it! The problem was solved by following the answer by rgr@amazon in https://forums.developer.amazon.com/forums/thread.jspa?threadID=4911&tstart=0 I needed to deploy a 'cointainer' servlet that extends SpeechletServlet. I added all third party dependencies (excluding Jetty's) and now im good to go! package helloworld; import com.amazon.speech.speechlet.servlet.SpeechletServlet; @SuppressWarnings("serial") public class HelloWorldServlet extends SpeechletServlet { public HelloWorldServlet() { this.setSpeechlet(new HelloWorldSpeechlet()); } }
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

rgr@amazon avatar image
rgr@amazon answered
Noel thanks for the feedback, I happy you have your issue resolved.
https://forums.developer.amazon.com/forums/thread.jspa?threadID=4911&tstart=0 covers how to get a servlet working in tomcat.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.