Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
How to call custom method from different module in **localServceiIml class?
Hi All,
I have created a new SB and now I want to call a method from different module in my ***localServiceImpl. I have added a dependecy of the module in my service.When I tried as below I'm getting the nullpointer exception. Here "AutoPaymentScheduler" is there inside the other module. Please help me out to solve this issue.
public class SchedulerNewLocalServiceImpl extends SchedulerNewLocalServiceBaseImpl { public void AutoPaymentSchedulerCall (String cronExpression){ if(Validator.isNotNull(cronExpression)){ _autoPayScheduler.initJob(cronExpression); }}
@Reference private AutoPaymentScheduler _autoPayScheduler; }
Thanks in Advance.
Is your SchedulerNewLocalServiceImpl annotated as @Component? @Reference does only work inside of @Components.
Also, don't add the other module as dependency - its API should be enough
Thank you Olaf Kock for the reply, yes I have added @Component and it's working fine now.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™