Message Boards

Issues with PortalLDAP classes

Daniel G, modified 4 Years ago.

Issues with PortalLDAP classes

Regular Member Posts: 141 Join Date: 3/14/17 Recent Posts
Hi everyone.
I am facing issues when trying to use PortalLDAP. I am going to try to explain myself.
I wanted to use PortalLDAPUtil as it was used in Liferay 7.0, but it was moved in 7.1 to an internal package. So I was told to use this instead:
@Reference(   policy = ReferencePolicy.DYNAMIC,   policyOption = ReferencePolicyOption.GREEDY  ) 
 private volatile PortalLDAP _portalLDAP;
 


My problem is that if I try to use in the doview method of a portlet, portlet does not appear in portal so I cannot use it. And if I use in other classes, _portalLDAP is always null.
I am very lost with this new implementation of classes, so any help or orientations would be very appreciated.
Kind regards. 
thumbnail
David H Nebinger, modified 4 Years ago.

RE: Issues with PortalLDAP classes

Liferay Legend Posts: 14916 Join Date: 9/2/06 Recent Posts
I don't normally add the volatile modifier in the declaration.

Is your class where you have the @Reference declared as an @Component? If it is not a component, the @Reference will never be injected.
Daniel G, modified 4 Years ago.

RE: Issues with PortalLDAP classes

Regular Member Posts: 141 Join Date: 3/14/17 Recent Posts
Hi David.
I am trying to use the PortalLDAP reference in a class but it is always null, but I don't really know what can be causing this issue? Regarding this:Is your class where you have the @Reference declared as an @Component? If it is not a component, the @Reference will never be injected.
I am not sure how to do this. Could you help me?
Thanks in advance.
Regards.