I am getting error in unmarshalling to custom data format. It is working
successfully in Java DSL approach, now I need to convert it in Spring DSL
where I am getting error.
camel-context.xml
<bean id="wynFlatFileDataFormat"
class="ign.wyn.integration.common.dataformat.csv.WynFlatFileDataFormat" />
<camelContext trace="true"
xmlns="http://camel.apache.org/schema/spring">
<camel:route id="processInputFile">
<camel:from uri="direct:processFileImport"/>
<camel:unmarshal>
<camel:custom
ref="wynFlatFileDataFormat"/>
</camel:unmarshal>
<camel:to uri="direct:generateOutput" />
</camel:route>
</camelContext>
WynFlatFileDataFormat -
public class WynFlatFileDataFormat extends ServiceSupport implements
DataFormat, IWynIntegrationConstants {
public Map<String, WynFlatFileDefinitionBean> unmarshal(Exchange exchange,
InputStream stream) throws Exception {
// processing stream data and putting in a Map<String,
WynFlatFileDefinitionBean> taskBeanMap.
// returning taskBeanMap
}
}
WynFlatFileDefinitionBean -
public class WynFlatFileDefinitionBean implements Serializable {
// getters and setters
}
Error trace -
[ main] DefaultListableBeanFactory DEBUG
Returning cached instance of singleton bean 'wynFlatFileDataFormat'
[ main] BeanUtils DEBUG No
property editor [org.apache.camel.model.DataFormatDefinitionEditor] found
for type org.apache.camel.model.DataFormatDefinition according to 'Editor'
suffix convention
[ main] DefaultListableBeanFactory DEBUG Failed
to convert bean 'wynFlatFileDataFormat' to required type
[org.apache.camel.model.DataFormatDefinition]
org.springframework.beans.ConversionNotSupportedException: Failed to convert
value of type
[ign.wyn.integration.common.dataformat.csv.WynFlatFileDataFormat] to
required type [org.apache.camel.model.DataFormatDefinition]; nested
exception is java.lang.IllegalStateException: Cannot convert value of type
[ign.wyn.integration.common.dataformat.csv.WynFlatFileDataFormat] to
required type [org.apache.camel.model.DataFormatDefinition]: no matching
editors or conversion strategy found
at
org.springframework.beans.TypeConverterSupport.doConvert(TypeConverterSupport.java:74)[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE]
.
.
.
.
.
Exception in thread "main" org.apache.camel.RuntimeCamelException:
org.apache.camel.FailedToCreateRouteException: Failed to create route
processItemDimensionFile at: >>> Marshal[ref:wynCsvDataFormat] <<< in route:
Route(processItemDimensionFile)[[From[direct:processItemDime... because of
Either packages or classType must be specified
at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1690)
at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:138)
at
org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:340)
at
org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:163)
at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:136)
at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:381)
at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:335)
at
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:855)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
at
org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:213)
at org.apache.camel.spring.Main.doStart(Main.java:153)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at
ign.wyn.integration.initiator.WynImportInitiator.main(WynImportInitiator.java:32)
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create
route processItemDimensionFile at: >>> Marshal[ref:wynCsvDataFormat] <<< in
route: Route(processItemDimensionFile)[[From[direct:processItemDime...
because of Either packages or classType must be specified
at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1072)
at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:196)
at
org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:974)
at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3301)
at
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3024)
at
org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:175)
at
org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2854)
at
org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2850)
at
org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2873)
at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2850)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2819)
at
org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:270)
at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:136)
... 13 more
Caused by: java.lang.IllegalArgumentException: Either packages or classType
must be specified
at
org.apache.camel.model.dataformat.BindyDataFormat.createDataFormat(BindyDataFormat.java:98)
at
org.apache.camel.model.DataFormatDefinition.getDataFormat(DataFormatDefinition.java:103)
at
org.apache.camel.model.DataFormatDefinition.getDataFormat(DataFormatDefinition.java:78)
at
org.apache.camel.model.MarshalDefinition.createProcessor(MarshalDefinition.java:177)
at
org.apache.camel.model.ProcessorDefinition.makeProcessorImpl(ProcessorDefinition.java:534)
at
org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:495)
at
org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:219)
at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1069)
... 26 more
Working Java DSL Statement for the same -
from("direct:processFileImport").unmarshal(new
WynFlatFileDataFormat()).to("direct:splitData");
Would appreciate any help!
Thanks,
Amruta
--
View this message in context:
http://camel.465427.n5.nabble.com/Error-in-Unmarshalling-to-custom-data-format-tp5794344.html
Sent from the Camel - Users mailing list archive at Nabble.com.