CQ5.6.1 osgi bundle no longer running activate method
I created an osgi bundle using CQ5.5 that would use sling scheduler to add a job to run at midnight everyday. We recently did an update to CQ5.6.1 which included the scr code and install jar, however the bundle appears to not run the activate method with my code. I've tried stopping, restart, an uninstalling the bundle with no change. The log returns warnings but not any errors that prevent it from successfully building. Once I build in the console I am getting error on the component could not be activated, or SchedulerBind could not be completed. Before the update the scheduled job did run correctly selecting a page from a folder of terms, but now it is not even printing debug statements in activate method.
import java.io.Serializable;
import java.util.*;
import javax.jcr.*;
import org.osgi.service.component.ComponentContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Modified;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.PropertyUnbounded;
import org.apache.felix.scr.annotations.Service;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ConfigurationPolicy;
import org.apache.sling.api.resource.*;
import org.apache.sling.commons.scheduler.Scheduler;
import org.apache.sling.jcr.resource.JcrResourceConstants;
import org.apache.sling.jcr.api.SlingRepository;
import org.osgi.framework.BundleContext;
import com.day.cq.wcm.api.*;
import com.day.cq.replication.*;
import org.apache.sling.commons.osgi.*;
@Component(immediate=true, label="Term of the Day Scheduler",
description="Specify the term of day location.",metatype=true,
configurationFactory=false,
policy=ConfigurationPolicy.REQUIRE)
@Service(value=DictionaryScheduledService.class)
public class DictionaryScheduledService {
@Property(unbounded=PropertyUnbounded.DEFAULT, label="Dictionary Term Location", description="Location of all Dictionary terms (/content/public/dictionary/legal-terms).", value="/content/public/dictionary/legal-terms")
private static final String TOD_BASE_URL = "tod.baseurl";
private String todBaseUrl; // Scheduler's baseurl for dictionary terms
@Property(unbounded=PropertyUnbounded.DEFAULT, label="Term of Day Location", description="Location to write selected term of day values to (/content/public/dictionary/tod).", value="/content/public/dictionary/tod")
private static final String TOD_PATH = "tod.path";
private String todPath;
/** Default log. */
protected final Logger log = LoggerFactory.getLogger(this.getClass());
public String getTodBaseUrl() {
return todBaseUrl;
}
public String getTodPath() {
return todPath;
}
@Reference
private Replicator replicator;
@Reference
private Scheduler scheduler;
@Reference
private SlingRepository repository;
private Session session;
private PageManager pageManager;
@Activate
protected void activate(ComponentContext componentContext) throws Exception {
session = repository.loginAdministrative(repository.getDefaultWorkspace());
BundleContext bundleContext = componentContext.getBundleContext();
ServiceReference serviceReference = bundleContext.getServiceReference(ResourceResolverFactory.class.getName());
ResourceResolverFactory resolverFactory = (ResourceResolverFactory) bundleContext.getService(serviceReference);
Map authInfo = new HashMap();
authInfo.put(JcrResourceConstants.AUTHENTICATION_INFO_SESSION, session);
ResourceResolver rr = resolverFactory.getResourceResolver(authInfo);
pageManager = rr.adaptTo(PageManager.class);
//config to execute the job every day, 12AM
//String schedulingExpression = "0 0 0 * * ? *";
//run every 5 seconds
String schedulingExpression = "0/5 * * * * * *"
String jobName1 = "case1";
Map<String, Serializable> config1 = new HashMap<String, Serializable>();
boolean canRunConcurrently = true;
//Scheduled Job
final Runnable job1 = new Runnable() {
public void run() {
log.info("executing job one");
}
};
try {
this.scheduler.addJob(jobName1, job1, config1, schedulingExpression, canRunConcurrently);
} catch (Exception e) {
job1.run();
}
}
@Deactivate
protected void deactivate(ComponentContext componentContext) {
log.info("Deactivated, goodbye!");
this.scheduler.removeJob("case1");
if (session != null) {
session.logout();
log.info("service is deactivated session logged out");
}
}
}
-----ERROR----
04.09.2013 16:35:22.038 *ERROR* [Background Update com.findlaw.util.scheduler (326)] com.findlaw.util.scheduler [com.findlaw.util.DictionaryScheduledService] bind method [bindScheduler] not found; Component will fail
04.09.2013 16:35:22.038 *WARN* [Background Update com.findlaw.util.scheduler (326)] com.findlaw.util.scheduler [com.findlaw.util.DictionaryScheduledService] bindRepository cannot be found (java.lang.VerifyError: Expecting a stackmap frame at branch target 13 in method com.findlaw.util.DictionaryScheduledService.unbindRepository(Lorg/apache/sling/jcr/api/SlingRepository;)V at offset 5) java.lang.VerifyError: Expecting a stackmap frame at branch target 13 in method com.findlaw.util.DictionaryScheduledService.unbindRepository(Lorg/apache/sling/jcr/api/SlingRepository;)V at offset 5