Announcement Announcement Module
Collapse
No announcement yet.
Possible error in CastorMarshaller Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Possible error in CastorMarshaller

    Hi all,

    I've created an client that uses the CastorMarshaller transform my domain model into a soap message and vise versa. But when I wire it all together I get this error

    Code:
    java.io.IOException: Stream closed
    	at java.io.BufferedInputStream.ensureOpen(BufferedInputStream.java:120)
    	at java.io.BufferedInputStream.read(BufferedInputStream.java:199)
    	at org.apache.xerces.impl.XMLEntityManager$RewindableInputStream.read(XMLEntityManager.java:3358)
    	at org.apache.xerces.impl.XMLEntityManager.startEntity(XMLEntityManager.java:807)
    	at org.apache.xerces.impl.XMLEntityManager.startDocumentEntity(XMLEntityManager.java:741)
    	at org.apache.xerces.impl.XMLDocumentScannerImpl.setInputSource(XMLDocumentScannerImpl.java:260)
    	at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:498)
    	at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:580)
    	at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
    	at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1169)
    	at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:741)
    	at org.castor.mapping.MappingUnmarshaller.loadMappingInternal(MappingUnmarshaller.java:202)
    	at org.castor.mapping.MappingUnmarshaller.getMappingLoader(MappingUnmarshaller.java:124)
    	at org.castor.mapping.MappingUnmarshaller.getMappingLoader(MappingUnmarshaller.java:99)
    	at org.exolab.castor.xml.Unmarshaller.setMapping(Unmarshaller.java:487)
    	at org.exolab.castor.xml.Unmarshaller.<init>(Unmarshaller.java:252)
    	at org.springframework.oxm.castor.CastorMarshaller.afterPropertiesSet(CastorMarshaller.java:141)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:957)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:924)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:415)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:242)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:239)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:155)
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:246)
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:128)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:850)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:624)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:411)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:242)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:239)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:155)
    	at org.springframework.aop.framework.ProxyFactoryBean.initializeAdvisorChain(ProxyFactoryBean.java:438)
    	at org.springframework.aop.framework.ProxyFactoryBean.getObject(ProxyFactoryBean.java:251)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectFromFactoryBean(AbstractBeanFactory.java:935)
    my application context looks like this:
    Code:
    	<bean id="aasWebServiceSoap" class="org.springframework.aop.framework.ProxyFactoryBean">
    		<property name="proxyInterfaces">
    			<value>nl.anwb.aas.AASWebServiceSoap</value>
    		</property>
    		<property name="interceptorNames">
    			<list>
    				<value>soapInterceptor</value>
    			</list>
    		</property>
    	</bean>
    
    	<bean id="soapInterceptor" class="nl.anwb.autoportaal.service.SoapInterceptor">
    		<property name="marshaller" ref="castorMarshaller" />
    		<property name="unmarshaller" ref="castorMarshaller" />
    		<property name="url" value="http://localhost:8080/WebServiceProject/services/AASWebServiceSoap"/>
    	</bean>
    
    	<bean id="castorMarshaller" class="org.springframework.oxm.castor.CastorMarshaller" >
            <property name="mappingLocation" value="classpath:/castor-mapping.xml" />
        </bean>
    I've tried this with spring-omx-m2 and with the latested version from subversion but both give the same error. Does anyone have a clue?

    Thanks.
    Erik Jan

  • #2
    After some google-ing found this castor issue so apperently what is done in the CastorMarshaller is not good when you want to cache the mapping file is this a bug?

    Comment


    • #3
      Originally posted by erikjan View Post
      Hi all,

      I've created an client that uses the CastorMarshaller transform my domain model into a soap message and vise versa.
      Just a note: transforming your domain model to be used in web services is generally not a good idea. By doing that, you are basically making your internal classes part of a public API, and the clients of your web service will not be happy to when you change them.

      I will investigate the bug further, thanks for submitting the JIRA issue!

      Comment


      • #4
        The issue has been resolved. Let me know how it works for you.

        Comment


        • #5
          Works!

          Works great thanks a lot.

          Originally posted by poutsma View Post
          Just a note: transforming your domain model to be used in web services is generally not a good idea. By doing that, you are basically making your internal classes part of a public API, and the clients of your web service will not be happy to when you change them.
          What mean is that I take the xml from the third party saop message and transform it to my own domain model. For the client of my service it's transparant that it was a soap call because it will receive domain model objects just as it did when it called a service that used a datbase to retreive the data.

          Comment

          Working...
          X