![240](https://cdn2.jianshu.io/assets/default_avatar/11-4d7c6ca89f439111aff57b23be1c73ba.jpg?imageMogr2/auto-orient/strip|imageView2/1/w/240/h/240)
提醒一下準備敲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依賴給注釋了;