没有声明元素&#; osgi:reference'

时间:2015-12-16 13:39:13

标签: spring apache-camel apache-servicemix

我在Apache ServiceMix 6.1.0上运行。

我在foo项目的pom.xml中有以下依赖项:

<dependencies>
    <dependency>
        <groupId>com.proj.bar</groupId>
        <artifactId>foo</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>3.2.14.RELEASE</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-parent</artifactId>
        <version>2.15.3</version>
        <type>pom</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.osgi</groupId>
        <artifactId>org.osgi.compendium</artifactId>
        <version>4.2.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-core</artifactId>
        <version>2.15.3</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

我在spring core-context.xml中有以下内容:

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:osgi="http://www.springframework.org/schema/osgi"
   xmlns:camel="http://camel.apache.org/schema/spring"
   xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
   http://camel.apache.org/schema/spring
   http://camel.apache.org/schema/spring/camel-spring.xsd
   http://www.springframework.org/schema/osgi-compendium
   http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd">

    <!-- OSGI SERVICE REGISTER -->
    <osgi:service id="configService" interface="com.proj.bar.foo.service.interfaces.IConfigService" ref="configServiceBean">
        <service-properties>
            <entry key="osgi.jndi.service.name" value="ConfigService" />
        </service-properties>
    </osgi:service>
</beans>

我的spring foo-context.xml

中有以下内容
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:osgi="http://www.springframework.org/schema/osgi"
   xmlns:camel="http://camel.apache.org/schema/spring"
   xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
   http://camel.apache.org/schema/spring
   http://camel.apache.org/schema/spring/camel-spring.xsd
   http://www.springframework.org/schema/osgi-compendium
   http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd">

    <!-- SERVICE REFERENCES -->
    <osgi:reference id="configService"
                interface="com.proj.bar.foo.service.interfaces.IConfigService"
                filter="(osgi.jndi.service.name=ConfigService)"/>
</beans>

我收到以下例外:

2015-12-16 11:24:20,550 | ERROR | ExtenderThread-8 | ContextLoaderListener            | 94 - org.springframework.osgi.extender - 1.2.1 | Application context refresh failed (OsgiBundleXmlApplicationContext(bundle=foo, config=osgibundle:/META-INF/spring/*.xml))
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 16 in XML document from URL [bundle://248.29:0/META-INF/spring/foo-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'osgi:reference'.
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:397)[87:org.apache.servicemix.bundles.spring-beans:3.2.14.RELEASE_1]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:335)[87:org.apache.servicemix.bundles.spring-beans:3.2.14.RELEASE_1]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)[87:org.apache.servicemix.bundles.spring-beans:3.2.14.RELEASE_1]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)[87:org.apache.servicemix.bundles.spring-beans:3.2.14.RELEASE_1]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)[87:org.apache.servicemix.bundles.spring-beans:3.2.14.RELEASE_1]
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)[87:org.apache.servicemix.bundles.spring-beans:3.2.14.RELEASE_1]
at org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:164)[93:org.springframework.osgi.core:1.2.1]
at org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:136)[93:org.springframework.osgi.core:1.2.1]
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)[89:org.apache.servicemix.bundles.spring-context:3.2.14.RELEASE_1]
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:539)[89:org.apache.servicemix.bundles.spring-context:3.2.14.RELEASE_1]
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$800(AbstractDelegatedExecutionApplicationContext.java:69)[93:org.springframework.osgi.core:1.2.1]
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$3.run(AbstractDelegatedExecutionApplicationContext.java:269)[93:org.springframework.osgi.core:1.2.1]
at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[93:org.springframework.osgi.core:1.2.1]
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.startRefresh(AbstractDelegatedExecutionApplicationContext.java:247)[93:org.springframework.osgi.core:1.2.1]
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:214)[94:org.springframework.osgi.extender:1.2.1]
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:169)[94:org.springframework.osgi.extender:1.2.1]
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:175)[93:org.springframework.osgi.core:1.2.1]
at org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:716)[94:org.springframework.osgi.extender:1.2.1]
at java.lang.Thread.run(Thread.java:744)[:1.7.0_45]
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'osgi:reference'.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)[:]
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)[:]
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)[:]
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)[:]
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)[:]
at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source)[:]
at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source)[:]
at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)[:]
at org.apache.xerces.impl.xs.XMLSchemaValidator.emptyElement(Unknown Source)[:]
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)[:]
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)[:]
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)[:]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)[:]
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)[:]
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)[:]
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)[:]
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)[:]
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)[87:org.apache.servicemix.bundles.spring-beans:3.2.14.RELEASE_1]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:389)[87:org.apache.servicemix.bundles.spring-beans:3.2.14.RELEASE_1]
... 18 more

我完全不知道我能做些什么来解决这个问题。 它似乎在我的核心项目中运行良好,但我没有做任何不同的事情。它似乎没有识别osgi:reference标签,但命名空间定义应该是正确的。

有谁知道可能导致这种情况的原因?

Thnx提前!

0 个答案:

没有答案