You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by xiaotao183 <xi...@gmail.com> on 2010/09/23 09:59:21 UTC
camel castor class not found exception
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.
Re: camel castor class not found exception
Posted by xiaotao183 <xi...@gmail.com>.
Hi Claus,
Thanks for the reply.
I ended up constructing the castor context inside the DSL and then assigning
to camel.
--
View this message in context: http://camel.465427.n5.nabble.com/camel-castor-class-not-found-exception-tp2850751p2850818.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel castor class not found exception
Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Sep 23, 2010 at 10:39 AM, xiaotao183 <xi...@gmail.com> wrote:
>
> Hi Claus,
>
> I already converted the castor jars using bnd to osgi-bundle but still no
> luck.
>
Using bnd is just a fallback way to install a jar in osgi. It has its
drawbacks doing it that way.
If the framework is not osgi compliant then it may not work properly with osgi.
Especially when frameworks wants to load resources from the classpath,
you can be in trouble.
If the framework have a pluggable way of providing a custom resource
loader, then we can adapt to that from Camel.
So try looking into Castor documentation / javadoc how to do that.
> I can find a camel-castor osgi bundle shipped with servicemix distribution
> so I assume the castor is already installed as osgi by default
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-castor-class-not-found-exception-tp2850751p2850780.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Claus Ibsen
Apache Camel Committer
Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Re: camel castor class not found exception
Posted by xiaotao183 <xi...@gmail.com>.
Hi Claus,
I already converted the castor jars using bnd to osgi-bundle but still no
luck.
I can find a camel-castor osgi bundle shipped with servicemix distribution
so I assume the castor is already installed as osgi by default
--
View this message in context: http://camel.465427.n5.nabble.com/camel-castor-class-not-found-exception-tp2850751p2850780.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel castor class not found exception
Posted by Claus Ibsen <cl...@gmail.com>.
No every 3rd party framework is osgi compliant and hence they may not
work in Apache ServiceMix 4.x.
You should raise your voice at the Castor project so they hear folks
and so they start releasing versions which are OSGi compliant.
On Thu, Sep 23, 2010 at 9:59 AM, xiaotao183 <xi...@gmail.com> wrote:
>
> 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.
>
--
Claus Ibsen
Apache Camel Committer
Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus