I ran into similar issue a while ago. It could be some hidden character in
your beans.xml. Make a copy of beans.xml from cxf-osgi example and change it
based on your need and should work.
Here is my confifuration:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ctx="http://www.springframework.org/schema/context"
xmlns:http="http://servicemix.apache.org/http/1.0"
xmlns:bar="http://testserver"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://servicemix.apache.org/http/1.0
http://servicemix.apache.org/schema/servicemix-http-3.2.3.xsd">
regards,
Sandeep
gnanda wrote:
>
> Hi All,
> I am creating my first OSGI bundle using servicemix 4.2
> I have a http component defined as below
> <beans xmlns:http="http://servicemix.apache.org/http/1.0"
> xmlns:sp="urn:com.pf.simpleprovider"
> xmlns:pap="urn:com.pf.provider.provisioningreq"
> xmlns="http://www.springframework.org/schema/beans"
> xmlns:xsi="http://http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://servicemix.apache.org/http/1.0
> http://servicemix.apache.org/schema/servicemix-http-3.2.3.xsd
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
>
> <http:endpoint
> service="prp:http"
> endpoint="consumer"
> role="consumer"
> targetService="sp:http"
> locationURI="http://0.0.0.0:8192/provisioningReqListener/"
>
> defaultMep="http://www.w3.org/2004/08/wsdl/in-only" />
> <!-- use this special class to register the endpoints with the
> NMR -->
> <bean class="org.apache.servicemix.common.osgi.EndpointExporter" />
>
>
>
> </beans>
>
> and pom.xml as below
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <groupId>com.pf.provider.provisioningreq</groupId>
> <artifactId>provisioningreq</artifactId>
> <version>0.0.1-SNAPSHOT</version>
> <packaging>bundle</packaging>
> <name>Provisioning Request :: HTTP OSGI</name>
> <properties>
> <jbi-maven-plugin-version>4.3</jbi-maven-plugin-version>
> <servicemix-bundle-version>2010.01</servicemix-bundle-version>
> </properties>
> <dependencies>
> <dependency>
> <groupId>org.apache.servicemix</groupId>
> <artifactId>servicemix-http</artifactId>
> <version>${servicemix-bundle-version}</version>
> </dependency>
> <dependency>
> <groupId>org.apache.felix</groupId>
> <artifactId>org.osgi.core</artifactId>
> <version>1.0.0</version>
> </dependency>
>
> </dependencies>
> <build>
> <plugins>
> <!-- configure the bundle plugin with some additional imports -->
> <plugin>
> <groupId>org.apache.felix</groupId>
> <artifactId>maven-bundle-plugin</artifactId>
> <version>2.0.0</version>
> <extensions>true</extensions>
> <configuration>
> <instructions>
> <Import-Package>
> org.apache.servicemix.http,
> org.apache.servicemix.bean,
> org.apache.servicemix.common.osgi,
> org.apache.servicemix.util,
> org.springframework.beans.factory.config
> </Import-Package>
> </instructions>
> </configuration>
> </plugin>
> <!-- let's use Java 6 -->
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-compiler-plugin</artifactId>
> <configuration>
> <source>1.6</source>
> <target>1.6</target>
> </configuration>
> </plugin>
> </plugins>
> </build>
> </project>
>
> I am getting following exception. Do I need to add anything more to my
> pom.xml?
>
> org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
> Line 25 in XML document from URL
> [bundle://232.0:0/META-INF/spring/xbean.xml] is invalid; nested exception
> is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration
> of element 'beans'.
> at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404)
> 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.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
> at
> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
> at
> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
> at
> org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:176)
> at
> org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:142)
> at
> org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
> at
> org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)
> at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$800(AbstractDelegatedExecutionApplicationContext.java:69)
> at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$3.run(AbstractDelegatedExecutionApplicationContext.java:269)
> at
> org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
> at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.startRefresh(AbstractDelegatedExecutionApplicationContext.java:247)
> at
> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:222)
> at
> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:175)
> at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:175)
> at
> org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:718)
> at java.lang.Thread.run(Thread.java:619)
> Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the
> declaration of element 'beans'.
> at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
> at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
> at
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
> at
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
> at
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1915)
> at
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:705)
> at
> com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
> at
> com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:626)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3103)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:922)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
> at
> com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
> at
> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
> at
> com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:235)
> at
> com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
> at
> org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
>
>
>
--
View this message in context:
http://old.nabble.com/org.xml.sax.SAXParseException%3A-cvc-elt.1%3A-Cannot-find-the-declaration-of-element-%27beans%27.-tp28512689p28615688.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.