You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by jay <my...@gmail.com> on 2013/07/27 19:59:28 UTC
Unable to instantiate the aggregation route - Error in Camel 2.10.4
Hi - i am using Aggregation Strategy for my requirement - while deploying
the bundle in Fuse ESB7.1 blueprint is failing with
org.osgi.service.blueprint.container.ComponentDefinitionException for my
bundle.
Error:Caused by: org.apache.camel.RuntimeCamelException:
java.lang.InstantiationException: com.xx.xx.xx.ABCAggregationRoute
at org.apache.camel.util.ObjectHelper.newInstance(ObjectHelper.java:1168)
at
org.apache.camel.util.ReflectionInjector.newInstance(ReflectionInjector.java:32)
at
org.apache.camel.impl.DefaultInjector.newInstance(DefaultInjector.java:45)
at
org.apache.camel.blueprint.PackageScanRouteBuilderFinder.instantiateBuilder(PackageScanRouteBuilderFinder.java:110)
at
org.apache.camel.blueprint.PackageScanRouteBuilderFinder.appendBuilders(PackageScanRouteBuilderFinder.java:72)
at
org.apache.camel.blueprint.CamelContextFactoryBean.findRouteBuildersByPackageScan(CamelContextFactoryBean.java:265)
at
org.apache.camel.core.xml.AbstractCamelContextFactoryBean.findRouteBuilders(AbstractCamelContextFactoryBean.java:671)
at
org.apache.camel.core.xml.AbstractCamelContextFactoryBean.afterPropertiesSet(AbstractCamelContextFactoryBean.java:275)
My Code:
bluprint file-
// -----------------//
<cm:property-placeholder persistent-id="xxxx" update-strategy="reload" >
<cm:default-properties>
<cm:property name="ACTIVEMQ_INBOUND"
value="activemq:incomingFiles"/>
<cm:property name="ACTIVEMQ_ERROR_OUTBOUND" value="Errored"/>
<cm:property name="ACTIVEMQ_OUTBOUND"
value="activemq:processedFiles"/>
</cm:default-properties>
</cm:property-placeholder>
<camelContext id="xxxx" trace="false"
xmlns="http://camel.apache.org/schema/blueprint">
<camel:package>com.xxx.xxx.routes</camel:package>
</camelContext>
<bean id="AggregationRoute" class="com.xx.xx.xx.ABCAggregationRoute">
<constructor-arg value="${ACTIVEMQ_INBOUND}"/>
<constructor-arg value="${ACTIVEMQ_ERROR_OUTBOUND}"/>
<constructor-arg value="${ACTIVEMQ_OUTBOUND}"/>
<property name="xxxProcessor" ref="xxxProcessor"/>
</bean>
//-----------------//
JavaDSL file:
MainRoute Class (ABCAggregationRoute):
from(ACTIVEMQ_INBOUND)
.aggregate(header("XYZ"), new InnerClassAggregator()) //
below inner class i am calling here
.completionTimeout(getAggregationTimeout())
//.marshal(jaxb)
.to(ACTIVEMQ_OUTBOUND) ;
Interclass for the MainRoute (InnerClassAggregator):
InnerClassAggregator implements AggregationStrategy {
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
ArrayList objList =null;
Object objNew = (Object)newExchange.getIn().getBody(Object.class);
if(oldExchange == null){
objList = new ArrayList();
objList.add(objNew) ;
newExchange.getIn().setBody(objList);
return newExchange;
}
else{
objList=oldExchange.getIn().getBody(ArrayList.class);
objList.add(objNew);
return oldExchange;
}
}
Can some one please let me know your views what is wrong with my code as i
am struggling to get this deployed in container. (i am using camel 2.10.4
and fuseesb 7.1)
--
View this message in context: http://servicemix.396122.n5.nabble.com/Unable-to-instantiate-the-aggregation-route-Error-in-Camel-2-10-4-tp5717416.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: Unable to instantiate the aggregation route - Error in Camel
2.10.4
Posted by jay <my...@gmail.com>.
This has been sorted out as my code was corrected.
--
View this message in context: http://servicemix.396122.n5.nabble.com/Unable-to-instantiate-the-aggregation-route-Error-in-Camel-2-10-4-tp5717416p5717447.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: Unable to instantiate the aggregation route - Error in Camel
2.10.4
Posted by jay <my...@gmail.com>.
Hi i am getting below error when i run my bundle:
13:01:22,974 | WARN | teTimeoutChecker | JmsBinding |
154 - org.apache.camel.camel-jms - 2.10.0.fuse-71-047 | Cannot determine
specific JmsMessage type to use from body class. Will use generic
JmsMessage. Body class: com.xx.xx.MyJAXBType. If you want to send a POJO
then your class might need to implement java.io.Serializable, or you can
force a specific type by setting the jmsMessageType option on the JMS
endpoint.
Context: i am sending some xml files to the camel route which uses the
aggregate and processor to process the files.
i have a my JaxB classes to map the xml elements and process the exchange.
My route class Code:
JaxbDataFormat dataFormat = new JaxbDataFormat(true);
dataFormat.setContextPath("xx.xx.xx"); // my jaxb package
errorHandler(deadLetterChannel("activemq:erroredMessages"));
from("activemq:incomingFiles")
.unmarshal(dataFormat)
.aggregate(header(Exchange.FILE_NAME_ONLY), new MyAggregator())
.completionTimeout(getAggregationTimeout())
.process(new MyProcessor())
.to("activemq:processedFiles")
.end();
MyProcessor code:
JAXBElement<xx.xx.xx.MyJaxBType> objJAXB =
(JAXBElement<MyJaxBType>)exchange.getIn().getBody();
MyJaxBType valueJAXB = objJAXB.getValue(); // i am not getting the exchage
value though exchange is not null.
I appreciate if someone can evaluate my code and throw pointer to correct
it?
--
View this message in context: http://servicemix.396122.n5.nabble.com/Unable-to-instantiate-the-aggregation-route-Error-in-Camel-2-10-4-tp5717416p5717437.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: Unable to instantiate the aggregation route - Error in Camel
2.10.4
Posted by jay <my...@gmail.com>.
Hi Claus, Thank you. it worked.
--
View this message in context: http://servicemix.396122.n5.nabble.com/Unable-to-instantiate-the-aggregation-route-Error-in-Camel-2-10-4-tp5717416p5717436.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: Unable to instantiate the aggregation route - Error in Camel 2.10.4
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
You need to route the message somewhere after the aggregate (eg it has
no children).
eg before .end() add something like (just routing to a log in this example)
.aggregate(...)
.to("log:somwhere).end();
On Mon, Jul 29, 2013 at 11:12 AM, jay <my...@gmail.com> wrote:
> Hi- I am getting the following error when i run the aggregartor in main
> method;
>
>
>
> Exception in thread "main" org.apache.camel.FailedToCreateRouteException:
> Failed to create route route1 at: >>> Aggregate[header{ABC} -> []] <<< in
> route: Route[[From[activemq:inMessages]] -> [Aggregate[header{ABC} ...
> because of Definition has no children on Aggregate[header{ABC} -> []]
> at
> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:879)
> at
> org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:172)
> at
> org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:722)
> at
> org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1789)
>
>
> My Simple main method:
>
> main = new Main();
>
> main.enableHangupSupport();
> main.addRouteBuilder(new MyRouteBuilder());
>
> main.run();
> ***************************
>
> My Route Class :
>
> private static class MyRouteBuilder extends RouteBuilder {
> @Override
> public void configure() throws Exception {
> from("activemq:inMessages")
> .aggregate(header("ABC"), new NFUMClaimAggregator())
> .completionTimeout(getAggregationTimeout()).end();
>
> }
>
> }
>
> Aggregation Route Class is the same as in my previous email:
>
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/Unable-to-instantiate-the-aggregation-route-Error-in-Camel-2-10-4-tp5717416p5717431.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Re: Unable to instantiate the aggregation route - Error in Camel
2.10.4
Posted by jay <my...@gmail.com>.
Hi- I am getting the following error when i run the aggregartor in main
method;
Exception in thread "main" org.apache.camel.FailedToCreateRouteException:
Failed to create route route1 at: >>> Aggregate[header{ABC} -> []] <<< in
route: Route[[From[activemq:inMessages]] -> [Aggregate[header{ABC} ...
because of Definition has no children on Aggregate[header{ABC} -> []]
at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:879)
at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:172)
at
org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:722)
at
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1789)
My Simple main method:
main = new Main();
main.enableHangupSupport();
main.addRouteBuilder(new MyRouteBuilder());
main.run();
***************************
My Route Class :
private static class MyRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
from("activemq:inMessages")
.aggregate(header("ABC"), new NFUMClaimAggregator())
.completionTimeout(getAggregationTimeout()).end();
}
}
Aggregation Route Class is the same as in my previous email:
--
View this message in context: http://servicemix.396122.n5.nabble.com/Unable-to-instantiate-the-aggregation-route-Error-in-Camel-2-10-4-tp5717416p5717431.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: Unable to instantiate the aggregation route - Error in
Camel 2.10.4
Posted by Willem jiang <wi...@gmail.com>.
Hi,
Can you start the camel route within simple main() method ?
I need to tell if you there is something wrong with the ABCAggregationRoute.
--
Willem Jiang
Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem
On Sunday, July 28, 2013 at 1:59 AM, jay wrote:
> Hi - i am using Aggregation Strategy for my requirement - while deploying
> the bundle in Fuse ESB7.1 blueprint is failing with
> org.osgi.service.blueprint.container.ComponentDefinitionException for my
> bundle.
>
> Error:Caused by: org.apache.camel.RuntimeCamelException:
> java.lang.InstantiationException: com.xx.xx.xx.ABCAggregationRoute
> at org.apache.camel.util.ObjectHelper.newInstance(ObjectHelper.java:1168)
> at
> org.apache.camel.util.ReflectionInjector.newInstance(ReflectionInjector.java:32)
> at
> org.apache.camel.impl.DefaultInjector.newInstance(DefaultInjector.java:45)
> at
> org.apache.camel.blueprint.PackageScanRouteBuilderFinder.instantiateBuilder(PackageScanRouteBuilderFinder.java:110)
> at
> org.apache.camel.blueprint.PackageScanRouteBuilderFinder.appendBuilders(PackageScanRouteBuilderFinder.java:72)
> at
> org.apache.camel.blueprint.CamelContextFactoryBean.findRouteBuildersByPackageScan(CamelContextFactoryBean.java:265)
> at
> org.apache.camel.core.xml.AbstractCamelContextFactoryBean.findRouteBuilders(AbstractCamelContextFactoryBean.java:671)
> at
> org.apache.camel.core.xml.AbstractCamelContextFactoryBean.afterPropertiesSet(AbstractCamelContextFactoryBean.java:275)
>
>
>
> My Code:
> bluprint file-
> // -----------------//
> <cm:property-placeholder persistent-id="xxxx" update-strategy="reload" >
> <cm:default-properties>
> <cm:property name="ACTIVEMQ_INBOUND"
> value="activemq:incomingFiles"/>
> <cm:property name="ACTIVEMQ_ERROR_OUTBOUND" value="Errored"/>
> <cm:property name="ACTIVEMQ_OUTBOUND"
> value="activemq:processedFiles"/>
> </cm:default-properties>
> </cm:property-placeholder>
>
> <camelContext id="xxxx" trace="false"
> xmlns="http://camel.apache.org/schema/blueprint">
> <camel:package>com.xxx.xxx.routes</camel:package>
> </camelContext>
>
> <bean id="AggregationRoute" class="com.xx.xx.xx.ABCAggregationRoute">
> <constructor-arg value="${ACTIVEMQ_INBOUND}"/>
> <constructor-arg value="${ACTIVEMQ_ERROR_OUTBOUND}"/>
> <constructor-arg value="${ACTIVEMQ_OUTBOUND}"/>
> <property name="xxxProcessor" ref="xxxProcessor"/>
> </bean>
>
> //-----------------//
>
>
> JavaDSL file:
> MainRoute Class (ABCAggregationRoute):
> from(ACTIVEMQ_INBOUND)
> .aggregate(header("XYZ"), new InnerClassAggregator()) //
> below inner class i am calling here
> .completionTimeout(getAggregationTimeout())
> //.marshal(jaxb)
> .to(ACTIVEMQ_OUTBOUND) ;
>
>
> Interclass for the MainRoute (InnerClassAggregator):
> InnerClassAggregator implements AggregationStrategy {
>
> public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
> ArrayList objList =null;
> Object objNew = (Object)newExchange.getIn().getBody(Object.class);
>
> if(oldExchange == null){
>
> objList = new ArrayList();
>
> objList.add(objNew) ;
>
> newExchange.getIn().setBody(objList);
>
> return newExchange;
> }
>
> else{
> objList=oldExchange.getIn().getBody(ArrayList.class);
> objList.add(objNew);
> return oldExchange;
>
> }
>
> }
>
>
> Can some one please let me know your views what is wrong with my code as i
> am struggling to get this deployed in container. (i am using camel 2.10.4
> and fuseesb 7.1)
>
>
>
>
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/Unable-to-instantiate-the-aggregation-route-Error-in-Camel-2-10-4-tp5717416.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com (http://Nabble.com).