Konrad Szeromski 8 Years Ago Nice reading!BTW: "StorageType.PERSISTED - This is the opposite of PERSISTED as job details will be persisted in the database." I think you had "opposite of MEMORY" on your mind Please sign in to reply. Reply as... Cancel David H Nebinger Konrad Szeromski 8 Years Ago Thanks for pointing this out, Konrad, I've fixed the post! Please sign in to reply. Reply as... Cancel
David H Nebinger Konrad Szeromski 8 Years Ago Thanks for pointing this out, Konrad, I've fixed the post! Please sign in to reply. Reply as... Cancel
Sergio Gonzalo 8 Years Ago I have implemented a very similar approach but in my case, I want to call a service exported from on other service-builder bundle (api and service). In my scheduler bundle, I import the called service in the bnd.bnd file (that it is exported by api bundle).In the scheduler code, I try to "inject" the dependency as follows: @Reference(unbind = "-") protected void setMyLocalService(MyLocalService myLocalService) { _myLocalService = myLocalService; } private MyLocalService _myLocalService;But when I try to use the service in doReceive method, it is always null. On oSGI console, I find the component Active but with this unsatisfied reference.I have tried several ways to access the service (calling myLocalServiceUtil, using ServiceTracker, ...) but I always receive the same message. Only in case I remove the reference in code, the component start to receive messages but in my case I need to make actions using my service.To check if I have any problem with other injection, I checked to inject userLocalService in the same way and it was injected ok.Is there any additional security level or action to be performed in the service builder bundles or in the client to access the service from this component?. All the examples I have checked always are referred to a portlet but in my case, I am defining a simple Component (service=my.class) so I do not know if maybe the archetype to create portlet or the scope of the portlets have some enablements that are not defined in my scheduler component. Please sign in to reply. Reply as... Cancel David H Nebinger Sergio Gonzalo 8 Years Ago Silly question, but is your service implementation deployed and started? Please sign in to reply. Reply as... Cancel Sergio Gonzalo David H Nebinger 8 Years Ago Yes, of course, I deploy two bundles (api and service) and both are active and running. I use Liferay IDE to generate a new service builder module plugin for mapping an existing table, but I do not change or extend anything on that module.After compiling with gradlew, I build the jar and deploy them on Liferay. In fact, I am able to see using GOGO commands the services are exposed and active as you can see below: 529|Active | 10|check.cluster.nodes-api (1.0.0) 530|Active | 10|check.cluster.nodes-service (1.0.0)----------------------------g! b 529check.cluster.nodes-api_1.0.0 [529] Id=529, Status=ACTIVE Data Root=/opt/liferay/osgi/state/org.eclipse.osgi/529/data "No registered services." No services in use. Exported packages com.test.modules.cluster.exception; version="1.0.0"[exported] com.test.modules.cluster.model; version="1.0.0"[exported] com.test.modules.cluster.service; version="1.0.0"[exported] com.test.modules.cluster.service.persistence; version="1.0.0"[exported] Imported packages com.liferay.expando.kernel.model; version="1.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.osgi.util; version="2.0.9" <com.liferay.osgi.util_3.0.7 [2]> com.liferay.portal.kernel.annotation; version="6.3.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.bean; version="7.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.dao.orm; version="7.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.exception; version="7.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.jsonwebservice; version="7.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.model; version="1.0.1" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.search; version="7.3.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.security.access.control; version="1.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.service; version="1.8.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.service.persistence; version="1.4.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.spring.osgi; version="1.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.transaction; version="7.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.util; version="7.14.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> org.osgi.util.tracker; version="1.5.1" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> No fragment bundles No required bundles----------------------g! b 530check.cluster.nodes-service_1.0.0 [530] Id=530, Status=ACTIVE Data Root=/opt/liferay/osgi/state/org.eclipse.osgi/530/data "No registered services." No services in use. No exported packages Imported packages com.test.modules.cluster.exception; version="1.0.0" <check.cluster.nodes-api_1.0.0 [529]> com.test.modules.cluster.model; version="1.0.0" <check.cluster.nodes-api_1.0.0 [529]> com.test.modules.cluster.service; version="1.0.0" <check.cluster.nodes-api_1.0.0 [529]> com.test.modules.cluster.service.persistence; version="1.0.0" <check.cluster.nodes-api_1.0.0 [529]> com.liferay.counter.kernel.service; version="1.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.bean; version="7.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.configuration; version="6.2.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.dao.db; version="7.2.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.dao.jdbc; version="7.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.dao.orm; version="7.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.exception; version="7.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.json; version="7.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.log; version="7.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.model; version="1.0.1" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.model.impl; version="1.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.module.framework.service; version="1.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.search; version="7.3.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.service; version="1.8.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.service.persistence; version="1.4.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.service.persistence.impl; version="1.2.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.util; version="7.14.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.spring.extender.service; version="1.0.5" <com.liferay.portal.spring.extender_2.0.8 [336]> javax.sql; version="0.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> No fragment bundles No required bundles-------------------------------However, later in IDE I try to define a new module plugin (I tried with "service" type and "mvcportlet" type changing the @Component definition and the class from which extends). My module only have a class defined in this way:@Component( immediate = true, service = TestTableScheduler.class )public class TestTableScheduler extends BaseSchedulerEntryMessageListener {...}and in doReceive method I want to call the service com.test.modules.cluster.service.myLocalService exported on the "api" bundle and implemented on the "service" bundle of my previous service builder module.I try to inject the service using the @Reference annotation as I told in my previous message.When I deploy the module in Liferay, the component is in ACTIVE state but with an unsatisfied reference as it is shown below: 531|Active | 10|check.cluster.nodes.scheduler (1.0.0)----------------------- g! b 531 check.cluster.nodes.scheduler_1.0.0 [531] Id=531, Status=ACTIVE Data Root=/opt/liferay/osgi/state/org.eclipse.osgi/531/data "No registered services." Services in use: {org.osgi.service.log.LogService, org.eclipse.equinox.log.ExtendedLogService}={service.id=2, service.bundleid=0, service.scope=bundle} No exported packages Imported packages com.test.modules.cluster.model; version="1.0.0" <check.cluster.nodes-api_1.0.0 [529]> com.test.modules.cluster.service; version="1.0.0" <check.cluster.nodes-api_1.0.0 [529]> com.liferay.portal.kernel.cluster; version="7.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.log; version="7.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.messaging; version="7.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.module.framework; version="1.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.scheduler; version="7.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> No fragment bundles No required bundles------------------------g! scr:list 531 BundleId Component Name Default State Component Id State PIDs (Factory PID) [ 531] com.test.modules.cluster.TestTableScheduler enabled [2448] [unsatisfied reference] -----------------------------g! scr:info com.test.modules.cluster.TestTableScheduler*** Bundle: check.cluster.nodes.scheduler (531)Component Description: Name: com.test.modules.cluster.TestTableScheduler Implementation Class: com.test.modules.cluster.TestTableScheduler Default State: enabled Activation: immediate Configuration Policy: optional Activate Method: activate Deactivate Method: deactivate Modified Method: activate Configuration Pid: [com.test.modules.cluster.TestTableScheduler] Services: com.test.modules.cluster.TestTableScheduler Service Scope: singleton Reference: myServiceLocalService Interface Name: com.test.modules.cluster.service.myServiceLocalService Cardinality: 1..1 Policy: static Policy option: reluctant Reference Scope: bundle Reference: ModuleServiceLifecycle Interface Name: com.liferay.portal.kernel.module.framework.ModuleServiceLifecycle Target Filter: (module.service.lifecycle=portal.initialized) Cardinality: 1..1 Policy: static Policy option: reluctant Reference Scope: bundle Reference: SchedulerEngineHelper Interface Name: com.liferay.portal.kernel.scheduler.SchedulerEngineHelper Cardinality: 1..1 Policy: static Policy option: reluctant Reference Scope: bundle Reference: TriggerFactory Interface Name: com.liferay.portal.kernel.scheduler.TriggerFactory Cardinality: 1..1 Policy: static Policy option: reluctant Reference Scope: bundle Component Description Properties: ModuleServiceLifecycle.target = (module.service.lifecycle=portal.initialized) Component Configuration: ComponentId: 2448 State: unsatisfied reference SatisfiedReference: ModuleServiceLifecycle Target: (module.service.lifecycle=portal.initialized) (unbound) SatisfiedReference: SchedulerEngineHelper Target: null (unbound) SatisfiedReference: TriggerFactory Target: null (unbound) UnsatisfiedReference: myServiceLocalService Target: null (no target services) Component Configuration Properties: ModuleServiceLifecycle.target = (module.service.lifecycle=portal.initialized) component.id = 2448 component.name = com.test.modules.cluster.TestTableScheduler Please sign in to reply. Reply as... Cancel
David H Nebinger Sergio Gonzalo 8 Years Ago Silly question, but is your service implementation deployed and started? Please sign in to reply. Reply as... Cancel Sergio Gonzalo David H Nebinger 8 Years Ago Yes, of course, I deploy two bundles (api and service) and both are active and running. I use Liferay IDE to generate a new service builder module plugin for mapping an existing table, but I do not change or extend anything on that module.After compiling with gradlew, I build the jar and deploy them on Liferay. In fact, I am able to see using GOGO commands the services are exposed and active as you can see below: 529|Active | 10|check.cluster.nodes-api (1.0.0) 530|Active | 10|check.cluster.nodes-service (1.0.0)----------------------------g! b 529check.cluster.nodes-api_1.0.0 [529] Id=529, Status=ACTIVE Data Root=/opt/liferay/osgi/state/org.eclipse.osgi/529/data "No registered services." No services in use. Exported packages com.test.modules.cluster.exception; version="1.0.0"[exported] com.test.modules.cluster.model; version="1.0.0"[exported] com.test.modules.cluster.service; version="1.0.0"[exported] com.test.modules.cluster.service.persistence; version="1.0.0"[exported] Imported packages com.liferay.expando.kernel.model; version="1.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.osgi.util; version="2.0.9" <com.liferay.osgi.util_3.0.7 [2]> com.liferay.portal.kernel.annotation; version="6.3.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.bean; version="7.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.dao.orm; version="7.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.exception; version="7.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.jsonwebservice; version="7.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.model; version="1.0.1" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.search; version="7.3.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.security.access.control; version="1.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.service; version="1.8.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.service.persistence; version="1.4.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.spring.osgi; version="1.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.transaction; version="7.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.util; version="7.14.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> org.osgi.util.tracker; version="1.5.1" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> No fragment bundles No required bundles----------------------g! b 530check.cluster.nodes-service_1.0.0 [530] Id=530, Status=ACTIVE Data Root=/opt/liferay/osgi/state/org.eclipse.osgi/530/data "No registered services." No services in use. No exported packages Imported packages com.test.modules.cluster.exception; version="1.0.0" <check.cluster.nodes-api_1.0.0 [529]> com.test.modules.cluster.model; version="1.0.0" <check.cluster.nodes-api_1.0.0 [529]> com.test.modules.cluster.service; version="1.0.0" <check.cluster.nodes-api_1.0.0 [529]> com.test.modules.cluster.service.persistence; version="1.0.0" <check.cluster.nodes-api_1.0.0 [529]> com.liferay.counter.kernel.service; version="1.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.bean; version="7.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.configuration; version="6.2.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.dao.db; version="7.2.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.dao.jdbc; version="7.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.dao.orm; version="7.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.exception; version="7.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.json; version="7.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.log; version="7.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.model; version="1.0.1" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.model.impl; version="1.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.module.framework.service; version="1.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.search; version="7.3.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.service; version="1.8.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.service.persistence; version="1.4.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.service.persistence.impl; version="1.2.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.util; version="7.14.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.spring.extender.service; version="1.0.5" <com.liferay.portal.spring.extender_2.0.8 [336]> javax.sql; version="0.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> No fragment bundles No required bundles-------------------------------However, later in IDE I try to define a new module plugin (I tried with "service" type and "mvcportlet" type changing the @Component definition and the class from which extends). My module only have a class defined in this way:@Component( immediate = true, service = TestTableScheduler.class )public class TestTableScheduler extends BaseSchedulerEntryMessageListener {...}and in doReceive method I want to call the service com.test.modules.cluster.service.myLocalService exported on the "api" bundle and implemented on the "service" bundle of my previous service builder module.I try to inject the service using the @Reference annotation as I told in my previous message.When I deploy the module in Liferay, the component is in ACTIVE state but with an unsatisfied reference as it is shown below: 531|Active | 10|check.cluster.nodes.scheduler (1.0.0)----------------------- g! b 531 check.cluster.nodes.scheduler_1.0.0 [531] Id=531, Status=ACTIVE Data Root=/opt/liferay/osgi/state/org.eclipse.osgi/531/data "No registered services." Services in use: {org.osgi.service.log.LogService, org.eclipse.equinox.log.ExtendedLogService}={service.id=2, service.bundleid=0, service.scope=bundle} No exported packages Imported packages com.test.modules.cluster.model; version="1.0.0" <check.cluster.nodes-api_1.0.0 [529]> com.test.modules.cluster.service; version="1.0.0" <check.cluster.nodes-api_1.0.0 [529]> com.liferay.portal.kernel.cluster; version="7.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.log; version="7.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.messaging; version="7.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.module.framework; version="1.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.scheduler; version="7.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> No fragment bundles No required bundles------------------------g! scr:list 531 BundleId Component Name Default State Component Id State PIDs (Factory PID) [ 531] com.test.modules.cluster.TestTableScheduler enabled [2448] [unsatisfied reference] -----------------------------g! scr:info com.test.modules.cluster.TestTableScheduler*** Bundle: check.cluster.nodes.scheduler (531)Component Description: Name: com.test.modules.cluster.TestTableScheduler Implementation Class: com.test.modules.cluster.TestTableScheduler Default State: enabled Activation: immediate Configuration Policy: optional Activate Method: activate Deactivate Method: deactivate Modified Method: activate Configuration Pid: [com.test.modules.cluster.TestTableScheduler] Services: com.test.modules.cluster.TestTableScheduler Service Scope: singleton Reference: myServiceLocalService Interface Name: com.test.modules.cluster.service.myServiceLocalService Cardinality: 1..1 Policy: static Policy option: reluctant Reference Scope: bundle Reference: ModuleServiceLifecycle Interface Name: com.liferay.portal.kernel.module.framework.ModuleServiceLifecycle Target Filter: (module.service.lifecycle=portal.initialized) Cardinality: 1..1 Policy: static Policy option: reluctant Reference Scope: bundle Reference: SchedulerEngineHelper Interface Name: com.liferay.portal.kernel.scheduler.SchedulerEngineHelper Cardinality: 1..1 Policy: static Policy option: reluctant Reference Scope: bundle Reference: TriggerFactory Interface Name: com.liferay.portal.kernel.scheduler.TriggerFactory Cardinality: 1..1 Policy: static Policy option: reluctant Reference Scope: bundle Component Description Properties: ModuleServiceLifecycle.target = (module.service.lifecycle=portal.initialized) Component Configuration: ComponentId: 2448 State: unsatisfied reference SatisfiedReference: ModuleServiceLifecycle Target: (module.service.lifecycle=portal.initialized) (unbound) SatisfiedReference: SchedulerEngineHelper Target: null (unbound) SatisfiedReference: TriggerFactory Target: null (unbound) UnsatisfiedReference: myServiceLocalService Target: null (no target services) Component Configuration Properties: ModuleServiceLifecycle.target = (module.service.lifecycle=portal.initialized) component.id = 2448 component.name = com.test.modules.cluster.TestTableScheduler Please sign in to reply. Reply as... Cancel
Sergio Gonzalo David H Nebinger 8 Years Ago Yes, of course, I deploy two bundles (api and service) and both are active and running. I use Liferay IDE to generate a new service builder module plugin for mapping an existing table, but I do not change or extend anything on that module.After compiling with gradlew, I build the jar and deploy them on Liferay. In fact, I am able to see using GOGO commands the services are exposed and active as you can see below: 529|Active | 10|check.cluster.nodes-api (1.0.0) 530|Active | 10|check.cluster.nodes-service (1.0.0)----------------------------g! b 529check.cluster.nodes-api_1.0.0 [529] Id=529, Status=ACTIVE Data Root=/opt/liferay/osgi/state/org.eclipse.osgi/529/data "No registered services." No services in use. Exported packages com.test.modules.cluster.exception; version="1.0.0"[exported] com.test.modules.cluster.model; version="1.0.0"[exported] com.test.modules.cluster.service; version="1.0.0"[exported] com.test.modules.cluster.service.persistence; version="1.0.0"[exported] Imported packages com.liferay.expando.kernel.model; version="1.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.osgi.util; version="2.0.9" <com.liferay.osgi.util_3.0.7 [2]> com.liferay.portal.kernel.annotation; version="6.3.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.bean; version="7.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.dao.orm; version="7.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.exception; version="7.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.jsonwebservice; version="7.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.model; version="1.0.1" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.search; version="7.3.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.security.access.control; version="1.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.service; version="1.8.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.service.persistence; version="1.4.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.spring.osgi; version="1.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.transaction; version="7.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.util; version="7.14.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> org.osgi.util.tracker; version="1.5.1" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> No fragment bundles No required bundles----------------------g! b 530check.cluster.nodes-service_1.0.0 [530] Id=530, Status=ACTIVE Data Root=/opt/liferay/osgi/state/org.eclipse.osgi/530/data "No registered services." No services in use. No exported packages Imported packages com.test.modules.cluster.exception; version="1.0.0" <check.cluster.nodes-api_1.0.0 [529]> com.test.modules.cluster.model; version="1.0.0" <check.cluster.nodes-api_1.0.0 [529]> com.test.modules.cluster.service; version="1.0.0" <check.cluster.nodes-api_1.0.0 [529]> com.test.modules.cluster.service.persistence; version="1.0.0" <check.cluster.nodes-api_1.0.0 [529]> com.liferay.counter.kernel.service; version="1.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.bean; version="7.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.configuration; version="6.2.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.dao.db; version="7.2.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.dao.jdbc; version="7.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.dao.orm; version="7.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.exception; version="7.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.json; version="7.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.log; version="7.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.model; version="1.0.1" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.model.impl; version="1.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.module.framework.service; version="1.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.search; version="7.3.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.service; version="1.8.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.service.persistence; version="1.4.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.service.persistence.impl; version="1.2.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.util; version="7.14.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.spring.extender.service; version="1.0.5" <com.liferay.portal.spring.extender_2.0.8 [336]> javax.sql; version="0.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> No fragment bundles No required bundles-------------------------------However, later in IDE I try to define a new module plugin (I tried with "service" type and "mvcportlet" type changing the @Component definition and the class from which extends). My module only have a class defined in this way:@Component( immediate = true, service = TestTableScheduler.class )public class TestTableScheduler extends BaseSchedulerEntryMessageListener {...}and in doReceive method I want to call the service com.test.modules.cluster.service.myLocalService exported on the "api" bundle and implemented on the "service" bundle of my previous service builder module.I try to inject the service using the @Reference annotation as I told in my previous message.When I deploy the module in Liferay, the component is in ACTIVE state but with an unsatisfied reference as it is shown below: 531|Active | 10|check.cluster.nodes.scheduler (1.0.0)----------------------- g! b 531 check.cluster.nodes.scheduler_1.0.0 [531] Id=531, Status=ACTIVE Data Root=/opt/liferay/osgi/state/org.eclipse.osgi/531/data "No registered services." Services in use: {org.osgi.service.log.LogService, org.eclipse.equinox.log.ExtendedLogService}={service.id=2, service.bundleid=0, service.scope=bundle} No exported packages Imported packages com.test.modules.cluster.model; version="1.0.0" <check.cluster.nodes-api_1.0.0 [529]> com.test.modules.cluster.service; version="1.0.0" <check.cluster.nodes-api_1.0.0 [529]> com.liferay.portal.kernel.cluster; version="7.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.log; version="7.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.messaging; version="7.0.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.module.framework; version="1.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> com.liferay.portal.kernel.scheduler; version="7.1.0" <org.eclipse.osgi_3.10.200.v20150831-0856 [0]> No fragment bundles No required bundles------------------------g! scr:list 531 BundleId Component Name Default State Component Id State PIDs (Factory PID) [ 531] com.test.modules.cluster.TestTableScheduler enabled [2448] [unsatisfied reference] -----------------------------g! scr:info com.test.modules.cluster.TestTableScheduler*** Bundle: check.cluster.nodes.scheduler (531)Component Description: Name: com.test.modules.cluster.TestTableScheduler Implementation Class: com.test.modules.cluster.TestTableScheduler Default State: enabled Activation: immediate Configuration Policy: optional Activate Method: activate Deactivate Method: deactivate Modified Method: activate Configuration Pid: [com.test.modules.cluster.TestTableScheduler] Services: com.test.modules.cluster.TestTableScheduler Service Scope: singleton Reference: myServiceLocalService Interface Name: com.test.modules.cluster.service.myServiceLocalService Cardinality: 1..1 Policy: static Policy option: reluctant Reference Scope: bundle Reference: ModuleServiceLifecycle Interface Name: com.liferay.portal.kernel.module.framework.ModuleServiceLifecycle Target Filter: (module.service.lifecycle=portal.initialized) Cardinality: 1..1 Policy: static Policy option: reluctant Reference Scope: bundle Reference: SchedulerEngineHelper Interface Name: com.liferay.portal.kernel.scheduler.SchedulerEngineHelper Cardinality: 1..1 Policy: static Policy option: reluctant Reference Scope: bundle Reference: TriggerFactory Interface Name: com.liferay.portal.kernel.scheduler.TriggerFactory Cardinality: 1..1 Policy: static Policy option: reluctant Reference Scope: bundle Component Description Properties: ModuleServiceLifecycle.target = (module.service.lifecycle=portal.initialized) Component Configuration: ComponentId: 2448 State: unsatisfied reference SatisfiedReference: ModuleServiceLifecycle Target: (module.service.lifecycle=portal.initialized) (unbound) SatisfiedReference: SchedulerEngineHelper Target: null (unbound) SatisfiedReference: TriggerFactory Target: null (unbound) UnsatisfiedReference: myServiceLocalService Target: null (no target services) Component Configuration Properties: ModuleServiceLifecycle.target = (module.service.lifecycle=portal.initialized) component.id = 2448 component.name = com.test.modules.cluster.TestTableScheduler Please sign in to reply. Reply as... Cancel
Sergio Gonzalo 8 Years Ago Hello David,Any clue or idea?. Have you change something on the services to make them available for any other component in any other bundle as Liferay makes with services like UserLocalService?. Please sign in to reply. Reply as... Cancel David H Nebinger Sergio Gonzalo 8 Years Ago - Edited If your server is up and you redeploy the bundle w/ the schedule component, is it non-null then?Also are you using the right @Component and @Reference annotations? I know that java8 has it's own @Component annotation and I think Spring might have an @Reference, and if you're using those that will cause problems. Please sign in to reply. Reply as... Cancel Sergio Gonzalo David H Nebinger 8 Years Ago Regarding the annotations, I am using the right ones:import org.osgi.service.component.annotations.Component;import org.osgi.service.component.annotations.Reference;On the other hand, if I try to redeploy the bundle, the result is the same (unsatisfied reference). The only doubt I have is based on the fact I receive an exception with the message of table already exists but I guess this shouldn't be a problem at all, right?.Regarding the service exposed from any service builder plugin, is it accesible by default by any other bundle deployed on the osgi container?. Does it exist any security constraint on the services layer?. Please sign in to reply. Reply as... Cancel
David H Nebinger Sergio Gonzalo 8 Years Ago - Edited If your server is up and you redeploy the bundle w/ the schedule component, is it non-null then?Also are you using the right @Component and @Reference annotations? I know that java8 has it's own @Component annotation and I think Spring might have an @Reference, and if you're using those that will cause problems. Please sign in to reply. Reply as... Cancel Sergio Gonzalo David H Nebinger 8 Years Ago Regarding the annotations, I am using the right ones:import org.osgi.service.component.annotations.Component;import org.osgi.service.component.annotations.Reference;On the other hand, if I try to redeploy the bundle, the result is the same (unsatisfied reference). The only doubt I have is based on the fact I receive an exception with the message of table already exists but I guess this shouldn't be a problem at all, right?.Regarding the service exposed from any service builder plugin, is it accesible by default by any other bundle deployed on the osgi container?. Does it exist any security constraint on the services layer?. Please sign in to reply. Reply as... Cancel
Sergio Gonzalo David H Nebinger 8 Years Ago Regarding the annotations, I am using the right ones:import org.osgi.service.component.annotations.Component;import org.osgi.service.component.annotations.Reference;On the other hand, if I try to redeploy the bundle, the result is the same (unsatisfied reference). The only doubt I have is based on the fact I receive an exception with the message of table already exists but I guess this shouldn't be a problem at all, right?.Regarding the service exposed from any service builder plugin, is it accesible by default by any other bundle deployed on the osgi container?. Does it exist any security constraint on the services layer?. Please sign in to reply. Reply as... Cancel
Robert Chen 8 Years Ago Hi, Sergio,Can your custom service class be loaded by the same class loader used by your cron job class? Please sign in to reply. Reply as... Cancel
(You) 8 Years Ago [...] Alex Man: David H Nebinger: These kinds of scheduled jobs will never be persisted; they are memory resident and only apply during runtime. I did'nt get this, can you tell me why it is not... [...] Read More Please sign in to reply. Reply as... Cancel
Antonio Musarra 7 Years Ago Hi David.Nice article. Unfortunately, Liferay documentation does not include this argument. Just yesterday I published on my blog an article explaining how to take advantage of Gogo Shell for job administration. https://www.dontesta.it/en/2017/07/16/liferay-7-scheduler-manager-gogo-shell-command/ Please sign in to reply. Reply as... Cancel David H Nebinger Antonio Musarra 7 Years Ago I get a 404 trying to access your blog, Antonio. Please sign in to reply. Reply as... Cancel Antonio Musarra David H Nebinger 7 Years Ago - Edited Sorry David. It should be corrected, I did a copy & paste. https://www.dontesta.it/en/2017/07/16/liferay-7-scheduler-manager-gogo-shell-command/ Please sign in to reply. Reply as... Cancel David H Nebinger Antonio Musarra 7 Years Ago Yeah, it still happens, but I don't think it's the URL. I use Opera for the great built-in adblocking support, but I think Opera is not handling the nav to the URL correctly. Not your fault, probably mine. Please sign in to reply. Reply as... Cancel
David H Nebinger Antonio Musarra 7 Years Ago I get a 404 trying to access your blog, Antonio. Please sign in to reply. Reply as... Cancel Antonio Musarra David H Nebinger 7 Years Ago - Edited Sorry David. It should be corrected, I did a copy & paste. https://www.dontesta.it/en/2017/07/16/liferay-7-scheduler-manager-gogo-shell-command/ Please sign in to reply. Reply as... Cancel David H Nebinger Antonio Musarra 7 Years Ago Yeah, it still happens, but I don't think it's the URL. I use Opera for the great built-in adblocking support, but I think Opera is not handling the nav to the URL correctly. Not your fault, probably mine. Please sign in to reply. Reply as... Cancel
Antonio Musarra David H Nebinger 7 Years Ago - Edited Sorry David. It should be corrected, I did a copy & paste. https://www.dontesta.it/en/2017/07/16/liferay-7-scheduler-manager-gogo-shell-command/ Please sign in to reply. Reply as... Cancel David H Nebinger Antonio Musarra 7 Years Ago Yeah, it still happens, but I don't think it's the URL. I use Opera for the great built-in adblocking support, but I think Opera is not handling the nav to the URL correctly. Not your fault, probably mine. Please sign in to reply. Reply as... Cancel
David H Nebinger Antonio Musarra 7 Years Ago Yeah, it still happens, but I don't think it's the URL. I use Opera for the great built-in adblocking support, but I think Opera is not handling the nav to the URL correctly. Not your fault, probably mine. Please sign in to reply. Reply as... Cancel
Ilenia Zedda 7 Years Ago Hi, this code works fine but when you're in a clustered environment the job fails to register and therefore doesn't run.Do you have any idea as why this may happen?Thanks! Please sign in to reply. Reply as... Cancel David H Nebinger Ilenia Zedda 7 Years Ago Which code? Are there any errors or relevant information in the logs? Please sign in to reply. Reply as... Cancel Ilenia Zedda David H Nebinger 7 Years Ago Hi David, thanks for you quick reply - I've tried posting on the lifery forum (https://web.liferay.com/community/forums/-/message_boards/message/92274105) but my post has been blocked as spam! We've implemented a scheduled that looks like your 'public class MyTaskMessageListener extends BaseMessageListener' (so using the latest version instead of the deprecated class).When only one node is up, the job registers fine, but when both nodes are up, the job doesn't get triggered and if we check the details of the active jobs (SchedulerEngineHelperUtil.getScheduledJobs()), our job looks like it's missing the trigger details.There are no errors in the logs so not sure why it's only working in a non-clustered environment---These are our job detailsmessage:{destinationName=null, response=null, responseDestinationName=null, responseId=null, payload=null, values={GROUP_NAME=com.test.messaging.DailyJobMessageListener, EXCEPTIONS_MAX_SIZE=0, JOB_STATE=com.liferay.portal.kernel.scheduler.JobState@4cc7956d, JOB_NAME=com.test.messaging.DailyJobMessageListener}}3storageType:MEMORY_CLUSTERED--These are the details for any other liferay jobmessage:{destinationName=null, response=null, responseDestinationName=null, responseId=null, payload=null, values={GROUP_NAME=com.liferay.asset.publisher.web.internal.messaging.CheckAssetEntryMessageListener, START_TIME=Wed Jul 26 20:14:13 GMT 2017, NEXT_FIRE_TIME=Wed Jul 26 20:14:13 GMT 2017, EXCEPTIONS_MAX_SIZE=0, JOB_STATE=com.liferay.portal.kernel.scheduler.JobState@78b90a1a, JOB_NAME=com.liferay.asset.publisher.web.internal.messaging.CheckAssetEntryMessageListener}}storageType:MEMORY_CLUSTEREDTrigger StartDate:Wed Jul 26 20:14:13 GMT 2017Trigger EndDate:null Please sign in to reply. Reply as... Cancel Antonio Musarra Ilenia Zedda 7 Years Ago For personal experience, I can ensure that the scheduler works in a cluster environment, even with StorageType Persisted. In your case I seem to see that JOBS have the default StorageType. Please sign in to reply. Reply as... Cancel Antonio Musarra Ilenia Zedda 7 Years Ago I recommend you to see one of the Liferay message listener as for example: CheckAssetEntryMessageListener.javahttps://github.com/liferay/liferay-portal/blob/f643e90452469d0c2367e68fcbf6bd52035cec50/modules/apps/web-experience/asset/asset-publisher-web/src/main/java/com/liferay/asset/publisher/web/internal/messaging/CheckAssetEntryMessageListener.java Please sign in to reply. Reply as... Cancel Ilenia Zedda Antonio Musarra 7 Years Ago Yes thanks, unless I'm missing something it looks like the class I've posted on here https://web.liferay.com/community/forums/-/message_boards/message/92274105 except for the fact that we use a cron expression.Sorry David for polluting your blog, feel free to delete my comments since the liferay post has now been published Please sign in to reply. Reply as... Cancel
David H Nebinger Ilenia Zedda 7 Years Ago Which code? Are there any errors or relevant information in the logs? Please sign in to reply. Reply as... Cancel Ilenia Zedda David H Nebinger 7 Years Ago Hi David, thanks for you quick reply - I've tried posting on the lifery forum (https://web.liferay.com/community/forums/-/message_boards/message/92274105) but my post has been blocked as spam! We've implemented a scheduled that looks like your 'public class MyTaskMessageListener extends BaseMessageListener' (so using the latest version instead of the deprecated class).When only one node is up, the job registers fine, but when both nodes are up, the job doesn't get triggered and if we check the details of the active jobs (SchedulerEngineHelperUtil.getScheduledJobs()), our job looks like it's missing the trigger details.There are no errors in the logs so not sure why it's only working in a non-clustered environment---These are our job detailsmessage:{destinationName=null, response=null, responseDestinationName=null, responseId=null, payload=null, values={GROUP_NAME=com.test.messaging.DailyJobMessageListener, EXCEPTIONS_MAX_SIZE=0, JOB_STATE=com.liferay.portal.kernel.scheduler.JobState@4cc7956d, JOB_NAME=com.test.messaging.DailyJobMessageListener}}3storageType:MEMORY_CLUSTERED--These are the details for any other liferay jobmessage:{destinationName=null, response=null, responseDestinationName=null, responseId=null, payload=null, values={GROUP_NAME=com.liferay.asset.publisher.web.internal.messaging.CheckAssetEntryMessageListener, START_TIME=Wed Jul 26 20:14:13 GMT 2017, NEXT_FIRE_TIME=Wed Jul 26 20:14:13 GMT 2017, EXCEPTIONS_MAX_SIZE=0, JOB_STATE=com.liferay.portal.kernel.scheduler.JobState@78b90a1a, JOB_NAME=com.liferay.asset.publisher.web.internal.messaging.CheckAssetEntryMessageListener}}storageType:MEMORY_CLUSTEREDTrigger StartDate:Wed Jul 26 20:14:13 GMT 2017Trigger EndDate:null Please sign in to reply. Reply as... Cancel Antonio Musarra Ilenia Zedda 7 Years Ago For personal experience, I can ensure that the scheduler works in a cluster environment, even with StorageType Persisted. In your case I seem to see that JOBS have the default StorageType. Please sign in to reply. Reply as... Cancel Antonio Musarra Ilenia Zedda 7 Years Ago I recommend you to see one of the Liferay message listener as for example: CheckAssetEntryMessageListener.javahttps://github.com/liferay/liferay-portal/blob/f643e90452469d0c2367e68fcbf6bd52035cec50/modules/apps/web-experience/asset/asset-publisher-web/src/main/java/com/liferay/asset/publisher/web/internal/messaging/CheckAssetEntryMessageListener.java Please sign in to reply. Reply as... Cancel Ilenia Zedda Antonio Musarra 7 Years Ago Yes thanks, unless I'm missing something it looks like the class I've posted on here https://web.liferay.com/community/forums/-/message_boards/message/92274105 except for the fact that we use a cron expression.Sorry David for polluting your blog, feel free to delete my comments since the liferay post has now been published Please sign in to reply. Reply as... Cancel
Ilenia Zedda David H Nebinger 7 Years Ago Hi David, thanks for you quick reply - I've tried posting on the lifery forum (https://web.liferay.com/community/forums/-/message_boards/message/92274105) but my post has been blocked as spam! We've implemented a scheduled that looks like your 'public class MyTaskMessageListener extends BaseMessageListener' (so using the latest version instead of the deprecated class).When only one node is up, the job registers fine, but when both nodes are up, the job doesn't get triggered and if we check the details of the active jobs (SchedulerEngineHelperUtil.getScheduledJobs()), our job looks like it's missing the trigger details.There are no errors in the logs so not sure why it's only working in a non-clustered environment---These are our job detailsmessage:{destinationName=null, response=null, responseDestinationName=null, responseId=null, payload=null, values={GROUP_NAME=com.test.messaging.DailyJobMessageListener, EXCEPTIONS_MAX_SIZE=0, JOB_STATE=com.liferay.portal.kernel.scheduler.JobState@4cc7956d, JOB_NAME=com.test.messaging.DailyJobMessageListener}}3storageType:MEMORY_CLUSTERED--These are the details for any other liferay jobmessage:{destinationName=null, response=null, responseDestinationName=null, responseId=null, payload=null, values={GROUP_NAME=com.liferay.asset.publisher.web.internal.messaging.CheckAssetEntryMessageListener, START_TIME=Wed Jul 26 20:14:13 GMT 2017, NEXT_FIRE_TIME=Wed Jul 26 20:14:13 GMT 2017, EXCEPTIONS_MAX_SIZE=0, JOB_STATE=com.liferay.portal.kernel.scheduler.JobState@78b90a1a, JOB_NAME=com.liferay.asset.publisher.web.internal.messaging.CheckAssetEntryMessageListener}}storageType:MEMORY_CLUSTEREDTrigger StartDate:Wed Jul 26 20:14:13 GMT 2017Trigger EndDate:null Please sign in to reply. Reply as... Cancel Antonio Musarra Ilenia Zedda 7 Years Ago For personal experience, I can ensure that the scheduler works in a cluster environment, even with StorageType Persisted. In your case I seem to see that JOBS have the default StorageType. Please sign in to reply. Reply as... Cancel Antonio Musarra Ilenia Zedda 7 Years Ago I recommend you to see one of the Liferay message listener as for example: CheckAssetEntryMessageListener.javahttps://github.com/liferay/liferay-portal/blob/f643e90452469d0c2367e68fcbf6bd52035cec50/modules/apps/web-experience/asset/asset-publisher-web/src/main/java/com/liferay/asset/publisher/web/internal/messaging/CheckAssetEntryMessageListener.java Please sign in to reply. Reply as... Cancel Ilenia Zedda Antonio Musarra 7 Years Ago Yes thanks, unless I'm missing something it looks like the class I've posted on here https://web.liferay.com/community/forums/-/message_boards/message/92274105 except for the fact that we use a cron expression.Sorry David for polluting your blog, feel free to delete my comments since the liferay post has now been published Please sign in to reply. Reply as... Cancel
Antonio Musarra Ilenia Zedda 7 Years Ago For personal experience, I can ensure that the scheduler works in a cluster environment, even with StorageType Persisted. In your case I seem to see that JOBS have the default StorageType. Please sign in to reply. Reply as... Cancel
Antonio Musarra Ilenia Zedda 7 Years Ago I recommend you to see one of the Liferay message listener as for example: CheckAssetEntryMessageListener.javahttps://github.com/liferay/liferay-portal/blob/f643e90452469d0c2367e68fcbf6bd52035cec50/modules/apps/web-experience/asset/asset-publisher-web/src/main/java/com/liferay/asset/publisher/web/internal/messaging/CheckAssetEntryMessageListener.java Please sign in to reply. Reply as... Cancel Ilenia Zedda Antonio Musarra 7 Years Ago Yes thanks, unless I'm missing something it looks like the class I've posted on here https://web.liferay.com/community/forums/-/message_boards/message/92274105 except for the fact that we use a cron expression.Sorry David for polluting your blog, feel free to delete my comments since the liferay post has now been published Please sign in to reply. Reply as... Cancel
Ilenia Zedda Antonio Musarra 7 Years Ago Yes thanks, unless I'm missing something it looks like the class I've posted on here https://web.liferay.com/community/forums/-/message_boards/message/92274105 except for the fact that we use a cron expression.Sorry David for polluting your blog, feel free to delete my comments since the liferay post has now been published Please sign in to reply. Reply as... Cancel
Ravi Rupapara 7 Years Ago Hi David,I have used the same code as you mentioned above. Every thing is working fine. But I want store scheduler in Database and I have used Storage type as persisted. but there are no any entries in the database for a scheduler and because of that, it is not started automatically when the server is restarted.Following changes I made in your code,/** * getStorageType: Utility method to get the storage type from the scheduler entry wrapper. * @return StorageType The storage type to use. */ protected StorageType getStorageType() { if (_schedulerEntryImpl instanceof StorageTypeAware) { return ((StorageTypeAware) _schedulerEntryImpl).getStorageType(); } return StorageType.PERSISTED; }Please let me know If I am missing something. Please sign in to reply. Reply as... Cancel
(You) 7 Years Ago [...] I have developed a simple scheduler following this blog: https://web.liferay.com/web/user.26526/blog/-/blogs/liferay-7-ce-liferay-dxp-scheduled-tasks The scheduler works fine on a single node. But... [...] Read More Please sign in to reply. Reply as... Cancel
Ales Rybak 7 Years Ago Hi David, nice how-to, it was really easy to get this working on Liferay 7.0.4 CE. There is only one small error: in the deactivate method you need not only unschedule the job but also delete it. Other wise it will stay in the scheduler and won't be rescheduled on the bundle redeployment. But this can be fixed easily by adding schedulerEngineHelper.delete(schedulerEntry, getStorageType());into the method body is a similar way as unschedule.Thanks again, great job. Please sign in to reply. Reply as... Cancel
RAVI RAJAMANI 7 Years Ago So if you're in a cluster, you'll want to stick with either MEMORY_CLUSTERED or PERSISTED to ensure your job doesn't run on every node (i.e. you're running a report to generate a PDF and email, you wouldn't want your 4 node cluster doing the report 4 times and emailing 4 copies). You may want to stick with the MEMORY type when you have, say, an administrative task that needs to run regularly on all nodes in your clusterQuestion : In clustered environment, having a 4 nodes say (node-A , node-B, node-C, node-D).. i need to run a Scheduler always in node-A only.. what configuration i need to Do ? Please sign in to reply. Reply as... Cancel David H Nebinger RAVI RAJAMANI 7 Years Ago You don't set it up like that. Liferay runs the scheduler on all of the nodes, but there is an election process to see who the master will be. The master runs the cluster jobs.In case the master goes down (crashes, taken out of the cluster, stops responding to requests), the remaining nodes will elect a new master and the new master will process the jobs that are still waiting.If you somehow got the scheduler to only run on one node, if that node would fail you wouldn't be running jobs at all anymore. Please sign in to reply. Reply as... Cancel
David H Nebinger RAVI RAJAMANI 7 Years Ago You don't set it up like that. Liferay runs the scheduler on all of the nodes, but there is an election process to see who the master will be. The master runs the cluster jobs.In case the master goes down (crashes, taken out of the cluster, stops responding to requests), the remaining nodes will elect a new master and the new master will process the jobs that are still waiting.If you somehow got the scheduler to only run on one node, if that node would fail you wouldn't be running jobs at all anymore. Please sign in to reply. Reply as... Cancel
Dhruv Pandey 5 Years Ago The Deprecated method works fine. When trying new method I am getting error at: _schedulerEntryImpl = new SchedulerEntryImpl(getClass().getName(), jobTrigger); The constructor SchedulerEntryImpl(String, Trigger) is undefined Please sign in to reply. Reply as... Cancel
Toni Pérez Rodil 5 Years Ago - Edited Thank you very much for the helpful blog post, David! I have looked for information related to schedulers in Liferay 7.x in the documentation and found nothing yet. But, by chance, this Jira ticket was found (https://issues.liferay.com/browse/LPS-89033), which perhaps is useful to update the "One More Thing..." section of the blog post. It seems that now, the mentioned scenario is prevented. By the way, as no official documentation was found (although this blog post fills in the gap, in my opinion), we took a look at the scheduled jobs available in Liferay source code. For instance, the "com.liferay.journal.web.internal.messaging.CheckArticleMessageListener" class. I wonder why it is so different to the one described in this blog post. I mean that Liferay's code looks like straightforward. Are they not cluster-aware? (It sounds a bit strange to me but I could open a support ticket if so) Or is there a lean way to write scheduled jobs nowadays without requiring the "_initialized" check? Kind regards and thank you very much. Please sign in to reply. Reply as... Cancel David H Nebinger Toni Pérez Rodil 5 Years Ago - Edited Liferay does not really build their jobs to support ongoing development, redeployment, those kinds of things... The Liferay jobs are core system jobs that will start when the portal starts and stay running throughout and not get stopped at some point for a redeployment of a newer or updated version. This example tries not to make such an assumption, so the _initialized thing allows for a cleaner process to deal with possible redeployments. Please sign in to reply. Reply as... Cancel Toni Pérez Rodil David H Nebinger 5 Years Ago - Edited Oh, sorry, I have read your reply after sending the link to the other blog post. Thank you very much for the additional information. In order to take a decision based upon data, I think we will assess both approaches. Please sign in to reply. Reply as... Cancel Toni Pérez Rodil Toni Pérez Rodil 5 Years Ago - Edited I think I answer myself: there is a very detailed blog post talking about the history of the scheduler API (https://liferay.dev/blogs/-/blogs/evolution-of-the-liferay-scheduler-api). At the end, in section named "Liferay Scheduler Code Samples", there are... code samples. And, as far as I understand, it seems the Liferay's way is good enough even in cluster environments. Please sign in to reply. Reply as... Cancel
David H Nebinger Toni Pérez Rodil 5 Years Ago - Edited Liferay does not really build their jobs to support ongoing development, redeployment, those kinds of things... The Liferay jobs are core system jobs that will start when the portal starts and stay running throughout and not get stopped at some point for a redeployment of a newer or updated version. This example tries not to make such an assumption, so the _initialized thing allows for a cleaner process to deal with possible redeployments. Please sign in to reply. Reply as... Cancel Toni Pérez Rodil David H Nebinger 5 Years Ago - Edited Oh, sorry, I have read your reply after sending the link to the other blog post. Thank you very much for the additional information. In order to take a decision based upon data, I think we will assess both approaches. Please sign in to reply. Reply as... Cancel
Toni Pérez Rodil David H Nebinger 5 Years Ago - Edited Oh, sorry, I have read your reply after sending the link to the other blog post. Thank you very much for the additional information. In order to take a decision based upon data, I think we will assess both approaches. Please sign in to reply. Reply as... Cancel
Toni Pérez Rodil Toni Pérez Rodil 5 Years Ago - Edited I think I answer myself: there is a very detailed blog post talking about the history of the scheduler API (https://liferay.dev/blogs/-/blogs/evolution-of-the-liferay-scheduler-api). At the end, in section named "Liferay Scheduler Code Samples", there are... code samples. And, as far as I understand, it seems the Liferay's way is good enough even in cluster environments. Please sign in to reply. Reply as... Cancel
Nitin Mittal 4 Years Ago - Edited Hi David, I have implemented the scheduler as the way you suggested and it is working fine. I am facing a issue that whenever i restart application server, job is not in quartz tables anymore. My Storage Type is persisted. The jobs details are there in the database tables after triggering a job but when i stops the server, the job details are gone and quartz_tables are empty. I also removed the deactivate method too, but still after server stops, the job is not there is database. Can you please suggest me anything on how i keep the job in Database after server restarts. Please sign in to reply. Reply as... Cancel