ClassNotFoundException when starting tomcat

前端 未结 12 2192
孤城傲影
孤城傲影 2020-12-14 07:38

I\'m trying to make a REST web service.

My project looks like :

\"enter

<
12条回答
  •  抹茶落季
    2020-12-14 08:14

    The class loader can't find the class com.sun.jersey.spi.container.servlet.ServletContainer.

    You need to put the Jersey JAR in your WEB-INF/lib directory.

    This might help:

    http://www.suryasuravarapu.com/2009/02/rest-jersey-configuration-on-tomcat.html

    Now I've looked at the image you posted and I see your problem: You're using Eclipse and Maven, but you don't really understand what they're doing.

    You have to end up with a WAR file in the Tomcat /webapps directory that has all the 3rd party JARs you need in the WEB-INF/lib directory. If you don't, Tomcat won't find them.

    I'd recommend simplifying your problem. Create a WAR file by hand; leave Eclipse and Maven out of it. Once you've got it working, add in the things that are supposed to be making your life easier. You'll understand what they need to do, because you'll have already made it work without them.

提交回复
热议问题