You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by jkob <ja...@gmail.com> on 2013/02/07 15:01:05 UTC

convertBodyTo object array

Hello,

I use the following in my Java code to route the data from a rest service to
a jms queue:

from("cxfrs:bean:rsServer")
	.setExchangePattern(ExchangePattern.InOnly)
	.convertBodyTo(Object[].class)
	.to("activemq:foo");

I want to change the configuration to XML. But I still have not found out,
how to configure the conversion correctly. The following results in a
ClassNotFoundException

<route>
	<from uri="cxfrs:bean:rsServer" />
	<setExchangePattern pattern="InOnly" />
	<convertBodyTo type="java.lang.Object[]" />
	<to uri="activemq:foo" />
</route>

Full stracktrace see below.
Running in fuse-esb-7.0.0.fuse-061 with camel 2.9.0.

Hope anybody can help me.
Regards,

Jakob



org.apache.camel.RuntimeCamelException:
org.apache.camel.FailedToCreateRouteException: Failed to create route
database-events at: >>> ConvertBodyTo[java.lang.Object[]] <<< in route:
Route[[From[cxfrs:bean:rsServer]] -> [setExchangePattern[pat... because of
java.lang.Object[]
	at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1253)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
	at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:122)[140:org.apache.camel.camel-spring:2.9.0.fuse-7-061]
	at
org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:242)[140:org.apache.camel.camel-spring:2.9.0.fuse-7-061]
	at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)[102:org.springframework.context:3.0.7.RELEASE]
	at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)[102:org.springframework.context:3.0.7.RELEASE]
	at
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)[102:org.springframework.context:3.0.7.RELEASE]
	at
org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.java:235)[108:org.springframework.osgi.core:1.2.1]
	at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:358)[108:org.springframework.osgi.core:1.2.1]
	at
org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[108:org.springframework.osgi.core:1.2.1]
	at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[108:org.springframework.osgi.core:1.2.1]
	at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)[111:org.springframework.osgi.extender:1.2.1]
	at java.lang.Thread.run(Thread.java:722)[:1.7.0_05]
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create
route database-events at: >>> ConvertBodyTo[java.lang.Object[]] <<< in
route: Route[[From[cxfrs:bean:rsServer]] -> [setExchangePattern[pat...
because of java.lang.Object[]
	at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:874)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
	at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:171)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
	at
org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:702)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
	at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1729)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
	at
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1523)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
	at
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1413)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
	at
org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:181)[140:org.apache.camel.camel-spring:2.9.0.fuse-7-061]
	at
org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
	at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1381)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
	at
org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:230)[140:org.apache.camel.camel-spring:2.9.0.fuse-7-061]
	at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:120)[140:org.apache.camel.camel-spring:2.9.0.fuse-7-061]
	... 10 more
Caused by: java.lang.ClassNotFoundException: java.lang.Object[]
	at
org.apache.camel.impl.DefaultClassResolver.resolveMandatoryClass(DefaultClassResolver.java:52)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
	at
org.apache.camel.model.ConvertBodyDefinition.createProcessor(ConvertBodyDefinition.java:92)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
	at
org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:440)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
	at
org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:178)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
	at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:871)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
	... 20 more



--
View this message in context: http://camel.465427.n5.nabble.com/convertBodyTo-object-array-tp5727124.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: convertBodyTo object array

Posted by Claus Ibsen <cl...@gmail.com>.
No

You can create your own type converter or use a camel processor or
java bean etc.

On Sun, Apr 28, 2013 at 9:45 AM, Darwish <ot...@progressoft.com> wrote:
> Hi ,
> any XML DSL workaround ? my version is  2.10.1
>
> Thanks,
>
>
>
>
> -----
> Othman Darwish
> ProgressSoft Corp.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/convertBodyTo-object-array-tp5727124p5731678.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: convertBodyTo object array

Posted by Darwish <ot...@progressoft.com>.
Hi ,
any XML DSL workaround ? my version is  2.10.1

Thanks,




-----
Othman Darwish
ProgressSoft Corp.

--
View this message in context: http://camel.465427.n5.nabble.com/convertBodyTo-object-array-tp5727124p5731678.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: convertBodyTo object array

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I have logged a ticket to improve this
https://issues.apache.org/jira/browse/CAMEL-6051

On Thu, Feb 7, 2013 at 3:01 PM, jkob <ja...@gmail.com> wrote:
> Hello,
>
> I use the following in my Java code to route the data from a rest service to
> a jms queue:
>
> from("cxfrs:bean:rsServer")
>         .setExchangePattern(ExchangePattern.InOnly)
>         .convertBodyTo(Object[].class)
>         .to("activemq:foo");
>
> I want to change the configuration to XML. But I still have not found out,
> how to configure the conversion correctly. The following results in a
> ClassNotFoundException
>
> <route>
>         <from uri="cxfrs:bean:rsServer" />
>         <setExchangePattern pattern="InOnly" />
>         <convertBodyTo type="java.lang.Object[]" />
>         <to uri="activemq:foo" />
> </route>
>
> Full stracktrace see below.
> Running in fuse-esb-7.0.0.fuse-061 with camel 2.9.0.
>
> Hope anybody can help me.
> Regards,
>
> Jakob
>
>
>
> org.apache.camel.RuntimeCamelException:
> org.apache.camel.FailedToCreateRouteException: Failed to create route
> database-events at: >>> ConvertBodyTo[java.lang.Object[]] <<< in route:
> Route[[From[cxfrs:bean:rsServer]] -> [setExchangePattern[pat... because of
> java.lang.Object[]
>         at
> org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1253)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
>         at
> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:122)[140:org.apache.camel.camel-spring:2.9.0.fuse-7-061]
>         at
> org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:242)[140:org.apache.camel.camel-spring:2.9.0.fuse-7-061]
>         at
> org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)[102:org.springframework.context:3.0.7.RELEASE]
>         at
> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)[102:org.springframework.context:3.0.7.RELEASE]
>         at
> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)[102:org.springframework.context:3.0.7.RELEASE]
>         at
> org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleApplicationContext.java:235)[108:org.springframework.osgi.core:1.2.1]
>         at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:358)[108:org.springframework.osgi.core:1.2.1]
>         at
> org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[108:org.springframework.osgi.core:1.2.1]
>         at
> org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[108:org.springframework.osgi.core:1.2.1]
>         at
> org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)[111:org.springframework.osgi.extender:1.2.1]
>         at java.lang.Thread.run(Thread.java:722)[:1.7.0_05]
> Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create
> route database-events at: >>> ConvertBodyTo[java.lang.Object[]] <<< in
> route: Route[[From[cxfrs:bean:rsServer]] -> [setExchangePattern[pat...
> because of java.lang.Object[]
>         at
> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:874)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
>         at
> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:171)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
>         at
> org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:702)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
>         at
> org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1729)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
>         at
> org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1523)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
>         at
> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1413)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
>         at
> org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:181)[140:org.apache.camel.camel-spring:2.9.0.fuse-7-061]
>         at
> org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
>         at
> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1381)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
>         at
> org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:230)[140:org.apache.camel.camel-spring:2.9.0.fuse-7-061]
>         at
> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:120)[140:org.apache.camel.camel-spring:2.9.0.fuse-7-061]
>         ... 10 more
> Caused by: java.lang.ClassNotFoundException: java.lang.Object[]
>         at
> org.apache.camel.impl.DefaultClassResolver.resolveMandatoryClass(DefaultClassResolver.java:52)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
>         at
> org.apache.camel.model.ConvertBodyDefinition.createProcessor(ConvertBodyDefinition.java:92)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
>         at
> org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:440)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
>         at
> org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:178)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
>         at
> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:871)[138:org.apache.camel.camel-core:2.9.0.fuse-7-061]
>         ... 20 more
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/convertBodyTo-object-array-tp5727124.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen