You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Martin Novák <mn...@martinnovak.eu> on 2007/08/27 20:22:04 UTC
Problem loading spring configuration in tests
Hello, I have a problem running my servicemix unit test. I have a
servicemix spring configuration file which is something like that:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:sm="http://servicemix.apache.org/config/1.0"
xmlns:rest="http://www.browsersoft.com/mergence/rest/1.0"
xmlns:test="urn:test"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://servicemix.apache.org/config/1.0
http://people.apache.org/repo/m2-incubating-repository/org/apache/servicemix/servicemix-core/3.1-incubating/servicemix-core-3.1-incubating.xsd"
>
<sm:container id="jbi" embedded="true" createMBeanServer="false"
createJmxConnector="false">
<sm:activationSpecs>
<sm:activationSpec id="rest">
<sm:component>
<bean class="com.browsersoft.mergence.rest.RestEndpoint"></bean>
</sm:component>
</sm:activationSpec>
</sm:activationSpecs>
</sm:container>
</beans>
It seems to be to be ok, but when I run my test derived from
SpringTestSupport class, it has a problem:
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
Line 46 in XML document from class path resource [rest-test-context.xml]
is invalid; nested exception is org.xml.sax.SAXParseException:
cvc-complex-type.2.4.b: The content of element 'sm:activationSpec' is
not complete. One of
'{"http://servicemix.apache.org/config/1.0":destinationResolver,
"http://servicemix.apache.org/config/1.0":interfaceChooser,
"http://servicemix.apache.org/config/1.0":marshaler,
"http://servicemix.apache.org/config/1.0":persistent,
"http://servicemix.apache.org/config/1.0":serviceChooser,
"http://servicemix.apache.org/config/1.0":subscriptions,
WC[##other:"http://servicemix.apache.org/config/1.0"]}' is expected.
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.b: The
content of element 'sm:activationSpec' is not complete. One of
'{"http://servicemix.apache.org/config/1.0":destinationResolver,
"http://servicemix.apache.org/config/1.0":interfaceChooser,
"http://servicemix.apache.org/config/1.0":marshaler,
"http://servicemix.apache.org/config/1.0":persistent,
"http://servicemix.apache.org/config/1.0":serviceChooser,
"http://servicemix.apache.org/config/1.0":subscriptions,
WC[##other:"http://servicemix.apache.org/config/1.0"]}' is expected.
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.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown
Source)
at
org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown
Source)
at
org.apache.xerces.impl.xs.XMLSchemaValidator.elementLocallyValidComplexType(Unknown
Source)
at
org.apache.xerces.impl.xs.XMLSchemaValidator.elementLocallyValidType(Unknown
Source)
at
org.apache.xerces.impl.xs.XMLSchemaValidator.processElementContent(Unknown
Source)
at
org.apache.xerces.impl.xs.XMLSchemaValidator.handleEndElement(Unknown
Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.endElement(Unknown
Source)
at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(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:76)
at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:351)
at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:280)
at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:131)
at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:147)
at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:173)
at
org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:112)
at
org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:79)
at
org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:101)
at
org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:389)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:324)
at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:91)
at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:75)
at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:65)
at
com.browsersoft.mergence.rest.RestEndpointTest.createBeanFactory(RestEndpointTest.java:85)
at
org.apache.servicemix.tck.SpringTestSupport.setUp(SpringTestSupport.java:60)
at junit.framework.TestCase.runBare(TestCase.java:132)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at
org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:76)
at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:138)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:125)
at org.apache.maven.surefire.Surefire.run(Surefire.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:290)
at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:818)
any help would be really appreciated.
thanks,
Martin
Re: Problem loading spring configuration in tests
Posted by Bruce Snyder <br...@gmail.com>.
On 8/30/07, Martin Novák <mn...@martinnovak.eu> wrote:
> Bruce, thanks for reply, I figured out this yesterday. I was using
> ClassPathXmlApplicationContext from spring, instead should be used that
> class from xbean
> (org.apache.xbean.spring.context.ClassPathXmlApplicationContext). I
> don't know why did they name the class the same. This leads to stupid
> misunderstandings like that.
I have no idea why. It does use an XBean package path though.
Bruce
--
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'
Apache ActiveMQ - http://activemq.org/
Apache ServiceMix - http://servicemix.org/
Apache Geronimo - http://geronimo.apache.org/
Castor - http://castor.org/
Re: Problem loading spring configuration in tests
Posted by Martin Novák <mn...@martinnovak.eu>.
Bruce, thanks for reply, I figured out this yesterday. I was using
ClassPathXmlApplicationContext from spring, instead should be used that
class from xbean
(org.apache.xbean.spring.context.ClassPathXmlApplicationContext). I
don't know why did they name the class the same. This leads to stupid
misunderstandings like that.
Martin
Bruce Snyder wrote:
> On 8/27/07, Martin Novák <mn...@martinnovak.eu> wrote:
>> Hello, I have a problem running my servicemix unit test. I have a
>> servicemix spring configuration file which is something like that:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <beans xmlns="http://www.springframework.org/schema/beans"
>> xmlns:sm="http://servicemix.apache.org/config/1.0"
>> xmlns:rest="http://www.browsersoft.com/mergence/rest/1.0"
>> xmlns:test="urn:test"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:schemaLocation="
>> http://www.springframework.org/schema/beans
>> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>> http://servicemix.apache.org/config/1.0
>> http://people.apache.org/repo/m2-incubating-repository/org/apache/servicemix/servicemix-core/3.1-incubating/servicemix-core-3.1-incubating.xsd"
>> >
>> <sm:container id="jbi" embedded="true" createMBeanServer="false"
>> createJmxConnector="false">
>> <sm:activationSpecs>
>> <sm:activationSpec id="rest">
>> <sm:component>
>> <bean class="com.browsersoft.mergence.rest.RestEndpoint"></bean>
>> </sm:component>
>> </sm:activationSpec>
>>
>> </sm:activationSpecs>
>> </sm:container>
>> </beans>
>>
>> It seems to be to be ok, but when I run my test derived from
>> SpringTestSupport class, it has a problem:
>>
>> org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
>> Line 46 in XML document from class path resource [rest-test-context.xml]
>> is invalid; nested exception is org.xml.sax.SAXParseException:
>> cvc-complex-type.2.4.b: The content of element 'sm:activationSpec' is
>> not complete. One of
>> '{"http://servicemix.apache.org/config/1.0":destinationResolver,
>> "http://servicemix.apache.org/config/1.0":interfaceChooser,
>> "http://servicemix.apache.org/config/1.0":marshaler,
>> "http://servicemix.apache.org/config/1.0":persistent,
>> "http://servicemix.apache.org/config/1.0":serviceChooser,
>> "http://servicemix.apache.org/config/1.0":subscriptions,
>> WC[##other:"http://servicemix.apache.org/config/1.0"]}' is expected.
>
> The error above says it all - the content of the activationSpec
> element is incomplete. Try replacing the id attribute on the
> activationSpec to componentName. See the basic example that comes with
> ServiceMix for an example of a lightweight configuration.
>
> Bruce
Re: Problem loading spring configuration in tests
Posted by Bruce Snyder <br...@gmail.com>.
On 8/27/07, Martin Novák <mn...@martinnovak.eu> wrote:
> Hello, I have a problem running my servicemix unit test. I have a
> servicemix spring configuration file which is something like that:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:sm="http://servicemix.apache.org/config/1.0"
> xmlns:rest="http://www.browsersoft.com/mergence/rest/1.0"
> xmlns:test="urn:test"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://servicemix.apache.org/config/1.0
> http://people.apache.org/repo/m2-incubating-repository/org/apache/servicemix/servicemix-core/3.1-incubating/servicemix-core-3.1-incubating.xsd"
> >
> <sm:container id="jbi" embedded="true" createMBeanServer="false"
> createJmxConnector="false">
> <sm:activationSpecs>
> <sm:activationSpec id="rest">
> <sm:component>
> <bean class="com.browsersoft.mergence.rest.RestEndpoint"></bean>
> </sm:component>
> </sm:activationSpec>
>
> </sm:activationSpecs>
> </sm:container>
> </beans>
>
> It seems to be to be ok, but when I run my test derived from
> SpringTestSupport class, it has a problem:
>
> org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
> Line 46 in XML document from class path resource [rest-test-context.xml]
> is invalid; nested exception is org.xml.sax.SAXParseException:
> cvc-complex-type.2.4.b: The content of element 'sm:activationSpec' is
> not complete. One of
> '{"http://servicemix.apache.org/config/1.0":destinationResolver,
> "http://servicemix.apache.org/config/1.0":interfaceChooser,
> "http://servicemix.apache.org/config/1.0":marshaler,
> "http://servicemix.apache.org/config/1.0":persistent,
> "http://servicemix.apache.org/config/1.0":serviceChooser,
> "http://servicemix.apache.org/config/1.0":subscriptions,
> WC[##other:"http://servicemix.apache.org/config/1.0"]}' is expected.
The error above says it all - the content of the activationSpec
element is incomplete. Try replacing the id attribute on the
activationSpec to componentName. See the basic example that comes with
ServiceMix for an example of a lightweight configuration.
Bruce
--
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'
Apache ActiveMQ - http://activemq.org/
Apache ServiceMix - http://servicemix.org/
Apache Geronimo - http://geronimo.apache.org/
Castor - http://castor.org/