Unsupported Operation Exception in feature resolution

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Unsupported Operation Exception in feature resolution

matteor
Hello,

Karaf feature resolution fails due to java.lang.UnsupportedOperationException. It is hard to understand the root cause.

I managed to reproduce the issue in a relatively simple settings, you can find it here: https://github.com/mrulli/karaf-426-feature-unsupported-op

Could you please help me to understand what is it happening here? 

Thanks,
Matteo
Reply | Threaded
Open this post in threaded view
|

Re: Unsupported Operation Exception in feature resolution

jbonofre
Hi,

I guess you have this with karaf-maven-plugin, right ?

The reason is that we use a "simplified" resolver in the plugin, not
implementing all methods. That's why you have UnsupportedOperationException.

Regards
JB

On 26/07/2019 11:05, Matteo Rulli wrote:

> Hello,
>
> Karaf feature resolution fails due to
> java.lang.UnsupportedOperationException. It is hard to understand the
> root cause.
>
> I managed to reproduce the issue in a relatively simple settings, you
> can find it here: https://github.com/mrulli/karaf-426-feature-unsupported-op
>
> Could you please help me to understand what is it happening here? 
>
> Thanks,
> Matteo

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Unsupported Operation Exception in feature resolution

matteor
Hello,

Thanks. Yes we use the verify step of the karat-maven-plugin. Does this mean that the “verify” step can fail at build-time but the feature will work in a real deployment? If this is the case, what is the right approach to verify a feature before it is used or deployed?

Thanks,
Matteo

> On 26 Jul 2019, at 11:31, Jean-Baptiste Onofré <[hidden email]> wrote:
>
> Hi,
>
> I guess you have this with karaf-maven-plugin, right ?
>
> The reason is that we use a "simplified" resolver in the plugin, not
> implementing all methods. That's why you have UnsupportedOperationException.
>
> Regards
> JB
>
> On 26/07/2019 11:05, Matteo Rulli wrote:
>> Hello,
>>
>> Karaf feature resolution fails due to
>> java.lang.UnsupportedOperationException. It is hard to understand the
>> root cause.
>>
>> I managed to reproduce the issue in a relatively simple settings, you
>> can find it here: https://github.com/mrulli/karaf-426-feature-unsupported-op
>>
>> Could you please help me to understand what is it happening here?
>>
>> Thanks,
>> Matteo
>
> --
> Jean-Baptiste Onofré
> [hidden email]
> http://blog.nanthrax.net
> Talend - http://www.talend.com

Reply | Threaded
Open this post in threaded view
|

Re: Unsupported Operation Exception in feature resolution

jbonofre
Actually, your features is causing a refresh (the flairkit-alarm-rest
for instance).

So, the features resolver tries to uninstall a bundle to reinstall it.

It happens here:

https://github.com/apache/karaf/blob/karaf-4.2.x/features/core/src/main/java/org/apache/karaf/features/internal/service/StaticInstallSupport.java#L50

So, your feature will could work at runtime, but with a refresh.

I would recommend to fix your bundles to avoid the refresh.

Anyway, instead of failing, I can log a WARN message with the bundles in
cause.

I created KARAF-6370 about that.

Regards
JB

On 26/07/2019 11:40, Matteo Rulli wrote:

> Hello,
>
> Thanks. Yes we use the verify step of the karat-maven-plugin. Does this mean that the “verify” step can fail at build-time but the feature will work in a real deployment? If this is the case, what is the right approach to verify a feature before it is used or deployed?
>
> Thanks,
> Matteo
>
>> On 26 Jul 2019, at 11:31, Jean-Baptiste Onofré <[hidden email]> wrote:
>>
>> Hi,
>>
>> I guess you have this with karaf-maven-plugin, right ?
>>
>> The reason is that we use a "simplified" resolver in the plugin, not
>> implementing all methods. That's why you have UnsupportedOperationException.
>>
>> Regards
>> JB
>>
>> On 26/07/2019 11:05, Matteo Rulli wrote:
>>> Hello,
>>>
>>> Karaf feature resolution fails due to
>>> java.lang.UnsupportedOperationException. It is hard to understand the
>>> root cause.
>>>
>>> I managed to reproduce the issue in a relatively simple settings, you
>>> can find it here: https://github.com/mrulli/karaf-426-feature-unsupported-op
>>>
>>> Could you please help me to understand what is it happening here?
>>>
>>> Thanks,
>>> Matteo
>>
>> --
>> Jean-Baptiste Onofré
>> [hidden email]
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Unsupported Operation Exception in feature resolution

matteor
I see, thank you for the explanation and for adding a more permissive behaviour to the karaf-maven-plugin. 

Just to know a little bit better how to control the refreshes, in general my understanding is the following
  • <bundle>/<feature> directives will install the bundle or the feature, no matter what is already installed
  • dependency=“true" will install the bundle/feature if and only if it is required by the resolver and it is not already installed
  • prerequisite=“true" will guarantee the prerequisite feature will be installed before the other stuff in the feature declaration
Is this correct? Is there any other attribute that can be used to control feature-based provisioning?

Thank you very much,
Matteo

On 26 Jul 2019, at 13:12, Jean-Baptiste Onofré <[hidden email]> wrote:

Actually, your features is causing a refresh (the flairkit-alarm-rest
for instance).

So, the features resolver tries to uninstall a bundle to reinstall it.

It happens here:

https://github.com/apache/karaf/blob/karaf-4.2.x/features/core/src/main/java/org/apache/karaf/features/internal/service/StaticInstallSupport.java#L50

So, your feature will could work at runtime, but with a refresh.

I would recommend to fix your bundles to avoid the refresh.

Anyway, instead of failing, I can log a WARN message with the bundles in
cause.

I created KARAF-6370 about that.

Regards
JB

On 26/07/2019 11:40, Matteo Rulli wrote:
Hello,

Thanks. Yes we use the verify step of the karat-maven-plugin. Does this mean that the “verify” step can fail at build-time but the feature will work in a real deployment? If this is the case, what is the right approach to verify a feature before it is used or deployed?

Thanks,
Matteo

On 26 Jul 2019, at 11:31, Jean-Baptiste Onofré <[hidden email]> wrote:

Hi,

I guess you have this with karaf-maven-plugin, right ?

The reason is that we use a "simplified" resolver in the plugin, not
implementing all methods. That's why you have UnsupportedOperationException.

Regards
JB

On 26/07/2019 11:05, Matteo Rulli wrote:
Hello,

Karaf feature resolution fails due to
java.lang.UnsupportedOperationException. It is hard to understand the
root cause.

I managed to reproduce the issue in a relatively simple settings, you
can find it here: https://github.com/mrulli/karaf-426-feature-unsupported-op

Could you please help me to understand what is it happening here?

Thanks,
Matteo

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com


--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply | Threaded
Open this post in threaded view
|

Re: Unsupported Operation Exception in feature resolution

rkmoquin
Matteo,

Ironically, this same error had been plaguing me lately and so I turned on debugging to see if I could get any details on what was happening.  This resulted in me finding out what JB mentioned above about a bundle being uninstalled.  The suppressed exception though was a collection not modifiable exception (I forget the exact class).  My features result in a refresh at runtime and that never caused a verification issue.

I have learned to temporarily skip verification when I run into any issue with it (either that exception or if it fails after running out of memory).  I then load my feature into karaf which will give me details of what is wrong.

In this case, there were some missing requirements trying to resolve a feature that was marked as a prerequisite.  After fixing that, I still got the same error during validation.  I decided to try removing the prerequisite attributes I was experimenting with and got everything to work again.

It can be really hard to get prerequisite features working correctly unless you are sure everything is perfectly correct.

When you hit issues, try your features in karaf and install small pieces at a time which will let you narrow down the issue.

Hopefully this is helpful.

Ryan

On Fri, Jul 26, 2019, 10:33 AM Matteo Rulli <[hidden email]> wrote:
I see, thank you for the explanation and for adding a more permissive behaviour to the karaf-maven-plugin. 

Just to know a little bit better how to control the refreshes, in general my understanding is the following
  • <bundle>/<feature> directives will install the bundle or the feature, no matter what is already installed
  • dependency=“true" will install the bundle/feature if and only if it is required by the resolver and it is not already installed
  • prerequisite=“true" will guarantee the prerequisite feature will be installed before the other stuff in the feature declaration
Is this correct? Is there any other attribute that can be used to control feature-based provisioning?

Thank you very much,
Matteo

On 26 Jul 2019, at 13:12, Jean-Baptiste Onofré <[hidden email]> wrote:

Actually, your features is causing a refresh (the flairkit-alarm-rest
for instance).

So, the features resolver tries to uninstall a bundle to reinstall it.

It happens here:

https://github.com/apache/karaf/blob/karaf-4.2.x/features/core/src/main/java/org/apache/karaf/features/internal/service/StaticInstallSupport.java#L50

So, your feature will could work at runtime, but with a refresh.

I would recommend to fix your bundles to avoid the refresh.

Anyway, instead of failing, I can log a WARN message with the bundles in
cause.

I created KARAF-6370 about that.

Regards
JB

On 26/07/2019 11:40, Matteo Rulli wrote:
Hello,

Thanks. Yes we use the verify step of the karat-maven-plugin. Does this mean that the “verify” step can fail at build-time but the feature will work in a real deployment? If this is the case, what is the right approach to verify a feature before it is used or deployed?

Thanks,
Matteo

On 26 Jul 2019, at 11:31, Jean-Baptiste Onofré <[hidden email]> wrote:

Hi,

I guess you have this with karaf-maven-plugin, right ?

The reason is that we use a "simplified" resolver in the plugin, not
implementing all methods. That's why you have UnsupportedOperationException.

Regards
JB

On 26/07/2019 11:05, Matteo Rulli wrote:
Hello,

Karaf feature resolution fails due to
java.lang.UnsupportedOperationException. It is hard to understand the
root cause.

I managed to reproduce the issue in a relatively simple settings, you
can find it here: https://github.com/mrulli/karaf-426-feature-unsupported-op

Could you please help me to understand what is it happening here?

Thanks,
Matteo

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com


--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com