quartz-scheduler,liferay-6 , How to trigger scheduler job immediately in liferay 6.1.1


How to trigger scheduler job immediately in liferay 6.1.1

Question:

Tag: quartz-scheduler,liferay-6

for project needed, I need a button when I click it it will trigger a scheduler job immediately in liferay 6.1.1. I know before liferay 4.2 there is a API JobScheduler.triggerJob() to make it happen. but in the 6.1.1 this API is removed, is there any other way I can do this? Thanks a lot.


Answer:

I guess better way is to execute your process service method on button click event rather than manually triggering a job. If you already have a job, it can call the same process service method.

However below information can be useful if you want to got with custom schedule a job.

SchedulerEngineHelperUtil.schedule menthod will accept custom trigger. Liferay allows to specify cron express as trigger. You can use below expression to trigger immediately.

* * * * * ? *

An example code custom scheduler can be found in LayoutServiceImpl.schedulePublishToLive method. I believe you can do similar with above cron express to invoke a job immediately.

Trigger trigger = new CronTrigger(
            jobName, groupName, schedulerStartDate, schedulerEndDate, cronText);

SchedulerEngineHelperUtil.schedule(
            trigger, StorageType.PERSISTED, description,
            DestinationNames.LAYOUTS_LOCAL_PUBLISHER, publisherRequest, 0);

Related:


Quartz Scheduler not triggering the job when configured via Spring 4


java,spring,quartz-scheduler
Ive being from sometime trying to setup a little program that uses Spring and Quartz together to schedule a task. I followed some other similar answers with no luck. At the moment I think I have all configured correctly, I see no more exceptions but my job looks like its...

Quartz | Cron expression not working as expected


java,cron,quartz-scheduler,cronexpression
I'm trying to build up a cron expression that will trigger in every minute starting from a given hourly range. My expression would be: 0 0/1 12/10-14 * 1-5 ? I'm expecting this to work as, starting from 12.04 AM to 02.00PM trigger at every minute. But when I start...

How to delete a portlet in Liferay 6.1 programmatically from code


java,javascript,java-ee,liferay,liferay-6
I'm working on Liferay 6.1 I want to delete a portlet in Liferay 6.1 from my code. What I have done so far is: <a onclick="Liferay.Portlet.close('#p_p_id_28_'); return false;">Remove</a> Above code is working fine. But it is working on the current page only i.e. it can delete the portlet(s) which is...

Difference between Liferay Mobile SDK and Liferay Screens


mobile,liferay,liferay-6
Can someone tell me the difference between Liferay Mobile SDK and Liferay Screens? Thanks a lot....

Spring+Quartz Fire job execution only if previous has finished


spring-mvc,quartz-scheduler
I'm using SpringMVC (4.x) along with Quartz (2.x). I'm setting a bean defnition file to fire a simple job, but wnat to make sure that the job is only fired if the previous execution of that job has already finished. Is there a parameter I can inform to SimpleTriggerFactoryBean in...

Is it possible to trigger and run jobs from different processes with AdoJobStore?


c#,quartz-scheduler,quartz.net
I am implementing a Windows service that's responsible for running the scheduler and executing the jobs. I want to trigger the jobs from a web application but since the web application does not run a scheduler I can't do anything with the triggers I build. TriggerBuilder.Create() .WithIdentity(commandName,groupName) .ForJob(commandName) .StartNow() .Build();...

AJAX Call not working in liferay 6.2.2?


ajax,liferay,hook,liferay-6
I am trying to perform a AJAX Call. But what i get is ResourceURL as undefined when i see the error in chrome. Below is my code. Declaration: <liferay-portlet:resourceURL copyCurrentRenderParameters="<%= false %>" var="mainURL" /> Implementation: xhr2.open("POST", resourceURL , false); But at implmentation i get resourceURL as undefined. In 6.1 it...

Customizing liferay Calendar portlet


liferay,liferay-6,liferay-ide
I'm trying to customize Calendar portlet using this below instructions. https://www.liferay.com/it/documentation/liferay-portal/6.2/development/-/ai/creating-plugins-to-extend-plugins-liferay-portal-6-2-dev-guide-03-en Its basically creating Plugins to extend plugins. In order to achieve above, I need "Calendar-portlet.war" . I don't find any war file for calendar portlet for my version. So i decided to build myself. Then i downloaded Portal plugins...

Passing array of arguments to Quartz Scheduler


java,command-line-arguments,quartz-scheduler
I am trying to add a Quartz Scheduler to an existing Java class. The class uses String[] args as input from the main function. public static void main(String[] args) { //validate(args); summarizeData(args); } But then the Java class implements Job, and it has to use the execute method which only...

Liferay database table work flow?


liferay,liferay-6
I am new to Liferay. Now I need to create the flow chart which has the Liferay table work flow in following scenarios, 1) What are the list of table will reflect/update if we create the site admin? 2) What are the list of table will reflect/update if we create...

How to set a cron expression of cron job from controller in Grails


grails,cron,quartz-scheduler
I want to get a cron expression from a user through .gsp and want to set it as new cron expression of Dynamic Job from controller. Intially my cron expression was like "0 1 0 * * ?" but now want to change it to.. say String cronExpression="0 2 0...

I am working on a MVC Portlet and the document i am saving is not going to db


liferay,liferay-6
Here is my Action Class, where I have to save any document to database but its not working and getting error in console that NoSuchMethodException (javax.portlet.ActionRequest, javax.portlet.ActionResponse) package com.test.docupload; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import javax.portlet.ResourceRequest; import javax.portlet.ResourceResponse; import javax.portlet.PortletException; import com.liferay.counter.service.CounterLocalServiceUtil; import...

Grails Quartz - How to conbine similar two jobs into one job?


grails,quartz-scheduler
I have to similar two jobs and want to conbine the two jobs into one job. How can I conbine AJob and BJob into a new Job? In other words, I want to refactor AJob.groovy and BJob.groovy into one class NewJob.groovy. AJob.groovy class AJob { def testService static triggers =...

Unit testing Quartz plugin for Grails


unit-testing,grails,quartz-scheduler
I have some trouble writing the most basic unit test for a job. My problem can be recreated by creating a new job by running grails create-job my in the console. This will create two files MyJob.goovy (under the default package myApp - resides in test\unit\myApp) MyJobSpec.groovy (under the default...

Bootstrap dropdown-menu not working in Liferay 6.2


jquery,html,css,twitter-bootstrap,liferay-6
I'm trying to do a new navbar in Liferay 6.2, but dropdown menu isn't working. I suspect AUI is guilty of this, but not sure here you got my code: <div class="navbar"> <div class="navbar-inner"> <div class="container"> .... <div class="btn-group"> <button type="button" class="btn btn-danger" data-toggle="dropdown" data-target="#demo"> simple collapsible </button> <ul class="dropdown-menu...

How to ignore Liferay user removed from LDAP errors?


ldap,log4j,liferay,liferay-6,openldap
I have a Liferay 6.1 instance that is connected to LDAP. New users get imported nicely, but when I remove a user from the LDAP directory, Liferay starts throwing exceptions when it tries to sync users from LDAP. These seem to be safe to ignore, but they produce several megabytes...

Liferay roles and permissions for publishing


permissions,liferay-6,roles
I am new to Liferay, since there are many roles in Liferay, i'm in confusion. I need to implement a particular scenario like, Admin --> can publish Users(under admin) --> can edit content and make request to admin for publishing can any one explain how to implement this...

Should I use a Quartz XML job file or configure jobs with code


java,xml,quartz-scheduler
I'm picking up Quartz Scheduler for a new project. I've use Quartz before, and I configured it using an XML job file. Now I look at the current Quartz documentation, and all the examples are code snippets. Is the XML job file deprecated? Should I do my job scheduling and...

Changing request parameter value in Struts2 interceptor


java,struts2,request,liferay-6,interceptor
Does anybody know if it is possible to change/remove request parameter values in a Struts2 interceptor? The request parameter Map is an instance of UnmodifiableMap so it doesn't look like it can be manipulated with in the interceptor. UPDATE: I'm using Liferay so uParamsMap will be an UnmodifiableMap public String...

How to host a newportal instance in liferay


liferay,liferay-6
I have created a new portal instance in liferay. I want to host it in my local Ubuntu machine. What i have done is created a WEB ID as newportal.com Virtual host as www.newportal.com and the mail domain as newportal.com thanks...

Liferay control panel to code


java,liferay-6
I'm new to Liferay but I have to update (fix bug and add some enhancement) a site made with Liferay 6.1.1 I have a form that create an organization and a blank site for it. The problem is that currently, an admin have to go to the control panel, change...

How to pass HTTP request to Web-Service


ajax,web-services,liferay,liferay-6,portlet
From my portlet JSP, I am trying to make a Ajax call to web-service. My aim is to pass HTTP request object as a parameter to web-service method. Please suggest.

Users in Guest role see default theme instead custom one for given layouts


liferay,liferay-6,liferay-theme
Users in Guest role see default theme instead custom one for pages which inherit from defined custom theme. This seems to be very strange problem. Even though layouts have specified to inherit theme from parent theme: Use the same look and feel of the Public Pages. Guests see them as...

Spring + Hibernate + Quartz: Dynamic Job


java,spring,hibernate,quartz-scheduler
I want to create dynamically jobs using Quartz, Spring and Hibernate. Users interact with a web service to create jobs of this class: public class StartJobSpring extends QuartzJobBean { private String jobId; private String jobType; @Autowired private NoaJobInstancesDAO njiDAO; @Transactional @Override protected void executeInternal(JobExecutionContext context) throws JobExecutionException { JobKey key...

Migrating from Spring 3 to Spring 4 - org.springframework.scheduling.quartz.CronTriggerBean


java,spring,spring-mvc,scheduled-tasks,quartz-scheduler
I'm trying to migrate from spring 3.0.5 to spring 4.1.X . Spring 3 has Class named as "org.springframework.scheduling.quartz.CronTriggerBean" But Spring 4 has doesn't include this class name. [5/28/15 20:10:16:798 EDT] 00000092 ClassPathXmlA W org.springframework.context.support.AbstractApplicationContext __refresh Exception encountered during context initialization - cancelling refresh attempt org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.scheduling.quartz.CronTriggerBean] for...

Amazon EC2 - Quartz and Job not running at correct time


java,amazon-web-services,amazon-ec2,cron,quartz-scheduler
I have a java app deployed on an Amazon EC2 server. I use quartz for scheduling various jobs. I tried scheduling a job to run at 9am - I noticed it didnt execute until 10am I then tried to execute a job at 9am GMT-5 -should of executed at 2pm...

Getting Quartz.net to ignore misfires


quartz-scheduler,quartz.net
I'm building a windows service which is performing a scheduled task which processes a queue of commands (from a legacy system) at a regular interval (once per min) using Quartz.net If the task takes longer than 1 min, which would be unusual but possible under certain circumstances, I'd like it...

Seam Quartz Dispatcher not firing on seconds and minutes field for a given cron expression


java,jboss,quartz-scheduler,seam,cronexpression
I have a Quartz job that is to fire for a certain time repeatedly. Unfortunately it does not fire for some unknown reasons. Here is my cron expression : 0/5 0 0 * * ? So basically the job should be fired every 5 seconds. This is the part which...

how to integrate CMS component of Liferay in a Spring java application?


spring-mvc,content-management-system,liferay-6,drools-guvnor
I have very dynamic content for each section of the web portal.The rules for that content are stored in the rule engine drools along with the content,Now I want to separate the content part from drools so as to make content editable via UI. Liferay has been opted as CMS....

Liferay 6.2 clustering issue with multicast


lucene,cluster-computing,liferay-6,ehcache,jgroups
I am trying to cluster ehcache and lucene with Liferay 6.2 EE sp2 bundle on 2 servers with mutlicast enabled. WE have Apache HTTPD servers fronting tomcat servers using reverse proxy. A valid 6.2 license is deployed on both the nodes. We user the following properties in the portal-ext.properties: cluster.link.enabled=true...

Quartz clustering load balancing algorithm internal implementation in Jdbcjobstore


quartz-scheduler
I have configured quartz in my application. It works on cluster and i can see cluster nodes are triggering jobs one at a time. However, i have a question about how load balancing algorithm works in quartz. I want to know at what point in jdbcJobstore code, a node get...

What is the cron definition for each minute for a job in grails?


grails,cron,quartz-scheduler,jobs
I'm using Quartz plugin for Grails for a synchronized job minute by minute, but I'm unable to use the 0 * * * * * definition and is throwing some exception: Error loading plugin manager: Unable to locate constructor with Class parameter for class grails.plugins.quartz.DefaultGrailsJobClass (NOTE: Stack trace has been...

Service builder doesn't delete table in DB


liferay,liferay-6,liferay-service-builder
Hi all, I'm using LR 6.1. I created a new entity Called " Recommendation" in service.xml then a run BuildServices with Ant to generate the service builder Files. Now I want to delete the Entity. So I Deleted if from service.xml, but nothing happens in Data base and the other...

withSchedule(ScheduleBuilder) in the type TriggerBuilder is not applicable for arguments (MutableTrigger)


java,java-ee,quartz-scheduler
Following code gives error like : The method withSchedule(ScheduleBuilder) in the type TriggerBuilder is not applicable for the arguments (MutableTrigger) public static Trigger buildTriggerForJob(int hours, int minutes, int seconds, String name, String groupName) { return org.quartz.TriggerBuilder .newTrigger() .withIdentity(name, groupName) .withSchedule( SimpleScheduleBuilder.simpleSchedule().withIntervalInHours(hours).withIntervalInMinutes(minutes) .withIntervalInSeconds(seconds).repeatForever().build()); } ...

QuartzScheduler - SimpleTrigger executing repeatedly


java,quartz-scheduler
I'm running Quartz version 1.8.4 When using the following code simpleTrigger.setName(triggerName); simpleTrigger.setGroup(triggerGroupName); simpleTrigger.setStartTime(startTime); simpleTrigger.setRepeatCount(0); simpleTrigger.setRepeatInterval(0L); simpleTrigger.setEndTime(null); I get a trigger that executes multiple times. On checking the database, I found: TRIGGER_NAME TRIGGER_GROUP REEAT_COUNT REPEAT_INTERVAL TIMES_TRIGGERED simplejob simplegroup 0 0 3 And the trigger keeps being executed....

Using quartz.net, get callback for status from remote WCF service


wcf,quartz-scheduler,wcf-binding,quartz.net
Probably a common pattern, but I haven't been able to find any help. I have an ASP.NET web application hosting Quartz, and I have job that fires on schedule. The job calls a remote WCF service: public class SimpleJob : IJob { public SimpleJob() { } public void Execute(IJobExecutionContext context)...

Include ftl file in ext plugin


maven,liferay,liferay-6
I have ext-plugin and I would like to override this file: portal-impl\src\com\liferay\portlet\dynamicdatamapping\dependencies\ddm\documentlibrary.ftl. After maven build, this file isn't include in my porta-impl-ext.jar. In my portal-impl-ext's pom.xml I have this code: <build> <plugins> <plugin> <groupId>com.liferay.maven.plugins</groupId> <artifactId>liferay-maven-plugin</artifactId> <version>${liferay.maven.plugin.version}</version> <configuration>...

Custom Taglib in liferay using Spring MVC & Maven?


java,spring,maven,liferay,liferay-6
How do i proceed with creating a custom Taglib in a liferay.For now i have a portlet created in place. My obvious questions are: Do i need to create a hook plugin and override a jsp for acheiving this target? Do i need to download any jars? Which all files...

Setting nextFireTime of a quartz job manually in groovy


groovy,quartz-scheduler
I want to use a own errorhandling on quartz jobs. Each job has a different waiting time, when an exception occurs. For example, a job runs every 30 seconds, but when an exception occurs, the job should wait for 5 minutes. I tried this approach, but it doesn't work: SchedulerFactory...

Liferay Table Column Description


liferay,liferay-6
I am trying to understand the field level description for each table in life ray which are related to user management. I did not understand the purpose of some columns in the following tables. USER_: GRACELOGINCOUNT FACEBOOKID PORTRAITID GROUP_: PARENTGROUPID LIVEGROUPID TREEPATH TYPE_ TYPESETTINGS REMOTESTAGINGGROUPCOUNT ADDRESS: TYPEID PRIMARY_ PHONE: TYPEID...

Start a fixed delayed schedular when a method start and stop when finishes


java,spring,spring-boot,quartz-scheduler,spring-scheduled
I have a Spring Boot web application. I want to start a fixedDelayed scheduled job when a method starts. And stop scheduled job when someMethod method finished. I read the documentation but I couldn't understand how. I want to wirte someting to db every 30 second while someMethod is still...

Identify that the logged in user is an administrator or not using velocity


liferay,liferay-6,liferay-theme
I would like to identify that the logged in user is an administrator or not using velocity. The goal is to show the dockbar to the administrator user(s) only. I have tried following code, but is not working for me: #if ($is_signed_in && $permissionChecker.isGroupAdmin($group_id)) #dockbar() #end Please help me!!!...

How to trigger scheduler job immediately in liferay 6.1.1


quartz-scheduler,liferay-6
for project needed, I need a button when I click it it will trigger a scheduler job immediately in liferay 6.1.1. I know before liferay 4.2 there is a API JobScheduler.triggerJob() to make it happen. but in the 6.1.1 this API is removed, is there any other way I can...

liferay portlet non-liferay JNDI data source null


oracle,tomcat7,jndi,liferay-6,portlet
For a Liferay 6.2 custom portlet accessing a non liferay Oracle database we are running into an issue where the data source returned is null. We have configured the tomcat/conf/context.xml <!-- Adding custom New non liferay datasource --> <Resource name="jdbc/NewPool" auth="Container" type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST...

How to add a custom section to the User Edit Screen in Liferay?


liferay,liferay-6,liferay-aui,liferay-ide
I want to customize the User-Edit page in Liferay 6.2. First of all I wanted to add a new section to the bar on the right of the user edit screen (http://i.imgur.com/dshV5cJ.png). I have realized this with properties like users.form.add.main=customportlet When i click on the new created section it opens...

How do I write this Cron Expression?


grails,cron,quartz-scheduler
I am trying to write a cron expression for a job which should run every 3 days at 9AM GMT. This is what I am writing "0 0 9/72 ? * ?" But I get it's as an invalid cron expression because I suppose there can not be two question...

In liferay market place, I am unable to submit the project


liferay,liferay-6
In Liferay market place i am stuck at the place "Upload Liferay Plugin Packages " When ever i am trying to upload a war file Please help me to short it out :)...

Lifefay freemarker ADT: methods unavailable?


java,liferay,liferay-6,freemarker
I'm trying to work on some ADT for asset publisher (Documents and Media type), but I often have a message telling me that : Expression assetRenderer.getDataRepositoryId is undefined or Expression assetRenderer.getFileEntryId is undefined I found some threads where people said that we must add velocity.engine.restricted.classes= velocity.engine.restricted.variables= freemarker.engine.restricted.classes= freemarker.engine.restricted.variables= in portal-ext.properties...

Quartz Scheduler keeps creating new objects leading to OutOfMemoryError


java,memory-leaks,out-of-memory,quartz-scheduler
I've just implemented Quartz following the quick start guide: import static org.quartz.JobBuilder.newJob; import static org.quartz.SimpleScheduleBuilder.simpleSchedule; import static org.quartz.TriggerBuilder.newTrigger; import org.quartz.JobDetail; import org.quartz.Scheduler; import org.quartz.SchedulerException; import org.quartz.Trigger; import org.quartz.impl.StdSchedulerFactory; public class Quartz { public static void startScheduler() throws InterruptedException{ try { Scheduler scheduler =...