Announcement Announcement Module
Collapse
No announcement yet.
need help with marshalling Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • need help with marshalling

    Hi!
    I'm trying to do a Web Service with Jaxb1Marshaller. The error that I get when I try to execute is the following :

    java.lang.NoClassDefFoundError: es/munimadrid/formularios/schemas/TipoLiquidacion

    My applicationContext is like this:
    ...
    <bean id="formulariosMarshallingEndpoint" class="iam.formularios.ws.FormulariosMarshallingEn dpoint">
    <description>
    This endpoint handles solicitud request.
    </description>
    <property name="formulariosManager"><ref bean="formulariosManager"/></property>
    <property name="marshaller" ref="jaxbMarshaller"/>
    <property name="unmarshaller" ref="jaxbMarshaller"/>
    </bean>
    <bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb1Marshalle r">
    <description>
    The validating JAXB Marshaller is used by the getFlightsEndpoint to unmarshal XML to objects and
    vice-versa.
    </description>
    <property name="contextPath" value="es.munimadrid.formularios.schemas"/>
    <property name="validating" value="true"/>
    </bean>
    ...

    I've generated the schemas and they are ok... I did this web service before but without Marshalling and it worked fine . Now I'd like to try to do it this new way.

    I'm new with web services so I've got no idea about what can be happening. I've got airline sample as reference. I hope you can help me.

    Thanks in advance.

  • #2
    Is this class that caused the error in a jar or a directory (the latter being a "regular" class you wrote)?

    Usually (but not always) the solution to this is simple: Somehow, you need to expose the class to the app server's (ex: tomcat's) classpath.

    Those spaces shown in your applicationContext aren't real, are they?

    Ben

    Comment


    • #3
      You might have to run the JAXB 1 code generation tool, i.e. the XJC ant task. That generates the classes for your schema, mapped in the es.munimadrid.formularios.schemas context path.

      Afterwards, these classes obviously have to be compiled, and become part of your classpath, like Ben suggested.

      Comment


      • #4
        benethridge: what do you want to mean about the spaces, the ones that apperar at the bean's classes?? if you refer to that no, a haven't them in my applicationContext. That must be because of the message editor when I copied the text.

        About the classpath... That's already done, any other suggestions??

        I'll show you my applicationContext because maybe I've fogotten something there:

        <beans>
        <!-- ========== BUSINESS OBJECT DEFINITIONS ========= -->

        <bean id="txProxyTemplate" abstract="true"
        class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
        <property name="transactionManager"><ref bean="transactionManager"/></property>
        <property name="transactionAttributes">
        <props>
        <prop key="save*">PROPAGATION_REQUIRED</prop>
        <prop key="remove*">PROPAGATION_REQUIRED</prop>
        <prop key="loadFormularioLiquidacion">PROPAGATION_REQUIR ED,-FormulariosException</prop>
        <prop key="*">PROPAGATION_REQUIRED</prop>
        </props>
        </property>
        </bean>

        <bean id="formulariosManager" parent="txProxyTemplate">
        <property name="target">
        <bean class="iam.formularios.service.impl.FormulariosMan agerImpl" autowire="byName"/>
        </property>
        </bean>

        <!-- =============== WEB SERVICE =============== -->

        <bean id="messageDispatcher" class="org.springframework.ws.soap.SoapMessageDisp atcher">
        <property name="endpointMappings">
        <list>
        <ref local="payloadMapping"/>
        </list>
        </property>
        <property name="endpointExceptionResolvers">
        <list>
        <ref local="endpointExceptionResolver"/>
        </list>
        </property>
        </bean>

        <bean id="payloadMapping" class="org.springframework.ws.soap.endpoint.Payloa dRootQNameEndpointMapping">
        <property name="mappings">
        <props>
        <prop key="{http://www.munimadrid.es/formularios/schemas}FormularioRequest">
        formulariosMarshallingEndpoint
        </prop>
        </props>
        </property>
        <property name="interceptors">
        <list>
        <ref local="loggingInterceptor"/>
        <ref local="validatingInterceptor"/>
        </list>
        </property>
        </bean>

        <bean id="loggingInterceptor" class="org.springframework.ws.endpoint.PayloadLogg ingInterceptor">
        <description>
        This interceptor logs the message payload.
        </description>
        </bean>

        <bean id="validatingInterceptor" class="org.springframework.ws.endpoint.PayloadVali datingInterceptor">
        <description>
        This interceptor validates both incoming and outgoing message contents according to the 'Formularios.xsd' XML
        Schema file.
        </description>
        <property name="schema" value="Formularios.xsd"/>
        <property name="validateRequest" value="true"/>
        <property name="validateResponse" value="true"/>
        </bean>

        <bean id="formulariosMarshallingEndpoint" class="iam.formularios.ws.FormulariosMarshallingEn dpoint">
        <description>
        This endpoint handles solicitud request.
        </description>
        <property name="formulariosManager"><ref bean="formulariosManager"/></property>
        <property name="marshaller" ref="jaxbMarshaller"/>
        <property name="unmarshaller" ref="jaxbMarshaller"/>
        </bean>

        <bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb1Marshalle r">
        <property name="contextPath" value="iam.munimadrid.formularios.schemas"/>
        <property name="validating" value="true"/>
        </bean>

        <bean id="endpointExceptionResolver" class="org.springframework.ws.soap.endpoint.SoapFa ultMappingExceptionResolver">
        <property name="defaultFault">
        <value>RECEIVER,Server error</value>
        </property>
        <property name="exceptionMappings">
        <props>
        <prop key="org.springframework.oxm.UnmarshallingExceptio n">SENDER,Invalid request</prop>
        <prop key="org.springframework.oxm.ValidationFailureExce ption">SENDER,Invalid request</prop>
        </props>
        </property>
        </bean>

        </beans>

        Comment


        • #5
          Yes, that's what I meant. Did you get this solved?

          Ben

          Comment


          • #6
            No, I still have it... but thanks a lot anyway.

            Comment


            • #7
              Did you run the XJC tool or ant task like I suggested?

              Comment

              Working...
              X