240 发简信
IP属地:广东
  • 提醒一下准备敲Demo的伙伴:在敲DEMO,关于Jersey返回JSON和XML时,此时文章里使用的是基于Servlet容器的方式,在添加完jackson依赖后,启动tomcat报错,内容:org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]] 和 java.lang.ClassCastException: org.springframework.web.SpringServletContainerInitializer cannot be cast to javax.servlet.ServletContainerInitializer;找了很久才找到,原因是,我在测试Jersey Serlet容器后,又测试了Jersey内置容器,添加的依赖jersey-container-jetty-http 忘记注释了,如果是使用文章中的Serlet容器方式,进行测试, 还需要把 jetty-http依赖给注释了;