You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Fabrizio Spataro - Bizmate <fa...@bizmate.it> on 2015/10/12 15:00:11 UTC

Upgrade to 2.16.0

Hello,

i am upgrading my application from 2.15.3 to 2.16.0 but I have a strange 
error!!

Can you help me?

Caused by: org.apache.camel.RuntimeCamelException: 
java.lang.ClassCastException: org.apache.camel.model.WhenDefinition 
cannot be cast to org.apache.camel.model.FilterDefinition
         at 
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1642)
         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:151)
         at 
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
         at 
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331)


-- 

-----------------------------------------------------------
*Fabrizio Spataro*
Software Development
tel: *+39 095 388583*
tel/fax: *+39 095 382521*
internet: www.bizmate.it <http://www.bizmate.it/>
mail: fabrizio.spataro@bizmate.it <ma...@bizmate.it>
-----------------------------------------------------------
Bizmate S.r.l. - confidenziale - Tutti i diritti riservati


Re: Upgrade to 2.16.0

Posted by Claus Ibsen <cl...@gmail.com>.
The wrong <when> would have no impact in the route and essentially
will not be in-use in those older Camel releases

On Wed, Oct 28, 2015 at 10:52 AM, Clemens <cl...@imendo.at> wrote:
> Hi,
>
> You are absolutely right, but it was possible to use <when> in 2.15
> without problems.
>
>
>
> Claus Ibsen-2 wrote
>> Hi
>>
>> You surely need to add
>> <filter>
>>  in the route. Having
>> <when>
>>  standalone
>> is not intended. So do
>>
>> See filter
>> http://camel.apache.org/message-filter.html
>>
>> On Wed, Oct 28, 2015 at 10:06 AM, Clemens &lt;
>
>> clemens@
>
>> &gt; wrote:
>>> Hi,
>>>
>>> Sample camel route that will throw "ClassCastException:
>>> org.apache.camel.model.WhenDefinition cannot be cast to
>>> org.apache.camel.model.FilterDefinition" at
>>> DefaultManagementObjectStragety#310.
>>>
>>>
>> <route id="sample">
>>>
>> <from uri="direct:start">
>>>
>>>
>> <when>
>>>
>> <simple>
>> ${body} != null
>> </simple>
>>>
>> <bean ref="myBean" method="myMethod">
>>>
>> </when>
>>>
>> </route>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Claus Ibsen-2 wrote
>>>> Can anyone show some route code with this problem.
>>>>
>>>> On Sat, Oct 24, 2015 at 11:55 AM, Clemens &lt;
>>>
>>>> clemens@
>>>
>>>> &gt; wrote:
>>>>> Hi,
>>>>>
>>>>> I had the same ClassCaseException When To Filter after upgrading to
>>>>> 2.16.0.
>>>>> Seems like in 2.16
>>>>
>> <when>
>>>>  is only allowed inside
>>>>
>> <choice>
>>>> . Outside
>>>>
>> <choice>
>>>>> you must use
>>>>
>> <filter>
>>>> . Prior to 2.16 it was ok to use when outside
>>>>
>> <choice>
>>>>> .......
>>>>>
>>>>> View this message in context:
>>>>> http://camel.465427.n5.nabble.com/Upgrade-to-2-16-0-tp5772570p5773020.html
>>>>> Sent from the Camel - Users mailing list archive at Nabble.com
>>>
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://camel.465427.n5.nabble.com/Upgrade-to-2-16-0-tp5772570p5773136.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> http://davsclaus.com @davsclaus
>> Camel in Action 2nd edition:
>> https://www.manning.com/books/camel-in-action-second-edition
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Upgrade-to-2-16-0-tp5772570p5773141.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition

Re: Upgrade to 2.16.0

Posted by Clemens <cl...@imendo.at>.
Hi,

You are absolutely right, but it was possible to use <when> in 2.15 
without problems.



Claus Ibsen-2 wrote
> Hi
> 
> You surely need to add 
> <filter>
>  in the route. Having 
> <when>
>  standalone
> is not intended. So do
> 
> See filter
> http://camel.apache.org/message-filter.html
> 
> On Wed, Oct 28, 2015 at 10:06 AM, Clemens &lt;

> clemens@

> &gt; wrote:
>> Hi,
>>
>> Sample camel route that will throw "ClassCastException:
>> org.apache.camel.model.WhenDefinition cannot be cast to
>> org.apache.camel.model.FilterDefinition" at
>> DefaultManagementObjectStragety#310.
>>
>> 
> <route id="sample">
>>   
> <from uri="direct:start">
>>
>>   
> <when>
>>     
> <simple>
> ${body} != null
> </simple>
>>     
> <bean ref="myBean" method="myMethod">
>>   
> </when>
>> 
> </route>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Claus Ibsen-2 wrote
>>> Can anyone show some route code with this problem.
>>>
>>> On Sat, Oct 24, 2015 at 11:55 AM, Clemens &lt;
>>
>>> clemens@
>>
>>> &gt; wrote:
>>>> Hi,
>>>>
>>>> I had the same ClassCaseException When To Filter after upgrading to
>>>> 2.16.0.
>>>> Seems like in 2.16
>>> 
> <when>
>>>  is only allowed inside
>>> 
> <choice>
>>> . Outside
>>> 
> <choice>
>>>> you must use
>>> 
> <filter>
>>> . Prior to 2.16 it was ok to use when outside
>>> 
> <choice>
>>>> .......
>>>>
>>>> View this message in context:
>>>> http://camel.465427.n5.nabble.com/Upgrade-to-2-16-0-tp5772570p5773020.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Upgrade-to-2-16-0-tp5772570p5773136.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 
> -- 
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2nd edition:
> https://www.manning.com/books/camel-in-action-second-edition





--
View this message in context: http://camel.465427.n5.nabble.com/Upgrade-to-2-16-0-tp5772570p5773141.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Upgrade to 2.16.0

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

You surely need to add <filter> in the route. Having <when> standalone
is not intended. So do

See filter
http://camel.apache.org/message-filter.html

On Wed, Oct 28, 2015 at 10:06 AM, Clemens <cl...@imendo.at> wrote:
> Hi,
>
> Sample camel route that will throw "ClassCastException:
> org.apache.camel.model.WhenDefinition cannot be cast to
> org.apache.camel.model.FilterDefinition" at
> DefaultManagementObjectStragety#310.
>
> <route id="sample">
>   <from uri="direct:start">
>
>   <when>
>     <simple>${body} != null</simple>
>     <bean ref="myBean" method="myMethod">
>   </when>
> </route>
>
>
>
>
>
>
>
>
>
>
>
> Claus Ibsen-2 wrote
>> Can anyone show some route code with this problem.
>>
>> On Sat, Oct 24, 2015 at 11:55 AM, Clemens &lt;
>
>> clemens@
>
>> &gt; wrote:
>>> Hi,
>>>
>>> I had the same ClassCaseException When To Filter after upgrading to
>>> 2.16.0.
>>> Seems like in 2.16
>> <when>
>>  is only allowed inside
>> <choice>
>> . Outside
>> <choice>
>>> you must use
>> <filter>
>> . Prior to 2.16 it was ok to use when outside
>> <choice>
>>> .......
>>>
>>> View this message in context:
>>> http://camel.465427.n5.nabble.com/Upgrade-to-2-16-0-tp5772570p5773020.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Upgrade-to-2-16-0-tp5772570p5773136.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition

Re: Upgrade to 2.16.0

Posted by Clemens <cl...@imendo.at>.
Hi, 

Sample camel route that will throw "ClassCastException:
org.apache.camel.model.WhenDefinition cannot be cast to
org.apache.camel.model.FilterDefinition" at
DefaultManagementObjectStragety#310.

<route id="sample">
  <from uri="direct:start">

  <when>       
    <simple>${body} != null</simple>
    <bean ref="myBean" method="myMethod">
  </when>
</route>











Claus Ibsen-2 wrote
> Can anyone show some route code with this problem.
> 
> On Sat, Oct 24, 2015 at 11:55 AM, Clemens &lt;

> clemens@

> &gt; wrote:
>> Hi,
>>
>> I had the same ClassCaseException When To Filter after upgrading to
>> 2.16.0.
>> Seems like in 2.16 
> <when>
>  is only allowed inside 
> <choice>
> . Outside 
> <choice>
>> you must use 
> <filter>
> . Prior to 2.16 it was ok to use when outside 
> <choice>
>> .......
>>
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Upgrade-to-2-16-0-tp5772570p5773020.html
>> Sent from the Camel - Users mailing list archive at Nabble.com





--
View this message in context: http://camel.465427.n5.nabble.com/Upgrade-to-2-16-0-tp5772570p5773136.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Upgrade to 2.16.0

Posted by Claus Ibsen <cl...@gmail.com>.
Can anyone show some route code with this problem.

On Sat, Oct 24, 2015 at 11:55 AM, Clemens <cl...@imendo.at> wrote:
> Hi,
>
> I had the same ClassCaseException When To Filter after upgrading to 2.16.0.
> Seems like in 2.16 <when> is only allowed inside <choice>. Outside <choice>
> you must use <filter>. Prior to 2.16 it was ok to use when outside <choice>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Upgrade-to-2-16-0-tp5772570p5773020.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition

Re: Upgrade to 2.16.0

Posted by Clemens <cl...@imendo.at>.
Hi,

I had the same ClassCaseException When To Filter after upgrading to 2.16.0.
Seems like in 2.16 <when> is only allowed inside <choice>. Outside <choice>
you must use <filter>. Prior to 2.16 it was ok to use when outside <choice>





--
View this message in context: http://camel.465427.n5.nabble.com/Upgrade-to-2-16-0-tp5772570p5773020.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Upgrade to 2.16.0

Posted by "fabrizio.spataro" <fa...@bizmate.it>.
Hello. 

This is a big problem because my project contains more than 100 routes.






--
View this message in context: http://camel.465427.n5.nabble.com/Upgrade-to-2-16-0-tp5772570p5772597.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Upgrade to 2.16.0

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

Is there not more of the stacktrace, and what route / code do you have
you can show us? Maybe try to disable parts of your routes to see if
you can pin point a particular route, which seems to involve a filter
pattern.

On Mon, Oct 12, 2015 at 3:00 PM, Fabrizio Spataro - Bizmate
<fa...@bizmate.it> wrote:
> Hello,
>
> i am upgrading my application from 2.15.3 to 2.16.0 but I have a strange
> error!!
>
> Can you help me?
>
> Caused by: org.apache.camel.RuntimeCamelException:
> java.lang.ClassCastException: org.apache.camel.model.WhenDefinition cannot
> be cast to org.apache.camel.model.FilterDefinition
>         at
> org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1642)
>         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:151)
>         at
> org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
>         at
> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:331)
>
>
> --
>
> -----------------------------------------------------------
> *Fabrizio Spataro*
> Software Development
> tel: *+39 095 388583*
> tel/fax: *+39 095 382521*
> internet: www.bizmate.it <http://www.bizmate.it/>
> mail: fabrizio.spataro@bizmate.it <ma...@bizmate.it>
> -----------------------------------------------------------
> Bizmate S.r.l. - confidenziale - Tutti i diritti riservati
>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition

Re: Nett shared worker pool

Posted by Alex Soto <al...@envieta.com>.
Thank you Claus!
I found good example in the unit test of camel-netty4 component.  In case it helps anybody here is the fragment:


  <!-- use the worker pool builder to create to help create the shared thread pool -->
  <bean id="poolBuilder" class="org.apache.camel.component.netty4.NettyWorkerPoolBuilder">
    <property name="workerCount" value="2"/>
  </bean>

  <!-- the shared worker thread pool -->
  <bean id="sharedPool" class="io.netty.channel.EventLoopGroup"
        factory-bean="poolBuilder" factory-method="build" destroy-method="shutdownGracefully">
  </bean>

  <camelContext xmlns="http://camel.apache.org/schema/spring">
    <route>
      <from uri="netty4:tcp://localhost:5021?textline=true&amp;sync=true&amp;workerGroup=#sharedPool&amp;usingExecutorService=false"/>



Best regards,
Alex soto



> On Oct 12, 2015, at 10:15 AM, Claus Ibsen <cl...@gmail.com> wrote:
> 
> I think they are called EventLoopGroup now
> https://github.com/apache/camel/blob/master/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyServerBootstrapConfiguration.java#L95
> 
> But you can also check the netty 3 -> 4 migration guide, if they have
> any or netty 4 docs whats its called now.
> 
> And you are welcome to help update the docs
> http://camel.apache.org/contributing
> 
> On Mon, Oct 12, 2015 at 4:10 PM, Alex Soto <al...@envieta.com> wrote:
>> I am trying to follow documentation to:
>> Reusing Netty boss and worker thread pools
>> 
>> with Netty4 component,  but if the page is referring to Netty3, how would this work with Netty-4?  Any pointers?
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>>> On Oct 12, 2015, at 10:03 AM, Claus Ibsen <cl...@gmail.com> wrote:
>>> 
>>> Its io.netty now. That link is for jetty 3.x
>>> 
>>> On Mon, Oct 12, 2015 at 3:52 PM, Alex Soto <al...@envieta.com> wrote:
>>>> Hello,
>>>> 
>>>> The documentation here http://camel.apache.org/netty4.html# <http://camel.apache.org/netty4.html#>  refers to class org.jboss.netty.channel.socket.nio.WorkerPool  however I can’t seem to find this class in anywhere.  I am using Camel version 2.15.1.  Is the class name correct?
>>>> 
>>>> Best regards,
>>>> Alex soto
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> Claus Ibsen
>>> -----------------
>>> http://davsclaus.com @davsclaus
>>> Camel in Action 2nd edition:
>>> https://www.manning.com/books/camel-in-action-second-edition
>> 
> 
> 
> 
> -- 
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2nd edition:
> https://www.manning.com/books/camel-in-action-second-edition


Re: Nett shared worker pool

Posted by Claus Ibsen <cl...@gmail.com>.
I think they are called EventLoopGroup now
https://github.com/apache/camel/blob/master/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyServerBootstrapConfiguration.java#L95

But you can also check the netty 3 -> 4 migration guide, if they have
any or netty 4 docs whats its called now.

And you are welcome to help update the docs
http://camel.apache.org/contributing

On Mon, Oct 12, 2015 at 4:10 PM, Alex Soto <al...@envieta.com> wrote:
> I am trying to follow documentation to:
> Reusing Netty boss and worker thread pools
>
> with Netty4 component,  but if the page is referring to Netty3, how would this work with Netty-4?  Any pointers?
>
> Best regards,
> Alex soto
>
>
>
>> On Oct 12, 2015, at 10:03 AM, Claus Ibsen <cl...@gmail.com> wrote:
>>
>> Its io.netty now. That link is for jetty 3.x
>>
>> On Mon, Oct 12, 2015 at 3:52 PM, Alex Soto <al...@envieta.com> wrote:
>>> Hello,
>>>
>>> The documentation here http://camel.apache.org/netty4.html# <http://camel.apache.org/netty4.html#>  refers to class org.jboss.netty.channel.socket.nio.WorkerPool  however I can’t seem to find this class in anywhere.  I am using Camel version 2.15.1.  Is the class name correct?
>>>
>>> Best regards,
>>> Alex soto
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> http://davsclaus.com @davsclaus
>> Camel in Action 2nd edition:
>> https://www.manning.com/books/camel-in-action-second-edition
>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition

Re: Nett shared worker pool

Posted by Alex Soto <al...@envieta.com>.
I am trying to follow documentation to:
Reusing Netty boss and worker thread pools

with Netty4 component,  but if the page is referring to Netty3, how would this work with Netty-4?  Any pointers?

Best regards,
Alex soto



> On Oct 12, 2015, at 10:03 AM, Claus Ibsen <cl...@gmail.com> wrote:
> 
> Its io.netty now. That link is for jetty 3.x
> 
> On Mon, Oct 12, 2015 at 3:52 PM, Alex Soto <al...@envieta.com> wrote:
>> Hello,
>> 
>> The documentation here http://camel.apache.org/netty4.html# <http://camel.apache.org/netty4.html#>  refers to class org.jboss.netty.channel.socket.nio.WorkerPool  however I can’t seem to find this class in anywhere.  I am using Camel version 2.15.1.  Is the class name correct?
>> 
>> Best regards,
>> Alex soto
>> 
> 
> 
> 
> -- 
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2nd edition:
> https://www.manning.com/books/camel-in-action-second-edition


Re: Nett shared worker pool

Posted by Claus Ibsen <cl...@gmail.com>.
Its io.netty now. That link is for jetty 3.x

On Mon, Oct 12, 2015 at 3:52 PM, Alex Soto <al...@envieta.com> wrote:
> Hello,
>
> The documentation here http://camel.apache.org/netty4.html# <http://camel.apache.org/netty4.html#>  refers to class org.jboss.netty.channel.socket.nio.WorkerPool  however I can’t seem to find this class in anywhere.  I am using Camel version 2.15.1.  Is the class name correct?
>
> Best regards,
> Alex soto
>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition

Nett shared worker pool

Posted by Alex Soto <al...@envieta.com>.
Hello,

The documentation here http://camel.apache.org/netty4.html# <http://camel.apache.org/netty4.html#>  refers to class org.jboss.netty.channel.socket.nio.WorkerPool  however I can’t seem to find this class in anywhere.  I am using Camel version 2.15.1.  Is the class name correct?

Best regards,
Alex soto