java启动组件错误_OSGI组件启动异常的错误解决方法

第一种异常:org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to instantiate components

Caused by: java.lang.NoClassDefFoundError: org/apache/commons/httpclient/methods/RequestEntity

Caused by: java.lang.ClassNotFoundException: org.apache.commons.httpclient.methods.RequestEntity not found by com.gzydt.license.sign.rest [312]

在启动com.gzydt.license.sign.rest组件的时候由于缺少依赖org/apache/commons/httpclient,所以要将该依赖加进去,(这个依赖在测试类中共可以使用,但是在服务中却不能使用)。。具体原因是因为组件rest需要该依赖,但组件中并没有该依赖,所以有两种解决方法,第一种:将该依赖打包到组件中  第二种:导入环境中有的该依赖,第一种方法是将组件的pom文件中共的  *;scope=compile|runtime   这句话,将原来的pom的依赖修改为:原来的scope是provide,现在修改为compile

commons-httpclient

commons-httpclient

3.1

compile

第二种方法:首先检查环境中是否有这个依赖,在servicemix中敲击命令export |grep org/apache/commons/httpclient  若有这个依赖,

则将该依赖在该组件的pom文件中import进来,就是在组件的pom文件中import该依赖

4fd1ef957ad8c3bd8ff468f2f4f15b28.png

第二种异常:

Error executing command: Can't install feature license-sign/0.0.0:

Could not start bundle mvn:com.gzydt.license/com.gzydt.license.sign.rest/1.0.0 in feature(s) license-sign-0.0.0: Unresolved constraint in bundle com.gzydt.license.sign.rest [270]: Unable to resolve 270.0: missing requirement [270.0] osgi.wiring.package; (osgi.wiring.package=com.ibm.icu.text)

解决方法:逐步添加缺少的依赖,直到组件正常启动

第三种异常:

Activator start error in bundle com.gzydt.license.sign.rest

解决方法:

是因为在export中没有添加的依赖之后没有加逗号

第四种异常:

注解@lob可以存,可以查,但是修改的时候报错

java.lang.RuntimeException: org.apache.cxf.interceptor.Fault: javax.transaction.RollbackException: Unable to commit: transaction marked for rollback

licAttrs没有赋值,所以报错

第五种异常:

Error executing command: Can't install feature license-sign/0.0.0:

Could not start bundle mvn:com.gzydt.license/com.gzydt.license.sign.rest/1.0.0 in feature(s) license-sign-0.0.0: Unresolved constraint in bundle com.gzydt.license.sign.rest [258]: Unable to resolve 258.0: missing requirement [258.0] osgi.wiring.package; (&(osgi.wiring.package=org.apache.cxf.jaxrs.ext.multipart)(version>=2.7.0)(!(version>=3.0.0)))

这种异常是因为组件中的依赖是2.7的,但是组件需要的是3.0的该依赖,所以修改该依赖的版本,(这是在依赖的最顶层进行修改的)

8f55502808c950932e4414d55b47f7bf.png

第六种异常:

水印、的时候报错:

org.apache.cxf.interceptor.Fault: Could not initialize class net.netca.pki.DeviceSet

解决方法:将servicemix中的log文件删除,然后重启servicemix

第七种异常:missing requirement [478.0] osgi.wiring.package; (&(osgi.wiring.package=com.gzydt.report.base.persistence.entity)(version>=1.0.0)(!(version>=2.0.0)))

在message组件的rest层中引入另一个组件(base)的persitence和service的服务,然后刚开始黏贴的时候报错

243cea59e304d2f3db1db8dafdc8ca30.png

必须要填入版本号,然后我按照他的要求填入版本号,但是编译能够通过,在启动组件的时候报错:

missing requirement [478.0] osgi.wiring.package; (&(osgi.wiring.package=com.gzydt.report.base.persistence.entity)(version>=1.0.0)(!(version>=2.0.0)))

解决方法:在该组件的上一层的pom文件中先引入,即先让message组件先引入base的persistence和service的服务,然后再在message的rest层中引入

e8d00eed83539f936489e9ae3e01d381.png

保存之后就不会报错:

3397d14dcecd0889c69779727b8c152a.png

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值