You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by Kanika Khattar <ka...@gmail.com> on 2021/12/08 06:49:01 UTC

Issue: SCR Annotated Services not working

Hi Team,

I am working on an OSGI project where I am upgrading jetty and OSGI
versions from R-4.9 to R4_19_maintenance and Jetty version is getting
upgraded from 9.4.11 to 9.4.44

I was using org.eclipse.equinox.ds(1.4.400) as a bundle earlier which was
using org.apache.felix internally.
Since org.eclipse.equinox.ds dependency has been removed from
R4_19_maintenance, I have added dependency of org.apache.felix.scr(2.1.24)
but the issue is org.apache.felix.scr.annotation services are not getting
activated.

Can you please help me in knowing if it is the version of
org.apache.felix.scr.annotation that is causing the issue, if yes, which
version it supports or what could be the possible issues that might be
causing this.

Thanks & Regards,
Kanika

Re: Issue: SCR Annotated Services not working

Posted by Raymond Augé <ra...@liferay.com.INVALID>.
Also, just so that we understand each other very clearly, you never needed
org.apache.felix.scr.annotation in order for Felix SCR to work in the first
place.

Any components (@org.osgi.service.component.annotations.Component) that
previously worked on equinox.ds should simply _work_ (except for some very
rare edge cases) when switching to felix.scr.

Also, felix.scr bundles the packages `org.osgi.service.component(.runtime)`
so there isn't actually a need for providing an API jar for those.

(All these sorts of issues are generally caught by using the resolver for
assembling the runtime ;)  though the resolver output is often esoteric and
difficult to mentally parse. Ahh to have all the time in the world...)

Ray

On Wed, Dec 8, 2021 at 7:11 AM Amit Mondal <ad...@amitinside.com> wrote:

> Hi Kanika,
>
> As you are using not-that-old version of SCR bundle, you can use
> org.osgi:osgi.annotation:7.0.0 for your components to be used in compile
> time.
>
> For your information, the latest version of SCR bundle is
> org.apache.felix:org.apache.felix.scr:2.1.30 which works with OSGi R7 and
> org.apache.felix:org.apache.felix.scr:2.2.0-RC1 for OSGi R8.
>
> Best Regards,
> Amit
> ________________________________
> From: Amit Mondal <ad...@amitinside.com>
> Sent: 08 December 2021 13:03
> To: dev@felix.apache.org <de...@felix.apache.org>
> Subject: Re: Issue: SCR Annotated Services not working
>
> Hi Kanika,
>
> Felix SCR bundle processes service components from bundles by reading the
> SCR XML files stored inside the OSGI-INF directory. The annotations which
> you are using are all build time annotations, that means, external tooling
> such as bndtools or bnd maven plugin reads annotated Java classes (SCR
> components) and generates the XML files in the aforementioned directory
> inside the bundle which in runtime is processed by SCR bundle.
>
> The SCR annotations bundle you mentioned can, therefore, be removed from
> your OSGi runtime as it is not meant to be installed at all.
>
> I hope it helps. If you need further assistance, please don't hesitate to
> contact once again.
>
> Best Regards,
> Amit
> ________________________________
> From: Kanika Khattar <ka...@gmail.com>
> Sent: 08 December 2021 07:49
> To: dev@felix.apache.org <de...@felix.apache.org>
> Subject: Issue: SCR Annotated Services not working
>
> Hi Team,
>
> I am working on an OSGI project where I am upgrading jetty and OSGI
> versions from R-4.9 to R4_19_maintenance and Jetty version is getting
> upgraded from 9.4.11 to 9.4.44
>
> I was using org.eclipse.equinox.ds(1.4.400) as a bundle earlier which was
> using org.apache.felix internally.
> Since org.eclipse.equinox.ds dependency has been removed from
> R4_19_maintenance, I have added dependency of org.apache.felix.scr(2.1.24)
> but the issue is org.apache.felix.scr.annotation services are not getting
> activated.
>
> Can you please help me in knowing if it is the version of
> org.apache.felix.scr.annotation that is causing the issue, if yes, which
> version it supports or what could be the possible issues that might be
> causing this.
>
> Thanks & Regards,
> Kanika
>


-- 
*Raymond Augé* (@rotty3000)
Senior Software Architect *Liferay, Inc.* (@Liferay)
OSGi Fellow, Java Champion

Re: Issue: SCR Annotated Services not working

Posted by Amit Mondal <ad...@amitinside.com>.
Hi Kanika,

As you are using not-that-old version of SCR bundle, you can use org.osgi:osgi.annotation:7.0.0 for your components to be used in compile time.

For your information, the latest version of SCR bundle is org.apache.felix:org.apache.felix.scr:2.1.30 which works with OSGi R7 and org.apache.felix:org.apache.felix.scr:2.2.0-RC1 for OSGi R8.

Best Regards,
Amit
________________________________
From: Amit Mondal <ad...@amitinside.com>
Sent: 08 December 2021 13:03
To: dev@felix.apache.org <de...@felix.apache.org>
Subject: Re: Issue: SCR Annotated Services not working

Hi Kanika,

Felix SCR bundle processes service components from bundles by reading the SCR XML files stored inside the OSGI-INF directory. The annotations which you are using are all build time annotations, that means, external tooling such as bndtools or bnd maven plugin reads annotated Java classes (SCR components) and generates the XML files in the aforementioned directory inside the bundle which in runtime is processed by SCR bundle.

The SCR annotations bundle you mentioned can, therefore, be removed from your OSGi runtime as it is not meant to be installed at all.

I hope it helps. If you need further assistance, please don't hesitate to contact once again.

Best Regards,
Amit
________________________________
From: Kanika Khattar <ka...@gmail.com>
Sent: 08 December 2021 07:49
To: dev@felix.apache.org <de...@felix.apache.org>
Subject: Issue: SCR Annotated Services not working

Hi Team,

I am working on an OSGI project where I am upgrading jetty and OSGI
versions from R-4.9 to R4_19_maintenance and Jetty version is getting
upgraded from 9.4.11 to 9.4.44

I was using org.eclipse.equinox.ds(1.4.400) as a bundle earlier which was
using org.apache.felix internally.
Since org.eclipse.equinox.ds dependency has been removed from
R4_19_maintenance, I have added dependency of org.apache.felix.scr(2.1.24)
but the issue is org.apache.felix.scr.annotation services are not getting
activated.

Can you please help me in knowing if it is the version of
org.apache.felix.scr.annotation that is causing the issue, if yes, which
version it supports or what could be the possible issues that might be
causing this.

Thanks & Regards,
Kanika

Re: Issue: SCR Annotated Services not working

Posted by Amit Mondal <ad...@amitinside.com>.
Hi Kanika,

Felix SCR bundle processes service components from bundles by reading the SCR XML files stored inside the OSGI-INF directory. The annotations which you are using are all build time annotations, that means, external tooling such as bndtools or bnd maven plugin reads annotated Java classes (SCR components) and generates the XML files in the aforementioned directory inside the bundle which in runtime is processed by SCR bundle.

The SCR annotations bundle you mentioned can, therefore, be removed from your OSGi runtime as it is not meant to be installed at all.

I hope it helps. If you need further assistance, please don't hesitate to contact once again.

Best Regards,
Amit
________________________________
From: Kanika Khattar <ka...@gmail.com>
Sent: 08 December 2021 07:49
To: dev@felix.apache.org <de...@felix.apache.org>
Subject: Issue: SCR Annotated Services not working

Hi Team,

I am working on an OSGI project where I am upgrading jetty and OSGI
versions from R-4.9 to R4_19_maintenance and Jetty version is getting
upgraded from 9.4.11 to 9.4.44

I was using org.eclipse.equinox.ds(1.4.400) as a bundle earlier which was
using org.apache.felix internally.
Since org.eclipse.equinox.ds dependency has been removed from
R4_19_maintenance, I have added dependency of org.apache.felix.scr(2.1.24)
but the issue is org.apache.felix.scr.annotation services are not getting
activated.

Can you please help me in knowing if it is the version of
org.apache.felix.scr.annotation that is causing the issue, if yes, which
version it supports or what could be the possible issues that might be
causing this.

Thanks & Regards,
Kanika