cancel
Showing results for 
Search instead for 
Did you mean: 

How to override cronjob's Send Email method?

felipe_lima08
Explorer
0 Kudos

AOP.XML

<aspectj>
    <weaver options="-Xset:weaveJavaxPackages=true">
        <include within="de.hybris.platform.cronjob.jalo.*"/>
    </weaver>
    <aspects>
        <aspect name="com.project.aop.cronjob.CronjobAdvice"/>
    </aspects><strong><br></strong>

Class

@Aspect
public class CronjobAdvice {


    @Pointcut("execution(public void de.hybris.platform.cronjob.jalo.CronJob.sendEmail(..))")
    public void sendEmail() {
        LOG.info("sendEmail");
    }


    @Before("sendEmail()")
    public void sendEmail(final JoinPoint jp) {
        System.out.println("Get getDescription invoked  [" + jp.toLongString() + "]");
    }

    @Around("sendEmail()")
    public void sendEmail(final ProceedingJoinPoint pjp) throws Throwable {
        System.out.println("Method " + pjp.getSignature().toShortString() + " took " + (endTime - startTime));
    }

}<br>

ERROR WITH ALL JOBS:

<strong>de.hybris.platform.servicelayer.internal.jalo.ServicelayerJob] (cancelPendingPaymentOrdersJob) [Job] Caught throwable co.com.PROJECT.aop.cronjob.CronjobAdvice.aspectOf()Lco/com/aop/cronjob/CronjobAdvice;
java.lang.NoSuchMethodError: co.com.PROJECT.aop.cronjob.CronjobAdvice.aspectOf()Lco/com/aop/cronjob/CronjobAdvice;
</strong>


I tried to overwrite the Jalo cronjob and there are cronjob that use the custom jalo and there are jobs that use the OOTB jalo.

    <bean id="de.hybris.platform.cronjob.jalo.CronJob" class="com.PROJECT.core.jalo.CustomCronJob" scope="prototype"><br>

I read in previous links to use ASPECT, but I have an error as mentioned in the codes above

Hybris version: 1905

Accepted Solutions (0)

Answers (0)