Re: Groovy + OSGI

Paul King <[email protected]> Wed, 26 Feb 2025 08:59:24 +1000
Newsgroups gmane.comp.lang.groovy.user
Message-ID <CAMbkE7RX7Bppi6KaU5tkmMS4cNBPf6TmdjE0SYgnN_t07YcHUA@mail.gmail.com>
Previous problems with FastStringService were primarily with
groovy-json-direct going away in Groovy 3 (as it wasn't compatible
with JPMS restrictions) and groovy-all going away after Groovy 3
(again due to JPMS).

I'll have to investigate a bit more to refresh my memory and be able
to have suggestions for next steps. Thanks for spotting that spifly
commit in 2020. That might explain why things are working for some
folks and not others.

Cheers, Paul.

On Wed, Feb 26, 2025 at 8:30 AM Matthias Leinweber
<[email protected]> wrote:
>
> Hi Paul,
>
> It appears that if a Fragment has an osgi.serviceloader Capability, the intention is that the host bundle must have a class that can be service loaded. The commit at https://github.com/apache/aries/commit/76f39f2#diff-aed8297fc5209027131b1f54544e00eb7614070832051a29561931ed6b933ab7 seems relevant. Furthermore, examples of fragments in the Aries repository appear to confirm this theory. This would imply that, without shading Groovy into a fat JAR, it won't be possible to get this working. Fat Jar is working, just tested. Or, another option, moving all services to a separate bundle. However, I suspect this also won't be feasible for every service. ...Any suggestions?
>
> br.
> Matthias
>
> On Tue, 25 Feb 2025 at 22:52, Matthias Leinweber <[email protected]> wrote:
>>
>> Hello Paul,
>>
>> I've conducted further tests.  While the FastStringFactor sometimes works after multiple application restarts, it's mostly failing.  I suspect a problem with the mediator components.  The service loader specification (https://docs.osgi.org/specification/osgi.cmpn/8.0.0/service.loader.html), implemented by Aries spifly, should, as I understand it, create an OSGi service.  However, this service doesn't seem to be getting created.  Interestingly, this same missing service issue also occurs with Groovy 3.0.x bundles. I'm quite confused by this.
>>
>> But these services are created for version 4.0.25 (without a fragment). I assume that SPI Fly only works for started and not for resolved bundles. However, this doesn't explain why 3.0.25 is working, nor why it sometimes works after multiple restarts.
>>
>> I will investigate further tomorrow.
>>
>> On Tue, 25 Feb 2025 at 21:24, Matthias Leinweber <[email protected]> wrote:
>>>
>>> Hi Paul,
>>>
>>> I've encountered some issues with the FastStringService. I'm getting an "Unable to load FastStringService" error and I'm trying to determine the cause. I vaguely recall having trouble with this class in the past, but I can't remember the specifics.
>>>
>>> Given these problems, I don't think this is releasable yet.
>>>
>>> Best regards,
>>> Matthias
>>>
>>> On Mon, 24 Feb 2025 at 20:19, Matthias Leinweber <[email protected]> wrote:
>>>>
>>>> Did some basic tests. Extensions seem to work and FastString Service too.
>>>>
>>>> br;
>>>> Matthias
>>>>
>>>> On Fri, 21 Feb 2025 at 23:15, Paul King <[email protected]> wrote:
>>>>>
>>>>> There should be 4.0.26-SNAPSHOT and 5.0.0-SNAPSHOT versions in the
>>>>> snapshot repo:
>>>>>
>>>>> https://repository.apache.org/content/repositories/snapshots/org/apache/groovy
>>>>>
>>>>> On Fri, Feb 21, 2025 at 10:30 PM Matthias Leinweber
>>>>> <[email protected]> wrote:
>>>>> >
>>>>> > Hi Paul,
>>>>> >
>>>>> > could you assist with the maven repo containing the snapshots or do i have to build myself?
>>>>> >
>>>>> > br:
>>>>> > Mathtias
>>>>> >
>>>>> >
>>>>> > On Thu, 20 Feb 2025 at 11:40, Paul King <[email protected]> wrote:
>>>>> >>
>>>>> >> I have pushed a fix. Once CI has finished building snapshots, if you
>>>>> >> can check against those, that would be great.
>>>>> >>
>>>>> >> Cheers, Paul.
>>>>> >> P.S. Feel free to comment further in that issue instead of here if you want.
>>>>> >>
>>>>> >> On Thu, Feb 20, 2025 at 8:32 PM Paul King <[email protected]> wrote:
>>>>> >> >
>>>>> >> > I created this issue to track changing this for Groovy 4/5:
>>>>> >> >
>>>>> >> > https://issues.apache.org/jira/browse/GROOVY-11570
>>>>> >> >
>>>>> >> > On Wed, Feb 12, 2025 at 11:14 PM Paul King <[email protected]> wrote:
>>>>> >> > >
>>>>> >> > > I think we should add the FragmentHost stuff back in and get a release
>>>>> >> > > out in the next few weeks.
>>>>> >> > >
>>>>> >> > > On Tue, Feb 11, 2025 at 2:05 AM Matthias Leinweber
>>>>> >> > > <[email protected]> wrote:
>>>>> >> > > >
>>>>> >> > > > I am not sure if someone ever tested this... Documentation says to get groovy extensions working is that the extension must be in the same class path (class loader).
>>>>> >> > > >
>>>>> >> > > > Maybe I am wrong but so fragment host (terrible name imho) is the only solution. Or shading a new jar could do the same trick.
>>>>> >> > > >
>>>>> >> > > > What do you think?
>>>>> >> > > >
>>>>> >> > > > Br
>>>>> >> > > >
>>>>> >> > > > Paul King <[email protected]> schrieb am Mo., 10. Feb. 2025, 14:25:
>>>>> >> > > >>
>>>>> >> > > >> In the following issue we were not certain of the need for
>>>>> >> > > >> Fragment-Host in Groovy 4:
>>>>> >> > > >>
>>>>> >> > > >> https://issues.apache.org/jira/browse/GROOVY-9402
>>>>> >> > > >>
>>>>> >> > > >> It could well be that it is needed.
>>>>> >> > > >>
>>>>> >> > > >> Cheers, Paul.
>>>>> >> > > >>
>>>>> >> > > >> On Mon, Feb 10, 2025 at 10:00 PM Matthias Leinweber
>>>>> >> > > >> <[email protected]> wrote:
>>>>> >> > > >> >
>>>>> >> > > >> > Hi together,
>>>>> >> > > >> >
>>>>> >> > > >> > I am using groovy alot in an osgi container with camel (currently karaf.4.7.7 camel 4.9.1 and groovy 4.0.25)
>>>>> >> > > >> >
>>>>> >> > > >> > Somehow the dateutils overload for the date class seems not to work anymore. In groovy 3.0.9 the bundle was a fragment host and working.... Do I need to do something extra with groovy 4?
>>>>> >> > > >> >
>>>>> >> > > >> > Br Matthias
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>