Maven doesn't compile webapp

北慕城南 提交于 2020-01-14 05:53:27

问题


Before I made a simple dynamic web project with websockets and without maven, it works fine. Now I try to use maven. But when I'm compiling my project with mvn compile jetty:run it doesn't build with javax.servlet.UnavailableException: Servlet class com.example.testbattle.ServerSide is not a javax.servlet.Servlet exception. It requires to implement Servlet interface. Why didn't I need it with simple dynamic web project. How could I avoid this problem?

UPDATE: I have found out the problem it was wrong web.xml Now I can't launch serverside. What should I put into web.xml?


回答1:


Such an error reports that you are trying to register pass an non servlet class as a servlet one, meaning here that obviousely com.example.testbattle.ServerSide does not implement javax.servlet.Servlet or extend a subclass of it.

If com.example.testbattle.ServerSide is intended to be your Servlet application entry point then go ahead an implement the mentioned interface and all its derived methods (onService...).



来源:https://stackoverflow.com/questions/26690910/maven-doesnt-compile-webapp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!