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


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.


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);

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


QuartzScheduler - SimpleTrigger executing repeatedly

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....

AJAX Call not working in liferay 6.2.2?

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...

Difference between Liferay Mobile SDK and Liferay Screens

Can someone tell me the difference between Liferay Mobile SDK and Liferay Screens? Thanks a lot....

Changing request parameter value in Struts2 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...

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

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...

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

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...

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

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...

Spring+Quartz Fire job execution only if previous has finished

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...

Liferay database table work flow?

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...

Getting Quartz.net to ignore misfires

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...

Include ftl file in ext plugin

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>...

Bootstrap dropdown-menu not working in Liferay 6.2

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...

liferay portlet non-liferay JNDI data source null

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...

Service builder doesn't delete table in DB

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...

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

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...

Liferay Table Column Description

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...

How to pass HTTP request to Web-Service

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.

Customizing liferay Calendar portlet

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...

Quartz Scheduler keeps creating new objects leading to OutOfMemoryError

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 =...

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

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 :)...

How to host a newportal instance in liferay

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...

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

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();...

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

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()); } ...

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

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...

Lifefay freemarker ADT: methods unavailable?

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...

Liferay 6.2 clustering issue with multicast

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...

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

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)...

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

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...

Spring + Hibernate + Quartz: Dynamic Job

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...

Liferay control panel to code

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...

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

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...

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

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....

Amazon EC2 - Quartz and Job not running at correct time

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...

Setting nextFireTime of a quartz job manually in groovy

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...

How to trigger scheduler job immediately in liferay 6.1.1

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...

Quartz Scheduler not triggering the job when configured via Spring 4

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 clustering load balancing algorithm internal implementation in Jdbcjobstore

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...

Custom Taglib in liferay using Spring MVC & Maven?

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...

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

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...

Unit testing Quartz plugin for Grails

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...

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

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 delete a portlet in Liferay 6.1 programmatically from code

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...

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

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 ignore Liferay user removed from LDAP errors?

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

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...

How do I write this Cron Expression?

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...

Quartz | Cron expression not working as expected

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...

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

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 =...

Passing array of arguments to 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...