Announcement Announcement Module
Collapse
No announcement yet.
Castor is unable to find the correct class for unmarshalling a request Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Castor is unable to find the correct class for unmarshalling a request

    I have created an endpoint using Castor as the marshalling framework. However, when a request comes into the engine, I get the following message:
    Code:
    org.springframework.oxm.castor.CastorUnmarshallingFailureException: Castor unmarshalling exception: The class for the root element 'FindClaims' could not be found.; nested exception is The class for the root element 'FindClaims' could not be found.
    Caused by: 
    The class for the root element 'FindClaims' could not be found.
    	at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:589)
    	at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:735)
    	at org.springframework.oxm.castor.CastorMarshaller.unmarshalDomNode(CastorMarshaller.java:194)
    	at org.springframework.oxm.AbstractMarshaller.unmarshalDomSource(AbstractMarshaller.java:259)
    	at org.springframework.oxm.AbstractMarshaller.unmarshal(AbstractMarshaller.java:126)
    	at org.springframework.ws.endpoint.AbstractMarshallingPayloadEndpoint.invoke(AbstractMarshallingPayloadEndpoint.java:44)
    	at org.springframework.ws.endpoint.MessageEndpointAdapter.invoke(MessageEndpointAdapter.java:32)
    	at org.springframework.ws.MessageDispatcher.dispatch(MessageDispatcher.java:247)
    	at org.springframework.ws.MessageDispatcher.invoke(MessageDispatcher.java:209)
    	at org.springframework.ws.transport.http.MessageHandlerAdapter.handle(MessageHandlerAdapter.java:57)
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:797)
    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:727)
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396)
    	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:360)
    After doing some research, It appears that the class org.exolab.castor.xml.Unmarshaller needs to know the class type in order to unmarshal the XML. I am not using a Castor mapping file, so I thought maybe I should specify the class type on the bean org.springframework.oxm.castor.CastorMarshaller, but there is no property that I can set. Is anyone else having this problem?
    Shannon Kendrick

  • #2
    Originally posted by mskendrick
    ...
    After doing some research, It appears that the class org.exolab.castor.xml.Unmarshaller needs to know the class type in order to unmarshal the XML. I am not using a Castor mapping file, so I thought maybe I should specify the class type on the bean org.springframework.oxm.castor.CastorMarshaller, but there is no property that I can set. Is anyone else having this problem?
    Unfortunately, the castor web site is down right now, so there is no really easy way for me to verify this.

    The easy way to solve this is to do use a mapping file. The format is quite simple, there is a sample in the src/etc/test-resources directory of the oxm project.

    However, if you really want the ability to register a single class with the org.springframework.oxm.castor.CastorMarshaller, I could add that functionality. Just file an issue for it over at the SWS JIRA.

    Cheers,

    Comment


    • #3
      Thinking to work around the problem I'm getting using JAXB:

      http://forum.springframework.org/showthread.php?t=26464

      ...I thought I would try Castor instead. I did get by the JAXB problem, i.e. the app deploys ok, but we are hitting this problem as well.

      Even on a small xml schema, Castor is generating over 100 classes, and we're going to ramp up to 5-10 times that amount soon, so I don't think that creating a mapping file by hand for each of those hundreds of classes is going to be a viable solution, if I understand your solution in this forum thread.

      Thoughts?

      Ben

      Comment


      • #4
        Originally posted by benethridge
        Thinking to work around the problem I'm getting using JAXB:

        http://forum.springframework.org/showthread.php?t=26464

        ...I thought I would try Castor instead. I did get by the JAXB problem, i.e. the app deploys ok, but we are hitting this problem as well.
        I find it unlikely that that is a JAXB error. It seems more likely that it is a problem with the schema itself. If you want me to look at it, you can post the complete schema on the forum.

        Originally posted by benethridge
        Even on a small xml schema, Castor is generating over 100 classes, and we're going to ramp up to 5-10 times that amount soon, so I don't think that creating a mapping file by hand for each of those hundreds of classes is going to be a viable solution, if I understand your solution in this forum thread.
        Wow. I wonder why is it generating so much classes.

        The feature requested in this thread has been implemented in the latest snapshot release: i.e. you can now map a Castor marshaller to one class. That doesn't really help you, though, since you would basically have to define one CastorMarshaller for each and every XML element that can occur in the SOAP body.

        Comment


        • #5
          Originally posted by poutsma
          Wow. I wonder why is it generating so much classes.
          Looks like Castor defaults to generating one class per element, plus two for each type, yes?

          Fyi, going on vacation for 2 weeks after today, so I'll have to get back to you about the JAXB later. I'm going to try putting a simpleType enumeration in the airline sample, to see if I get the problem, to try to narrow down whether the problem is in my schema or JAXB, as you say.

          Ben

          Comment

          Working...
          X