【问题标题】:Incompatible versions of Spring when deploying to Fuse ESB (ServiceMix 4.4.1-fuse-03-06)部署到 Fuse ESB 时的 Spring 版本不兼容 (ServiceMix 4.4.1-fuse-03-06)
【发布时间】:2012-05-17 10:25:42
【问题描述】:

我的问题是如何强制捆绑使用与其打包的 Spring 版本而不是 ESB 上安装的版本?

我有一个简单的 Webservices WAR,我正在尝试在 Fuse ESB 中安装和启动它。 WAR 依赖于 Spring 3.0.6,我在 ESB 中安装了 Spring 3.0.5 功能。安装并尝试启动捆绑包后出现以下错误。

22:24:43,869 |错误 | l 控制台线程 | RegisterWebAppVisitorWC | 163 - org.ops4j.pax.web.pax-web-extender-war - 1.0.3 |注册异常。跳过。 org.springframework.beans.factory.parsing.BeanDefinitionParsingException:配置问题:无法从 URL 位置导入 bean 定义 [classpath:META-INF/spring/app-context.xml] 违规资源:ServletContext资源[/WEB-INF/cxf-servlet.xml];嵌套异常是 org.springframework.beans.factory.BeanDefinitionStoreException:从类路径资源 [META-INF/spring/app-context.xml] 解析 XML 文档时出现意外异常;嵌套异常是 org.springframework.beans.FatalBeanException:命名空间 [http://www.springframework.org/schema/jdbc] 的类 [org.springframework.jdbc.config.JdbcNamespaceHandler] 没有实现 [org.springframework.beans .factory.xml.NamespaceHandler] 接口 在 org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)[73:org.springframework.beans:3.0.5.RELEASE]

这表明正在使用意外版本的 Spring。我可以看到 3.0.6 在 Bundle-Classpath 上。我原以为捆绑应该只使用捆绑 lib 文件夹中的 Spring 版本。

我也有这个 pom 配置,以便在将 WAR 部署到 ServiceMix 时将 Maven 依赖项包含在类路径中。

                <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib/</classpathPrefix>
                            <classpathLayoutType>repository</classpathLayoutType>
                        </manifest>
                    </archive>
                    <webXml>src/main/webapp/WEB-INF/web.xml</webXml>
                    <webResources>
                        <resource>
                            <directory>src/main/resources</directory>
                            <targetPath>WEB-INF</targetPath>
                            <includes>
                                <include>**.*</include>
                            </includes>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>

【问题讨论】:

    标签: maven osgi apache-servicemix


    【解决方案1】:

    bundle 类路径由来自MANIFEST.MF 的 Import-Packages 定义,而不是 /lib 文件夹。您可能需要配置 Maven-Bundle-Plugin 以使用 Spring 3.0.6。

    【讨论】:

    • 好的,谢谢,我可以更改为使用 maven-bundle-plugin,我确信这是将服务部署到 ESB 的正确方法,但是我想探索打包和安装为 WAR Fuse 确实提供了这种能力。
    猜你喜欢
    • 2012-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-19
    • 2023-03-22
    • 1970-01-01
    • 2011-05-30
    • 1970-01-01
    相关资源
    最近更新 更多