2 Replies Latest reply on Jul 29, 2009 9:43 AM by Peter Chandler

    ServiceMix and Spring and Runtime.

    Peter Chandler Master

      I have a simple application that uses Spring at runtime.  I am trying to port it to servicemix.  I compiled it with Spring version 2.5.6 and put the Spring Jar in my bundle-classpath.  However, I am getting a LinkageError.


      Questions: Anyone have experience with using Spring at runtime within (called from) a OSGi Bundle? How do I synchronize versions of the compiled bundle with the servicemix runtime? Can I just import the required Spring packages from ServiceMix into my bundle? What version of Spring should I use for FUSE 4.x?


      Compiled with:




      org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from file /export/home/machine/1/user/programs/fuse-esb-; nested exception is java.lang.LinkageError: loader constraint violation: when resolving method "javax.xml.parsers.DocumentBuilder.setEntityResolver(Lorg/xml/sax/EntityResolver;)V" the class loader (instance of org/apache/felix/framework/searchpolicy/ModuleImpl$ModuleClassLoader) of the current class, org/springframework/beans/factory/xml/DefaultDocumentLoader, and the class loader (instance of org/apache/felix/framework/searchpolicy/ModuleImpl$ModuleClassLoader) for resolved class, javax/xml/parsers/DocumentBuilder, have different Class objects for the type org/xml/sax/EntityResolver used in the signature

              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420)

              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)

              at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)

              at org.springframework.beans.factory.xml.XmlBeanFactory.(XmlBeanFactory.java:61)