ClassNotFoundException when starting tomcat

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

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

My project looks like :

\"enter

<
12条回答
  •  不知归路
    2020-12-14 08:23

    luigi7up's post above worked for me. I'm using tomcat 7.0.37, maven 3.1.1, and jersey 1.17.1. I did the right click -> properties -> Deployment Assembly -> Click Add -> Java Build Path Entries -> selected Maven Dependencies. I then clicked ok.

    When I first tried this, I noticed that I no longer received the "java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer" error, but I then noticed that I was getting other 'class not found' messages (unfortunately, I didn't document what messages those were). I was using the following jersey dependency:

    
        com.sun.jersey
        jersey-bundle
        1.17.1
    
    

    I took that out and put in the following dependencies:

    
        com.sun.jersey
        jersey-server
        1.17.1
    
    
        com.sun.jersey
        jersey-core
        1.17.1
    
    
        com.sun.jersey
        jersey-servlet
        1.17.1
    
    

    Things began to work after that.

    Hope this helps someone!

提交回复
热议问题