James Rawlings
James Rawlings

Reputation: 471

Incompatible versions of Spring when deploying to Fuse ESB (ServiceMix 4.4.1-fuse-03-06)

My question is how can I force a bundle to use the version of Spring packaged with it rather than the version installed on the ESB?

I have a simple Webservices WAR which I am trying to install and start in Fuse ESB. The WAR has a dependency on Spring 3.0.6 and I have the Spring 3.0.5 feature installed in the ESB. I am getting the error below after installing and trying to start the bundle.

22:24:43,869 | ERROR | l Console Thread | RegisterWebAppVisitorWC | 163 - org.ops4j.pax.web.pax-web-extender-war - 1.0.3 | Registration exception. Skipping. org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:META-INF/spring/app-context.xml] Offending resource: ServletContext resource [/WEB-INF/cxf-servlet.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/spring/app-context.xml]; nested exception is org.springframework.beans.FatalBeanException: Class [org.springframework.jdbc.config.JdbcNamespaceHandler] for namespace [http://www.springframework.org/schema/jdbc] does not implement the [org.springframework.beans.factory.xml.NamespaceHandler] interface at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)[73:org.springframework.beans:3.0.5.RELEASE]

This shows that an unexpected version of Spring is being used. I can see that 3.0.6 is on the Bundle-Classpath. I would have thought the bundle should only be using the version of Spring in the bundle lib folder.

I also have this pom configuration so that Maven dependencies are included on the class path when deploying the WAR to ServiceMix.

                <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>

Upvotes: 0

Views: 737

Answers (1)

Olivier.Roger
Olivier.Roger

Reputation: 4249

The bundle classpath is defined by the Import-Packages from the MANIFEST.MF, not the /lib folder. You probably need to configure the Maven-Bundle-Plugin to use Spring 3.0.6.

Upvotes: 0

Related Questions