Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

@Reference is not working getting null

Sridhar
Level 4
Level 4

Hi friends,

 Am getting the null when injecting the resolverFactory object in Java class through Fleix Annotations(@Reference).

How i can use the sling and cq implicit object java class.It can be useful in JSP.But how in java class???

Please tell me a solution

 

Thanks in advance

1 Accepted Solution
Yogesh_Upadhyay
Correct answer by
Level 5
Level 5

In Java recommended approach is to use @reference to get a service reference. If you are getting null for  resolverFactory in your service (Your class should be service as well) please create a daycare ticket with steps to reproduce this issue. 

Other way to get a reference would be in your activate method of service (Your class) using bundlecontext (Similar to this http://www.knopflerfish.org/releases/current/docs/javadoc/org/osgi/framework/BundleContext.html#getS...))

Yogesh

View solution in original post

0 Replies
Yogesh_Upadhyay
Correct answer by
Level 5
Level 5

In Java recommended approach is to use @reference to get a service reference. If you are getting null for  resolverFactory in your service (Your class should be service as well) please create a daycare ticket with steps to reproduce this issue. 

Other way to get a reference would be in your activate method of service (Your class) using bundlecontext (Similar to this http://www.knopflerfish.org/releases/current/docs/javadoc/org/osgi/framework/BundleContext.html#getS...))

Yogesh

Sridhar
Level 4
Level 4

Yogesh Upadhyay wrote...

In Java recommended approach is to use @reference to get a service reference. If you are getting null for  resolverFactory in your service (Your class should be service as well) please create a daycare ticket with steps to reproduce this issue. 

Other way to get a reference would be in your activate method of service (Your class) using bundlecontext (Similar to this http://www.knopflerfish.org/releases/current/docs/javadoc/org/osgi/framework/BundleContext.html#getS...))

Yogesh

 

Yes.For @Service annotated class itself am getting the null.

Why am getting null..

Thanks in advance