You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@plc4x.apache.org by Etienne Robinet <er...@apache.org> on 2020/05/11 09:59:16 UTC

ClassCastExcpetion Camel Component

Hello guys,
I've been trying to use the Scraper with the Camel component. I tried to run a test code in Karaf but I get this error: 
https://i.imgur.com/ABAWJ8l.png

The TagData class is used to store the Alias, Query and Values of the tags we want to read. In order to use it with the Scraper, I need a Map<String,String> with the aliases and queries. So I added this static method: 
https://i.imgur.com/CxplPOr.png

And as you can see it fails at line 121. If anyone has a clue how to solve this, it would be very helpful! :)

Etienne

Re: ClassCastExcpetion Camel Component

Posted by Etienne Robinet <er...@apache.org>.
Hi Luskasz,
this is weird. It seems like the class is only exported by the right bundle (135 is the PLC4X: Camel Integration) https://i.imgur.com/NMGOCPH.png

Etienne

On 2020/05/11 15:12:57, "Robinet, Etienne" <43...@etu.he2b.be> wrote: 
> Hi,
> well I know I have it in my blueprint (to create the List) and in the
> Camel-Integration Bundle. Guess I will have to figure out a workaround
> 
> Etienne
> 
> Le lun. 11 mai 2020 à 15:31, Łukasz Dywicki <lu...@code-house.org> a écrit :
> 
> > Look where TagData class is defined. Under Karaf you can try:
> > package:exports | grep org.apache.plc4x.camel
> >
> > I suspect that you have org.apache.plc4x.camel.TagData type defined in
> > two places at runtime. It causes a friction when you break boundaries
> > and use TagData from one source in another context.
> >
> > Best,
> > Łukasz
> >
> >
> > On 11.05.2020 14:22, Etienne Robinet wrote:
> > > Hi Luskasz,
> > > So this could be that the TagData class is in the blueprint bundle and
> > the Camel bundle ? And that’s why this error is happening?
> > >
> > > Etienne
> > >
> > >> Le 11 mai 2020 à 14:06, Łukasz Dywicki <lu...@code-house.org> a écrit :
> > >>
> > >> Hey Etienne,
> > >> This problem is likely to happen if you have two implementations of EIP
> > >> driver at the same time. Java distinguish classes also by class laoder.
> > >> If you have the same class loaded from two different classloaders - then
> > >> you will experience troubles like "class A is not instance of A" as well
> > >> as "A can not be cast to A".
> > >>
> > >> Good luck,
> > >> Łukasz
> > >>
> > >>
> > >>> On 11.05.2020 11:59, Etienne Robinet wrote:
> > >>> Hello guys,
> > >>> I've been trying to use the Scraper with the Camel component. I tried
> > to run a test code in Karaf but I get this error:
> > >>> https://i.imgur.com/ABAWJ8l.png
> > >>>
> > >>> The TagData class is used to store the Alias, Query and Values of the
> > tags we want to read. In order to use it with the Scraper, I need a
> > Map<String,String> with the aliases and queries. So I added this static
> > method:
> > >>> https://i.imgur.com/CxplPOr.png
> > >>>
> > >>> And as you can see it fails at line 121. If anyone has a clue how to
> > solve this, it would be very helpful! :)
> > >>>
> > >>> Etienne
> > >>>
> >
> 

Re: ClassCastExcpetion Camel Component

Posted by "Robinet, Etienne" <43...@etu.he2b.be>.
Hi,
well I know I have it in my blueprint (to create the List) and in the
Camel-Integration Bundle. Guess I will have to figure out a workaround

Etienne

Le lun. 11 mai 2020 à 15:31, Łukasz Dywicki <lu...@code-house.org> a écrit :

> Look where TagData class is defined. Under Karaf you can try:
> package:exports | grep org.apache.plc4x.camel
>
> I suspect that you have org.apache.plc4x.camel.TagData type defined in
> two places at runtime. It causes a friction when you break boundaries
> and use TagData from one source in another context.
>
> Best,
> Łukasz
>
>
> On 11.05.2020 14:22, Etienne Robinet wrote:
> > Hi Luskasz,
> > So this could be that the TagData class is in the blueprint bundle and
> the Camel bundle ? And that’s why this error is happening?
> >
> > Etienne
> >
> >> Le 11 mai 2020 à 14:06, Łukasz Dywicki <lu...@code-house.org> a écrit :
> >>
> >> Hey Etienne,
> >> This problem is likely to happen if you have two implementations of EIP
> >> driver at the same time. Java distinguish classes also by class laoder.
> >> If you have the same class loaded from two different classloaders - then
> >> you will experience troubles like "class A is not instance of A" as well
> >> as "A can not be cast to A".
> >>
> >> Good luck,
> >> Łukasz
> >>
> >>
> >>> On 11.05.2020 11:59, Etienne Robinet wrote:
> >>> Hello guys,
> >>> I've been trying to use the Scraper with the Camel component. I tried
> to run a test code in Karaf but I get this error:
> >>> https://i.imgur.com/ABAWJ8l.png
> >>>
> >>> The TagData class is used to store the Alias, Query and Values of the
> tags we want to read. In order to use it with the Scraper, I need a
> Map<String,String> with the aliases and queries. So I added this static
> method:
> >>> https://i.imgur.com/CxplPOr.png
> >>>
> >>> And as you can see it fails at line 121. If anyone has a clue how to
> solve this, it would be very helpful! :)
> >>>
> >>> Etienne
> >>>
>

Re: ClassCastExcpetion Camel Component

Posted by Łukasz Dywicki <lu...@code-house.org>.
Look where TagData class is defined. Under Karaf you can try:
package:exports | grep org.apache.plc4x.camel

I suspect that you have org.apache.plc4x.camel.TagData type defined in
two places at runtime. It causes a friction when you break boundaries
and use TagData from one source in another context.

Best,
Łukasz


On 11.05.2020 14:22, Etienne Robinet wrote:
> Hi Luskasz, 
> So this could be that the TagData class is in the blueprint bundle and the Camel bundle ? And that’s why this error is happening?
> 
> Etienne
> 
>> Le 11 mai 2020 à 14:06, Łukasz Dywicki <lu...@code-house.org> a écrit :
>>
>> Hey Etienne,
>> This problem is likely to happen if you have two implementations of EIP
>> driver at the same time. Java distinguish classes also by class laoder.
>> If you have the same class loaded from two different classloaders - then
>> you will experience troubles like "class A is not instance of A" as well
>> as "A can not be cast to A".
>>
>> Good luck,
>> Łukasz
>>
>>
>>> On 11.05.2020 11:59, Etienne Robinet wrote:
>>> Hello guys,
>>> I've been trying to use the Scraper with the Camel component. I tried to run a test code in Karaf but I get this error: 
>>> https://i.imgur.com/ABAWJ8l.png
>>>
>>> The TagData class is used to store the Alias, Query and Values of the tags we want to read. In order to use it with the Scraper, I need a Map<String,String> with the aliases and queries. So I added this static method: 
>>> https://i.imgur.com/CxplPOr.png
>>>
>>> And as you can see it fails at line 121. If anyone has a clue how to solve this, it would be very helpful! :)
>>>
>>> Etienne
>>>

Re: ClassCastExcpetion Camel Component

Posted by Etienne Robinet <43...@etu.he2b.be>.
Hi Luskasz, 
So this could be that the TagData class is in the blueprint bundle and the Camel bundle ? And that’s why this error is happening?

Etienne

> Le 11 mai 2020 à 14:06, Łukasz Dywicki <lu...@code-house.org> a écrit :
> 
> Hey Etienne,
> This problem is likely to happen if you have two implementations of EIP
> driver at the same time. Java distinguish classes also by class laoder.
> If you have the same class loaded from two different classloaders - then
> you will experience troubles like "class A is not instance of A" as well
> as "A can not be cast to A".
> 
> Good luck,
> Łukasz
> 
> 
>> On 11.05.2020 11:59, Etienne Robinet wrote:
>> Hello guys,
>> I've been trying to use the Scraper with the Camel component. I tried to run a test code in Karaf but I get this error: 
>> https://i.imgur.com/ABAWJ8l.png
>> 
>> The TagData class is used to store the Alias, Query and Values of the tags we want to read. In order to use it with the Scraper, I need a Map<String,String> with the aliases and queries. So I added this static method: 
>> https://i.imgur.com/CxplPOr.png
>> 
>> And as you can see it fails at line 121. If anyone has a clue how to solve this, it would be very helpful! :)
>> 
>> Etienne
>> 

Re: ClassCastExcpetion Camel Component

Posted by Łukasz Dywicki <lu...@code-house.org>.
Hey Etienne,
This problem is likely to happen if you have two implementations of EIP
driver at the same time. Java distinguish classes also by class laoder.
If you have the same class loaded from two different classloaders - then
you will experience troubles like "class A is not instance of A" as well
as "A can not be cast to A".

Good luck,
Łukasz


On 11.05.2020 11:59, Etienne Robinet wrote:
> Hello guys,
> I've been trying to use the Scraper with the Camel component. I tried to run a test code in Karaf but I get this error: 
> https://i.imgur.com/ABAWJ8l.png
> 
> The TagData class is used to store the Alias, Query and Values of the tags we want to read. In order to use it with the Scraper, I need a Map<String,String> with the aliases and queries. So I added this static method: 
> https://i.imgur.com/CxplPOr.png
> 
> And as you can see it fails at line 121. If anyone has a clue how to solve this, it would be very helpful! :)
> 
> Etienne
>