jersey+maven构建restful服务

http://blog.csdn.net/liuchuanhong1/article/details/52880598


(1)若报错如下:

Failed to read artifact descriptor for org.glassfish.jersey.containers:jersey-container-servlet:jar:2.17

解决方法如下:

I was able to resolve the issue with below steps: Right click on the maven project in Eclipse -> Maven -> Update Project -> Check "Force update of snapshots/Releases" check box.



(2)若报错如下:

java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer

解决方法如下:

For web projects in Eclipse, it is almost always advisable to manage dependencies with Maven. Use a Maven plugin like m2e. Once you add a dependency to your Maven project, it should automatically deploy those libraries to WEB-INF/lib. If it does not (for whatever reasons), you can explicit do so:

  1. Right-click on your project in Project Explorer
  2. Select Properties
  3. Select Deployment Assembly
  4. If Maven Dependencies is not one of the entries, the libraries were not added automatically, so we'll add them now
  5. Select Add
  6. Select Java Build Path Entries
  7. Select Maven Dependencies
  8. Click Finish

This should add the libraries to WEB-INF/lib, although you'd still not see them in the Project Explorer view. But your ClassNotFoundException should go away now.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值