Hi,

I am using the camel-castor component to unmarshal a xml file. 

I got a class not found exception when I routed to castor


org.exolab.castor.mapping.MappingException: Could not find the class 
        at
org.exolab.castor.mapping.loader.AbstractMappingLoader.resolveType(AbstractMappingLoader.java:386)
        at
org.exolab.castor.xml.XMLMappingLoader.createClassDescriptor(XMLMappingLoader.java:209)
        at
org.exolab.castor.mapping.loader.AbstractMappingLoader.createClassDescriptors(AbstractMappingLoader.java:275)
        at
org.exolab.castor.xml.XMLMappingLoader.loadMapping(XMLMappingLoader.java:156)
        at
org.castor.mapping.MappingUnmarshaller.getMappingLoader(MappingUnmarshaller.java:162)
        at
org.castor.mapping.MappingUnmarshaller.getMappingLoader(MappingUnmarshaller.java:128)
        at org.exolab.castor.xml.XMLContext.addMapping(XMLContext.java:80)
        at
org.apache.camel.dataformat.castor.AbstractCastorDataFormat.getXmlContext(AbstractCastorDataFormat.java:84)
        at
org.apache.camel.dataformat.castor.AbstractCastorDataFormat.getUnmarshaller(AbstractCastorDataFormat.java:103)
        at
org.apache.camel.dataformat.castor.AbstractCastorDataFormat.unmarshal(AbstractCastorDataFormat.java:74)
        at
org.apache.camel.processor.UnmarshalProcessor.process(UnmarshalProcessor.java:51)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:177)
        at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:143)
        at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:88)
        at
org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
        at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:228)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
        at
org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:66)
        at
org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
        at
org.apache.servicemix.camel.nmr.ServiceMixConsumer.process(ServiceMixConsumer.java:73)
        at
org.apache.servicemix.nmr.core.InternalEndpointWrapper.process(InternalEndpointWrapper.java:86)
        at 
org.apache.servicemix.nmr.core.ChannelImpl.process(ChannelImpl.java:255)
        at 
org.apache.servicemix.nmr.core.ChannelImpl$1.run(ChannelImpl.java:215)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
        at java.lang.Thread.run(Thread.java:613)



Here is the DSL for the castor 


builder.from(fromUri).convertBodyTo(String.class).unmarshal().castor(CASTOR_MAPPING_FILE).to(toUri);

Here is the beans.xml

<?xml version="1.0" encoding="UTF-8"?>
<!-- Licensed to the Apache Software Foundation (ASF) under one or more
contributor 
        license agreements. See the NOTICE file distributed with this work for
additional 
        information regarding copyright ownership. The ASF licenses this file 
to 
        You under the Apache License, Version 2.0 (the "License"); you may not 
use 
        this file except in compliance with the License. You may obtain a copy 
of 
        the License at http://www.apache.org/licenses/LICENSE-2.0 Unless 
required 
        by applicable law or agreed to in writing, software distributed under 
the 
        License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS 
        OF ANY KIND, either express or implied. See the License for the 
specific 
        language governing permissions and limitations under the License. -->

<beans xmlns="http://www.springframework.org/schema/beans";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:osgi="http://camel.apache.org/schema/osgi";
        xmlns:osgix="http://www.springframework.org/schema/osgi-compendium";
        xmlns:ctx="http://www.springframework.org/schema/context";
xmlns:jee="http://www.springframework.org/schema/jee";
        xsi:schemaLocation="
       http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
       http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
       http://camel.apache.org/schema/osgi
http://camel.apache.org/schema/osgi/camel-osgi.xsd
       http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
       http://www.springframework.org/schema/osgi-compendium
http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
       http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
">

        <osgi:camelContext xmlns="http://camel.apache.org/schema/spring";>
                <package>route.provisionManager.webservices</package>
        </osgi:camelContext>

        <bean id="provisionManagementWebservicesClient"
                class="ws.client.ProvisionManagementWebservicesClient" />
        
</beans>



Here is the mapping.xml

<mapping>
        <class name="entity.ProvisionReqVO">
                <map-to xml="ProcessProvisioningOrder"
                
xmlns="http://xmlns.oracle.com/EnterpriseObjects/Core/EBO/ProvisioningOrder/V1";
/>
                <field name="channelName" type="java.lang.String">
                        <bind-xml name="ContextID" node="element"
                                
location="BusinessUnitReference/BusinessUnitIdentification"
xmlns="http://xmlns.oracle.com/EnterpriseObjects/Core/Common/V2"; />
                </field>
                <field name="orderSourceId" type="java.lang.String">
                        <bind-xml name="ID" node="element" 
location="Identification"
                                
xmlns="http://xmlns.oracle.com/EnterpriseObjects/Core/Common/V2"; />
                </field>
                <field name="customerVO" 
type="au.com.melbourneit.xml.entity.CustomerVO">
                        <bind-xml name="CustomerPartyReference" node="element"
                                
xmlns="http://xmlns.oracle.com/EnterpriseObjects/Core/Common/V2"; />
                </field>
                <field name="itemVOs" 
type="au.com.melbourneit.xml.entity.ItemVO"
                        collection="arraylist">
                        <bind-xml name="ProvisioningOrderLine" node="element"
                        
xmlns="http://xmlns.oracle.com/EnterpriseObjects/Core/EBO/ProvisioningOrder/V1";
/>
                </field>
        </class>
</mapping>

I am using a mapping file to specifying the mapping rule. 

My code works when running unit testing but failed when deploying to
servicemix
-- 
View this message in context: 
http://camel.465427.n5.nabble.com/camel-castor-class-not-found-exception-tp2850751p2850751.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to