PDA

View Full Version : CastorMarshaller Mapping File Issue



musky
Nov 3rd, 2006, 02:20 PM
Sorry if I have posted this in the wrong project.

I am using org.springframework.oxm.castor.CastorMarshaller to inject my mapping location and receiving a 'Stream closed' error. Any thoughts or direction would be appreciated. Thanks.


Here is my applicationContext-castor.xml



<bean id="castorMarshaller" class="org.springframework.oxm.castor.CastorMarshaller">
<property name="mappingLocation" value="com/td/ods/test/ws/applicationContext-castor.xml" />
</bean>

<bean id="castorXmlHelper" class="com.td.ods.util.xml.CastorXmlHelper">
<property name="marshaller" ref="castorMarshaller" />
<property name="unmarshaller" ref="castorMarshaller" />
</bean>



Here is the error:



org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'castorMarshaller' defined in class path resource [com/td/ods/test/ws/applicationContext-castor.xml]: Initialization of bean failed; nested exception is org.springframework.oxm.castor.CastorSystemExcepti on: Could not load Castor mapping: Nested error: Stream closed; nested exception is org.exolab.castor.mapping.MappingException: Nested error: Stream closed
org.springframework.oxm.castor.CastorSystemExcepti on: Could not load Castor mapping: Nested error: Stream closed; nested exception is org.exolab.castor.mapping.MappingException: Nested error: Stream closed
Stream closed
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmar shaller.java:717)
at org.castor.mapping.MappingUnmarshaller.loadMapping Internal(MappingUnmarshaller.java:203)
at org.castor.mapping.MappingUnmarshaller.getMappingL oader(MappingUnmarshaller.java:124)
at org.castor.mapping.MappingUnmarshaller.getMappingL oader(MappingUnmarshaller.java:99)
at org.exolab.castor.xml.Unmarshaller.setMapping(Unma rshaller.java:483)
at org.exolab.castor.xml.Unmarshaller.<init>(Unmarshaller.java:249)
at org.springframework.oxm.castor.CastorMarshaller.af terPropertiesSet(CastorMarshaller.java:141)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1091)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:396)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:233)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:145)
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:283)
at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:313)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationContext.java:87)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationContext.java:72)
at org.springframework.test.AbstractSpringContextTest s.loadContextLocations(AbstractSpringContextTests. java:135)
at org.springframework.test.AbstractDependencyInjecti onSpringContextTests.loadContextLocations(Abstract DependencyInjectionSpringContextTests.java:224)
at org.springframework.test.AbstractSpringContextTest s.getContext(AbstractSpringContextTests.java:115)
at org.springframework.test.AbstractDependencyInjecti onSpringContextTests.setUp(AbstractDependencyInjec tionSpringContextTests.java:192)
at junit.framework.TestCase.runBare(TestCase.java:125 )
at junit.framework.TestResult$1.protect(TestResult.ja va:106)
at junit.framework.TestResult.runProtected(TestResult .java:124)
at junit.framework.TestResult.run(TestResult.java:109 )
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:2 08)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit 3TestReference.run(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecutio n.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:196)
Caused by: java.io.IOException: Stream closed
at java.io.BufferedInputStream.getBufIfOpen(BufferedI nputStream.java:145)
at java.io.BufferedInputStream.read(BufferedInputStre am.java:304)
at org.apache.xerces.utils.ChunkyByteArray.fill(Chunk yByteArray.java:222)
at org.apache.xerces.utils.ChunkyByteArray.<init>(ChunkyByteArray.java:98)
at org.apache.xerces.readers.DefaultReaderFactory.cre ateReader(DefaultReaderFactory.java:153)
at org.apache.xerces.readers.DefaultEntityHandler.sta rtReadingFromDocument(DefaultEntityHandler.java:49 1)
at org.apache.xerces.framework.XMLParser.parseSomeSet up(XMLParser.java:310)
at org.apache.xerces.framework.XMLParser.parse(XMLPar ser.java:1034)
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmar shaller.java:708)
... 31 more
Caused by: java.io.IOException: Stream closed
at java.io.BufferedInputStream.getBufIfOpen(BufferedI nputStream.java:145)
at java.io.BufferedInputStream.read(BufferedInputStre am.java:304)
at org.apache.xerces.utils.ChunkyByteArray.fill(Chunk yByteArray.java:222)
at org.apache.xerces.utils.ChunkyByteArray.<init>(ChunkyByteArray.java:98)
at org.apache.xerces.readers.DefaultReaderFactory.cre ateReader(DefaultReaderFactory.java:153)
at org.apache.xerces.readers.DefaultEntityHandler.sta rtReadingFromDocument(DefaultEntityHandler.java:49 1)
at org.apache.xerces.framework.XMLParser.parseSomeSet up(XMLParser.java:310)
at org.apache.xerces.framework.XMLParser.parse(XMLPar ser.java:1034)
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmar shaller.java:708)
at org.castor.mapping.MappingUnmarshaller.loadMapping Internal(MappingUnmarshaller.java:203)
at org.castor.mapping.MappingUnmarshaller.getMappingL oader(MappingUnmarshaller.java:124)
at org.castor.mapping.MappingUnmarshaller.getMappingL oader(MappingUnmarshaller.java:99)
at org.exolab.castor.xml.Unmarshaller.setMapping(Unma rshaller.java:483)
at org.exolab.castor.xml.Unmarshaller.<init>(Unmarshaller.java:249)
at org.springframework.oxm.castor.CastorMarshaller.af terPropertiesSet(CastorMarshaller.java:141)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1091)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:396)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:233)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:145)
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:283)
at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:313)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationContext.java:87)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationContext.java:72)
at org.springframework.test.AbstractSpringContextTest s.loadContextLocations(AbstractSpringContextTests. java:135)
at org.springframework.test.AbstractDependencyInjecti onSpringContextTests.loadContextLocations(Abstract DependencyInjectionSpringContextTests.java:224)
at org.springframework.test.AbstractSpringContextTest s.getContext(AbstractSpringContextTests.java:115)
at org.springframework.test.AbstractDependencyInjecti onSpringContextTests.setUp(AbstractDependencyInjec tionSpringContextTests.java:192)
at junit.framework.TestCase.runBare(TestCase.java:125 )
at junit.framework.TestResult$1.protect(TestResult.ja va:106)
at junit.framework.TestResult.runProtected(TestResult .java:124)
at junit.framework.TestResult.run(TestResult.java:109 )
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:2 08)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit 3TestReference.run(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecutio n.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:196)


Mapping file is empty:


<?xml version="1.0"?>
<mapping>
<description>Castor mapping all classes</description>

</mapping>

Arjen Poutsma
Nov 3rd, 2006, 05:32 PM
Sounds like could be having the same problems as discussed in this thread. The issue has been resolved in subversion, which means you can use a nighly snapshot (http://www.springframework.org/spring-ws/snapshots) to get a fix.

Let me know if that works for you.