【问题标题】:Cannot deploy CXF rest service in karaf 2.3.2 using ehcache无法使用 ehcache 在 karaf 2.3.2 中部署 CXF 休息服务
【发布时间】:2013-12-06 03:45:20
【问题描述】:

我有以下问题:尝试使用 cxf 在 karaf 2.3.2 中将休息服务部署为捆绑包,出现以下异常:

   Exception in thread "SpringOsgiExtenderThread-8" java.lang.NoClassDefFoundError: net/sf/ehcache/constructs/web/AlreadyCommittedException
   ...
   Caused by: java.lang.ClassNotFoundException: net.sf.ehcache.constructs.web.AlreadyCommittedException not found by org.apache.servicemix.bundles.ehcache [149]

我在 cxf 导入的 ehcache 包中发现了一个错误清单

    Installing bundle mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache/2.5.1_1

请参阅以下有关服务组合的错误报告:https://issues.apache.org/jira/browse/SMX4-1303

我现在的问题:我知道这已在 ehcache 2.6.XX 中修复,我该如何解决这个问题,知道 cxf 2.7.5 和 2.7.6(最新)都导入了错误的捆绑包? 我设法修复了一次,但我不记得我做了什么:/ 这是我安装的功能:

     <feature name="wsserv" version="${project.version}" description="wsserv">
       <configfile finalname="/etc/wsserv.cfg">mvn:com.mycorp.karaf.datasources/wsserv/${project.version}/cfg</configfile>
        <bundle>wrap:mvn:mysql/mysql-connector-java/5.1.14</bundle>
        <feature version="3.2.3.RELEASE">spring-jdbc</feature>
        <feature version="3.2.3.RELEASE">spring-web</feature>
        <feature version="2.7.5">cxf</feature>
        <bundle>wrap:mvn:net.sf.ehcache/ehcache-web/2.0.3</bundle>
        <bundle>wrap:mvn:commons-collections/commons-collections/3.2.1</bundle>
        <bundle>mvn:com.mycorp.karaf.datasources/wsserv/${project.version}</bundle>
         <bundle>mvn:com.mycorp.karaf.webservices/wsserv.common/${project.version}</bundle>
         <bundle>mvn:com.mycorp.karaf.webservices/wsserv.dao/${project.version}</bundle>
         <bundle>mvn:com.mycorp.karaf.webservices/wsserv.business/${project.version}</bundle>
         <bundle>mvn:com.mycorp.karaf.webservices/wsserv.api/${project.version}</bundle>
  </feature>

谢谢

【问题讨论】:

    标签: cxf ehcache apache-karaf


    【解决方案1】:

    您遇到的这个错误是典型的类加载问题。无需详述 - 解决方法是让 ehcache-web 成为 servicemix-ehcache 的片段包。

    【讨论】:

    • 抱歉回复晚了。我不太明白“片段包”的东西。对了,我发现ehcache 2.7.5在karaf部署正常,值得一试
    • 片段包可能用于修补损坏的模块。问题是它允许您覆盖或扩展捆绑类路径(但不能导入)。不同的是,fragment 必须指定 Fragment-Host 标头。无论如何,很高兴您部署了新版本的 ehcache。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-13
    • 2018-09-09
    • 2012-04-02
    • 2020-05-16
    相关资源
    最近更新 更多