ActiveMQ
  1. ActiveMQ
  2. AMQ-2010

META-INF/services files ended up in wrong bundle (jar), missing imports

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Not A Problem
    • Affects Version/s: 5.1.0
    • Fix Version/s: 5.x
    • Component/s: None
    • Labels:
      None
    • Environment:

      Springsource DM 1.0.0.RC2, java jdk (sun) 1.6_07, Linux 32bit

    • Patch Info:
      Patch Available

      Description

      Hi!

      I'm unable to use namespaces in spring xml files. It just cannot resolve namespacehttp://activemq.apache.org/schemas/core:

      ...
      [2008-11-21 15:06:59.627] server-dm-7 rk.beans.factory.xml.DefaultBeanDefinitionDocumentReader.unknown D Loading bean definitions
      [2008-11-21 15:06:59.628] server-dm-7 ramework.osgi.extender.internal.support.NamespacePlugins.unknown D Trying to resolving namespace handler for http://activemq.apache.org/schema/core
      [2008-11-21 15:06:59.630] server-dm-7 .app.spring.GenericModuleOsgiBundleXmlApplicationContext.unknown E Pre refresh error
      org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace http://activemq.apache.org/schema/core
      Offending resource: URL [bundleentry://89/META-INF/spring/bundle-context-amq.xml]

      at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
      at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
      at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80)
      at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:281
      ...

      To make long story short, it seems that in the process of building jar, someone forgot to move META-INF/services files in separate bundles.

      In OSGI enviroment, classpath loader of one bundle can only see files in jars (bundles) which he has import directive, including local root. In current build of activemq, META-INF/services files are all stored in META-INF/services dir under activemq-core bundle.On the other hand, namespace parser is in xbean.spring bundle (referenced by META-INF/spring.handlers). Because parser is in separate bundle, it can not "see" META-INF/services directory, and it dies. Also, import for org.apache.xbean.spring.context.v2 is missing from activemq-core. Additionally, for bundle loader to scan for spring.schema file, bundle must import org.springframework.beans.factory.xml, which is also missing from manifest file. I'm not 100% shure in this, maybe all files from META-INF/services should be moved from activemq-core to xbaen.spring ...

      Anyhow, fix to make it work is to:

      • move META-INF/services in propriate bundles
      • add following import to activemq-core:
        org.springframework.beans.factory.xml;resolution:=optional,
        org.apache.xbean.spring.context.v2;resolution:=optional

      That's it for now.

      H.

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Closed Closed
        1043d 9h 44m 1 Timothy Bish 01/Oct/11 01:01
        Timothy Bish made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Not A Problem [ 8 ]
        Gary Tully made changes -
        Fix Version/s 5.6.0 [ 12316331 ]
        Fix Version/s 5.5.0 [ 12315626 ]
        Dejan Bosanac made changes -
        Fix Version/s 5.5.0 [ 12315626 ]
        Fix Version/s 5.4.2 [ 12315625 ]
        Jeff Turner made changes -
        Project Import Fri Nov 26 22:32:02 EST 2010 [ 1290828722158 ]
        Bruce Snyder made changes -
        Fix Version/s 5.5.0 [ 12344 ]
        Fix Version/s 5.4.1 [ 12332 ]
        Rob Davies made changes -
        Field Original Value New Value
        Fix Version/s 5.4.1 [ 12332 ]
        Hide
        Kyle Neumeier added a comment -

        I am having the same problem. I have been able to work around this problem by adding an EclipseBuddyPolicy:global statement to the manifest of the bundle that has the spring xml file for configuring activemq.

        Show
        Kyle Neumeier added a comment - I am having the same problem. I have been able to work around this problem by adding an EclipseBuddyPolicy:global statement to the manifest of the bundle that has the spring xml file for configuring activemq.
        Hrvoje Habjanic created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Hrvoje Habjanic
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development