Hi All,
I am facing issue in AEM6.3(6.1 code was working), @Reference annotation is not working in abstract class.
Same code was working fine in AEM6.1
Below is my code
@Service
public abstract class Test implements ABCIntf {
@Reference (this is not working in 6.3 was working in 6.1)
private Replicator replicator
}
I had no option other than to move @Reference in concrete class.
Please advise if anyone can help.
Thanks,
Pradeep
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
I faced this issue as well, although I don't know any more how I solved it. The problem is that the tooling need to support that. Have you switched from SCR annotations to OSGI annotations?
I just found Abstract components via org.osgi.service.component annotations - Stack Overflow which explains that specific case.
Jörg
Views
Replies
Total Likes
Views
Replies
Total Likes
I have never seen @Reference work in Abstract classes. As Hemant has pointed out - refer to the example in Github. Most of the time you use @Reference that uses @Component and a class that implements a given interface.
Views
Replies
Total Likes
Hi,
I am working on upgrade from 6.1 to 6.3. Code which was working fine in 6.1 is not working on 6.3.
@Reference
private Replicator replicator
Throwing nullpointer exception in abstract class (@Service annotation only no @Component annotation on top of class definition). It was working in 6.1.
Gone through the links shared in response, i think there are lot of changes i have to do (pom file changes, felix annotation are deprecated)
I was thinking this will be minor change. But after going through the links it is not minor change. Will post you if needed any help.
Anyway, thanks a lot for the quick help.
Thanks,
Pradeep
Views
Replies
Total Likes
Another thing to keep in mind in AEM 6.3. Looks like you are still using @Service annotations from your code above (Apache Felix - SCR Annotations).
You should look at moving your OSGi code to DS Annotations. See this: Official OSGi Declarative Services Annotations in AEM - Adobe Experience Manager | AEM/CQ | Apache S...
When you build an AEM Project with Maven 11 or 12 Archetype - you get these by default - see .Scott's Digital Community: Creating an Adobe Experience Manager 6.3 Project using Adobe Maven Archet...
Views
Replies
Total Likes
Hi Donald,
I am going through below link
Deprecated List ("The Adobe AEM Quickstart and Web Application.")
org.apache.felix.scr.annotations
is not showing in deprecated list.
All deprecated API like JcrResourceResolverFactory, OsgiUtil, User, Group, Apache Json etc showing as striked out in code.
Do you have any AEM documentation which clearly states org.apache.felix.scr.annotations is deprecated?
Thanks,
Pradeep
Views
Replies
Total Likes
Hi,
I faced this issue as well, although I don't know any more how I solved it. The problem is that the tooling need to support that. Have you switched from SCR annotations to OSGI annotations?
I just found Abstract components via org.osgi.service.component annotations - Stack Overflow which explains that specific case.
Jörg
Views
Replies
Total Likes
I do not think the Felix annotations are depreciated yet - however - it seems developers are moving towards the DS annotations and when you use the latest Adobe Maven Archetype projects - these annotations are used by default.
Views
Replies
Total Likes
Hey guys
I face a similar issue and i am asked (by adobe) to avoid using @reference in abstract classes , and this worked on 6.2 and breaks on migration to 6.4, with bunch of scr annotation errors and components appear to be in satisfied state
Infact abstract keyword for a service at times sets the component to state "16", solution - remove abstract keyword
If you have nested inheritance and workflows and abstract classes take it off
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies