Hi all.
Dear community, help me please. I'm totally stuck. Im doing a JIRA SAL service and im following https://developer.atlassian.com/display/DOCS/Scheduling+Events+via+SAL+Tutorial .
Please note, that's not first time im doing a service, did 3-4 services last year. As mentioned, I wrote Job, Scheduler interface and SchedulerImpl classes.
This service is SO simple, just write smth to log on launch.
After Installing plugin with it I catch error, please help me to solve this.
I tried to reboot system, manage dependencies in pom.xml, tried different keys for modules in atlassian-plugin.xml, also played a game "Find 10 differencies between this service and one you made a year ago".
Thanks in advance, Andrey.
Mine atlassian-plugin.xml:
<component key="UpdateFieldSchedulerComponentTwo" class="ru.borlas.jira.service.UpdateCustomerCascFieldSchedulerImpl" system="true" public="true"> <description></description> <interface>com.atlassian.sal.api.lifecycle.LifecycleAware</interface> <interface>ru.borlas.jira.service.UpdateCustomerCascFieldScheduler</interface> </component> <component-import key="cfUpdatePluginSchedulerTwo"> <description>SAL Scheduler</description> <interface>com.atlassian.sal.api.scheduling.PluginScheduler</interface> </component-import>
Mine scheduler:
public class UpdateCustomerCascFieldSchedulerImpl implements UpdateCustomerCascFieldScheduler, LifecycleAware { /* package */ static final String KEY = UpdateCustomerCascFieldSchedulerImpl.class.getName() + ":instance"; private static final String JOB_NAME = UpdateCustomerCascFieldSchedulerImpl.class.getName() + ":job"; private final Logger logger = Logger.getLogger(UpdateCustomerCascFieldSchedulerImpl.class); private final PluginScheduler pluginScheduler; // provided by SAL private long interval = 5000L; public UpdateCustomerCascFieldSchedulerImpl(PluginScheduler pluginScheduler) { this.pluginScheduler = pluginScheduler; } //@Override public void onStart() { reschedule(interval); } //@Override public void reschedule(long interval) { this.interval = interval; pluginScheduler.scheduleJob( JOB_NAME, // unique name of the job UpdateCustomerscCascadingFieldJob.class, // class of the job new HashMap<String, Object>() {{ put(KEY, UpdateCustomerCascFieldSchedulerImpl.this); }}, // data that needs to be passed to the job new Date(), // the time the job is to start interval); // interval between repeats, in milliseconds logger.info(String.format("Twitter search task scheduled to run every %dms", interval)); } }
Mine Job:
public class UpdateCustomerscCascadingFieldJob implements PluginJob { private final Logger logger = Logger.getLogger(UpdateCustomerscCascadingFieldJob.class); /** * Executes this job. * * @param jobDataMap any data the job needs to execute. Changes to this data will be remembered between executions. */ public void execute(Map<String, Object> jobDataMap) { final UpdateCustomerCascFieldSchedulerImpl update = (UpdateCustomerCascFieldSchedulerImpl)jobDataMap.get(UpdateCustomerCascFieldSchedulerImpl.KEY); assert update != null; logger.log(Priority.toPriority(Priority.ERROR_INT), "Job is running"); //update.setLastRun(new Date()); } }
And the error:
2014-08-25 17:53:30,984 ThreadPoolAsyncTaskExecutor::Thread 23 ERROR APechnikov 1073x170x1 5z3jv1 10.0.1.102 /rest/plugins/1.0/ [sal.core.lifecycle.DefaultLifecycleManager] Unable to start component: com.sun.proxy.$Proxy536 org.springframework.aop.AopInvocationException: AOP configuration seems to be invalid: tried calling method [public abstract void com.atlassian.sal.api.lifecycle.LifecycleAware.onStart()] on target [ru.borlas.jira.service.UpdateCustomerCascFieldSchedulerImpl@51e73583]; nested exception is java.lang.IllegalArgumentException: java.lang.ClassCastException@76c067ed at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:315) at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58) at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:62) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:56) at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:39) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59)
And so on
Community moderators have prevented the ability to post new answers.
I also tried to install service manually and got his error:
Error adding service: org.picocontainer.injectors.AbstractInjector$UnsatisfiableDependenciesException: ru.borlas.jira.service.UpdateCustomerCascFieldSchedulerImpl has unsatisfied dependency 'interface com.atlassian.sal.api.scheduling.PluginScheduler' for constructor 'public ru.borlas.jira.service.UpdateCustomerCascFieldSchedulerImpl(com.atlassian.sal.api.scheduling.PluginScheduler)' from org.picocontainer.DefaultPicoContainer@7933e7a1:1<[Immutable]:com.atlassian.jira.component.CachingMutablePicoContainer@3eac3931.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.