Scheduling a java code to run at a later time
Hi,
I am working on a part of a project where in when i make a request for a report
to be generated from a jsp, the java code that generates the report must be
scheduled to run in the night time e.g 12 AM. How do i go about doin this...??
Thanks
Message was edited by:
Naik1983
Try a scheduler. I could recommend Quartz: http://www.opensymphony.com/quartz/
Similar Messages
-
How to schedule a concurrent request to run at a specified time/day?
Hi All,
How to schedule a concurrent request to run at a specified time/day (ex: Sunday 12pm)?
Thanks,
Chiru
Message was edited by:
Megastar_ChiruIs this to run periodically ?
During the request submission, click schedule, choose the specific days, and click on S = Sunday.
Change the start date on the date of the sunday you want to run, eg : 15-JUL-07 14:00:00, change the end date as well. -
How do I schedule an automator script to run at a certain time every day?
How do I schedule an automator script to run at a certain time every day?
This used to be done through iCalendar and this option is no longer available.
How do I do this?
--KenoliKenoli Oleari1 wrote:
How do I schedule an automator script to run at a certain time every day?
This used to be done through iCalendar and this option is no longer available.
How do I do this?
--Kenoli
You can use lauchd to run the script.
Here's an example of an Automator App that I have scheduled to run at 7am daily:
You would save this as com.yourname.plist and put it the the Folder: ~/Library/LaunchAgents/ (then log out and back in, or reboot)
(To run a workflow, change open to automator)
(A nice GUI launchd editor is Lingon)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.tonyt.EventReport</string>
<key>ProgramArguments</key>
<array>
<string>open</string>
<string>/Users/Tony/Library/Scripts/Events Report.app</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>7</integer>
<key>Minute</key>
<integer>0</integer>
</dict>
</dict>
</plist> -
Setting a sql statement to run at a later time
Hello,
Is there a way to submit a sql but let it run at a later time? Maybe a sleep function? Thank you.Hi Jafar,
We can also opt for the following utility :----
The DBMS_LOCK.sleep procedure in oracle is used to pause a program for the specified number of seconds. The time can be specified down to hundredths of a second:
BEGIN
DBMS_LOCK.sleep(seconds => 5.01);
END;
Cheers :) -
How to specify a file path in java code to run on Unix machine?
Hi
I have a problem when running my project Swing on Unix machine.
In my code, the user will press a button and then the program will look for the file "ReadMe" in the folder "Documentation" , and reads the content of this file. My code is "Documentation\\ReadMe" and it works well on PC. (The folder "Documentation" is in the same directory with my Java code).
But when I try on Unix, the program can not read the file. It can only read the file "ReadMe" if I take this file and put it in the same directory with my Java code ( this means not through another folder). So how can we make it read the file in a folder ? It seems that "Documentation\\ReadMe" does not work in Unix, or the symbol "\\" does not work.
I would be thankful if anybody can help me with this.
Thank you very muchYou really shouldn't use any path method, as neither are very consistant or platform independent. The JVM provides a way to grab resources from the classpath. These resources can be any data at all, in fact, it's how java itself locates classes. Here's an example how you would do this in a non-static method.
public URL getReadMe() {
// In this context the forward slash is universal
String docDirectory = "Documentation/"
// We have to use the classloader to grab the resource
ClassLoader cl = this.getClass().getClassLoader();
// Next we get the resource
URL readMeURL = cl.getResource(docDirectory + "ReadMe");
return readMeURL;
}The URL can be used in whatever way you need to get the information out of the resource. If it was an image you might use the "Toolkit" to make an image object out of it. The great thing about this method is it will work even if your loading the program out of a Jar file. The resource paths start at the top of the classpath, just like classes. -
Putting a helloword.java code to run on Sun Java Web Server
Hello,
Given helloworld.jsp:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HelloWorld extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println("<HTML>");
out.println("<HEAD><TITLE>Hello World</TITLE></HEAD>");
out.println("<BODY>");
out.println("<H1>Hello World</H1>");
out.println("Today is: " + (new java.util.Date().toString()) );
out.println("</BODY></HTML>");
} // doGet
} // HelloWorld
How can I put this code to run on Sun Java System Web Server, how to compile this ? what and how to put in the webserver document and how to access it ?
Thanks for verbose and basic information about this, appreciated...What you wrote is not a JSP. It is a Java Servlet.
You need to compile it. That creates HelloWorld.class.
Create a directory say hello. You need to create a directory structure as mentioned below.
hello|
WEB-INF|
web.xml
classes|
HelloWorld.class
You need to package it in a war (web archive) file.
%cd hello
%jar cvf hello.war .
Then deploy this war file using admin GUI or wadm CLI.
I would suggest using Netbeans IDE to create the web application.
To deploy the war file on SJS web server 7 update 2, see my blog at
http://blogs.sun.com/kmeduri/entry/how_to_deploy_a_war -
How to find that a java program is running for the first time on daily basi
it is like this
1. i will ran a java program every day and i have to find that it is running for the first time(as i may stop that program and may run again the same day )
Pls share ur ideassan.kumar wrote:
it is like this
1. i will ran a java program every day and i have to find that it is running for the first time(as i may stop that program and may run again the same day )
Pls share ur ideasAs kajbj said - you need to store a token / file with a run date on the file system. Each time the application runs, have it compare with the date from this file with the current date. If different, it's the first run of the day. If not, it is not the first run of the day. Each time have it update the date on the file. -
Can you Schedule an email to be sent at a later time in Mail 7.1?
Hello! Is there still no option for Sending an Email at a later time/date in Mail 7.1??
Just came across this post as I'm looking for a way to do this on my iPad or phone. As far as scheduling emails on my MacBook Pro and iMac, I use Send Later. Integrates well with mail and has been updating every time mail has an update. Just type up your email as normal, and instead of clicking Send, 'Send Later' adds a Send Later button right next to the Send button. Click that and select your date and time. Very easy, simple and works well. Here's their link - http://www.chungwasoft.com/sendlater/
Also it's not freeware, think its $9.99, but again well worth it as you get all the updates no cost. -
How to Schedule a BPMN process to run at a particular time everyday?
I have a timer start event for a BPMN process. I am using BPM 11g. I want that my process should trigger automatically everyday at 7pm. Can anyone please assist how to achieve this.
I have tried to put in Time Cycle tab, *0 Months 1 Days 19:0:0*, but it is not working. Please help.Have the start event kick off in 24 hour cycles using a Start Timer event -> add an exclusive gateway that tests to see if it is after 7pm -> add a sequence flow to handle if is before 7pm -> add a Catch Timer event in the sequence flow using the logic in the previous post in the sequence flow that handles before 7pm -> add another sequence flow from the Exclusive Gateway to handle after 7pm -> add a Catch Timer event in this sequence flow using the logic in the previous post in the sequence flow -> the logic in this timer is the same except you'd add 24 hours (43) so that it kicks off tomorrow.
Dan -
I have heard rumors that this is doable using Automator and iCal. I have also heard rumors that Apple Scripts are the way to go and I have found a few online (likely from 17 year olds in their basements) -- I must admit, I'm a little leary about copying and pasting a script into my computer. I'd much rather have detailed instructions on how to set it up myself.
I would be most grateful for some help with this!
Thank you!!
P.S. Also, if anyone knows if there is a way to use shortcuts in Apple Mail to trigger canned messaging I'd appreciate it. You can do this with the iPhone (ex: you can set it up so that when you type CB in the text field, it says "I'll have to call you back" or whatever you want it to say).+1
Scheduling an email is a deeply important productivity feature that I really hope Apple can incorporate into the next update of Mail. -
Run java code on report completion
I understand that Business Objects allows for custom notifications when a scheduled report is completed successfully. Is there a way in Java to be notified when a report is successfully completed? I want to run some code upon report completion. Thanks.
When you create a schedule event, you can decide if the event will be triggered when the report succeeds, fails, or both.
You can then set it up so that each time the event is triggered, a java app that has been published to enterprise is run. The difficulty here is that you will probably want to know exactly "which" report has completed succcesfully (Unless you set up a seperate event for each report) - and I don't know of any way to do that reliably.
But if you just want some java code to run each time a report is completed, then you can use this method.
So the steps would be:
1. Create Schedule Event
2. When you schedule the report - assign the event to it (You won't be able to do this in the CMC - you need to use either custom code or Infoview)
3. Publish your java code to Enterprise
4. Schedule your java code to run, and set the events to wait for to the event you assigned in Step 2
a programmer learning programming from perl is like a chemisty student learning the definition of "exothermic" with dynamite -
Schedule PL/SQL Code?
Hi
Is it possible to schedule PL/SQL code to run at a specific time during the day?
I require daily code to run to send email reminders to users that havent completed certain tasks in the database. If this is possible, how would I go about scheduling it?
Thanks
AdamHi,
If you need to run a procedure one way could be to use the dbms_job.SUBMIT package .
declare
jn binary_integer;
begin
dbms_job.SUBMIT(jn,'procedure name;'
,sysdate , '(sysdate) + 1/1440');
-- one minute delay, execute once only,delete upon success.
dbms_output.put_line(jn);
COMMIT;
end;
If you are in Oracle 10g then you can use DBMS_SCHEDULER .
http://www.oradev.com/dbms_scheduler.jsp
Thanks -
How to make a scheduler in Java
I am interested in make a scheduler in java that can run my own services according to schedule.Can any one help me for this.Thanks in advance.
RizwanFollow this code Hope this will help u
import java.util.Timer;
import java.util.TimerTask;
* Simple demo that uses java.util.Timer to schedule a task to execute
* once 5 seconds have passed.
public class Reminder {
Timer timer;
public Reminder(int seconds) {
timer = new Timer();
timer.schedule(new RemindTask(), seconds*1000);
class RemindTask extends TimerTask {
public void run() {
System.out.println("Time's up!");
timer.cancel(); //Terminate the timer thread
public static void main(String args[]) {
System.out.println("About to schedule task.");
new Reminder(5);
System.out.println("Task scheduled.");
When you run the example, you first see this:
Task scheduled.
Five seconds later, you see this:
Time's up!
Chatrapathy -
Working fine with JAVA code and Error Occured while using in JSP
Hi.....
When initiating a BPEL process from JAVA the code is working fine and the Process is getting initiated.But while using that code in J2EE project as a java code and while calling that method Error is occuring.....
Here by i am attaching my JAVA Code which runs as an applicateion and package which runs in Server....
JAVA Code (Run as Application) Working Fine:
package bo;
import com.oracle.bpel.client.Locator;
import com.oracle.bpel.client.NormalizedMessage;
import com.oracle.bpel.client.delivery.IDeliveryService;
import java.util.Map;
import java.util.Properties;
import oracle.xml.parser.v2.XMLElement;
/*import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest ;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; */
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class processit {
public static void main(String args[]){
String input = "TATA";
String xmlInput= "<ns1:AccessDBBPELProcessRequest xmlns:ns1=\"http://xmlns.oracle.com/AccessDBBPEL\"><ns1:input>"+input+"</ns1:input></ns1:AccessDBBPELProcessRequest>";
String xml="<ns1:BPELProcess1ProcessRequest xmlns:ns1=\"http://xmlns.oracle.com/BPELProcess1\">";
xml=xml+"<ns1:input>"+input+"</ns1:input>";
xml=xml+"</ns1:BPELProcess1ProcessRequest>";
try{
Properties props=new Properties();
props.setProperty("orabpel.platform","ias_10g");
props.setProperty("java.naming.factory.initial","com.evermind.server.rmi.RMIInitialContextFactory");
props.setProperty("java.naming.provider.url","opmn:ormi://157.227.132.226:6003:home/orabpel");
props.setProperty("java.naming.security.principal","oc4jadmin");
props.setProperty("java.naming.security.credentials","oc4jadmin");
props.setProperty("dedicated.rmicontext", "true");
Locator locator = new Locator("default", "bpel", props);
System.out.println("After creating the locator object......");
IDeliveryService deliveryService =(IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME);
System.out.println("Before creating the NormalizedMessage object......");
NormalizedMessage nm = new NormalizedMessage();
System.out.println("After creating the NormalizedMessage object.*.*.*...");
nm.addPart("payload", xml);
System.out.println("Before creating response object......");
NormalizedMessage res = deliveryService.request("BPELProcess1", "process", nm);
System.out.println("After calling the BPELProcess1 .*.*.*...");
Map payload = res.getPayload();
System.out.println("BPEL called");
XMLElement xmlEl=(oracle.xml.parser.v2.XMLElement)payload.get("payload");
String replyText=xmlEl.getText();
System.out.println("Reply from BPEL Process>>>>>>>>>>>>> "+replyText);
catch (Exception e) {
System.out.println("Exception : "+e);
e.printStackTrace();
JSP and Java Method Used:
JSP Code:
===============
<%@ page import=" bo.callbpel" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>FEATT - I30</title>
</head>
<body>
<%
String input=request.getParameter("dnvalue");
callbpel p=new callbpel();
String Output=p.Initiate(input);
out.print("The Input Given to the BPEL Process is : "+input);
%>
<BR><BR><BR><BR><BR><BR>
<%
out.print("The Reply from BPEL Process is : "+Output);
%>
</body>
</html>
Java Code:
package bo;
import com.oracle.bpel.client.Locator;
import com.oracle.bpel.client.NormalizedMessage;
import com.oracle.bpel.client.delivery.IDeliveryService;
import java.util.Map;
import java.util.Properties;
import oracle.xml.parser.v2.XMLElement;
/*import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest ;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; */
//import java.util.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class callbpel {
public String Initiate(String value){
String replyText=null;
String input = value;
System.out.println(input);
String xmlInput= "<ns1:AccessDBBPELProcessRequest xmlns:ns1=\"http://xmlns.oracle.com/AccessDBBPEL\"><ns1:input>"+input+"</ns1:input></ns1:AccessDBBPELProcessRequest>";
String xml="<ns1:BPELProcess1ProcessRequest xmlns:ns1=\"http://xmlns.oracle.com/BPELProcess1\">";
xml=xml+"<ns1:input>"+input+"</ns1:input>";
xml=xml+"</ns1:BPELProcess1ProcessRequest>";
try{
Properties props=new Properties();
props.setProperty("orabpel.platform","ias_10g");
props.setProperty("java.naming.factory.initial","com.evermind.server.rmi.RMIInitialContextFactory");
props.setProperty("java.naming.provider.url","opmn:ormi://157.227.132.226:6003:home/orabpel");
props.setProperty("java.naming.security.principal","oc4jadmin");
props.setProperty("java.naming.security.credentials","oc4jadmin");
props.setProperty("dedicated.rmicontext", "true");
Locator locator = new Locator("default", "bpel", props);
String uniqueBpelId = com.collaxa.cube.util.GUIDGenerator.generateGUID();
//System.out.println(uniqueBpelId);
//java.util.Map msgProps = new HashMap();
System.out.println("After creating the locator object......");
IDeliveryService deliveryService =(IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME);
System.out.println("Before creating the NormalizedMessage object......");
NormalizedMessage nm = new NormalizedMessage();
System.out.println("After creating the NormalizedMessage object.*.*.*...");
//msgProps.put("conversationId",uniqueBpelId);
//nm.setProperty("conversationId",uniqueBpelId);
nm.addPart("payload", xml);
System.out.println("Before creating response object......");
NormalizedMessage res = deliveryService.request("BPELProcess1", "process", nm);
System.out.println("After calling the BPELProcess1 .*.*.*...");
Map payload = res.getPayload();
System.out.println("BPEL called");
XMLElement xmlEl=(oracle.xml.parser.v2.XMLElement)payload.get("payload");
replyText=xmlEl.getText();
System.out.println("Reply from BPEL Process>>>>>>>>>>>>> "+replyText);
catch (Exception e) {
System.out.println("Exception : "+e);
e.printStackTrace();
return replyText;
While Creating and Object for the Class callbpel and Whilw Calling that Method
callbpel p=new callbpel();
String Output=p.Initiate(input);
Its throwing an Error:
Error Occured is:
After creating the locator object......
Before creating the NormalizedMessage object......
After creating the NormalizedMessage object.*.*.*...
Before creating response object......
Apr 24, 2008 9:12:00 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NoClassDefFoundError: javax/ejb/EJBException
at com.oracle.bpel.client.util.ExceptionUtils.handleServerException(ExceptionUtils.java:76)
at com.oracle.bpel.client.delivery.DeliveryService.getDeliveryBean(DeliveryService.java:254)
at com.oracle.bpel.client.delivery.DeliveryService.request(DeliveryService.java:83)
at com.oracle.bpel.client.delivery.DeliveryService.request(DeliveryService.java:53)
at bo.callbpel.Initiate(callbpel.java:55)
at org.apache.jsp.output_jsp._jspService(output_jsp.java:55)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)
For Running JSP i am Using Eclipse 3.2.0 and apache-tomcat-5.5.25
Please Provide me a Solution......
Thanks in Advance.....
Regards,
Suresh KA JSP is not the same as a Java application. A Java application has package statment, import statements, try/catch block, a JSP doesn't.
-
JNI Calling Java code when attaching to existing JVM
I've got an Active/X that runs within IE, and also makes JNI calls (via the Invocation API) to Java code. Running within IE means there's already a JVM around, so I attach to it using JNI_GetCreatedJavaVMs
This is fine. The problem is that I can't use the JNI findClass() to locate my Java classes, because I have no control over the classpath that the JVM is using to locate classes. The only solution I can think of so far is to either add my classes as part of the JVM, OR find out the classpath of the existing JVM (using System.getProperty("java.class.path") and copy my classes into that directory.
Both solutions look ugly - anyone know of a cleaner way ?
Mark.Toby, thanks for the reply.
You're welcome.
I notice from elsewhere on this forum, you're clearly a JNI expert.
I've been known to work with it a little from time to time. =)
My code has to work with JDK 1.1 so URLClassLoader is out. Writing my own classloader is fine, but how do I load it in the first place ? Is there something in JNI I've missed ?
Possibly. Using DefineClass() you can load a class into the virtual machine, given it's byte-code. Now here's the tricky part. First, write your ClassLoader. It will be easiest if it doesn't rely on any other classes other than what is core to the JRE. Once you compile that classloader, you then need to include the bytecode as a resource in your executable/dll. Then, at runtime, you can load that resource, and use DefineClass to class-load it. Once you've class-loaded it, you can use NewObject, GetMethodID, CallXXXMethod, etc... to do the other class loading you need to do.
Trust me, this really isn't as hard as it might sound.
God bless,
-Toby Reyelts
As always, I recommend you check out the free, open-source JNI toolkit, Jace, at http://jace.reyelts.com/jace.
Maybe you are looking for
-
PO price, tax & condition records at the time of GR
Hi All, I am creating a report for FI sanvat. I need in this report material doc no. rates, tax with condition records during GR & MIRO. If I pick this data direct form KONP & KONV based on PO it may be wrong because after GR PO price & condition r
-
Problem creating backend PO in ECC
Hi, I have already posted this question in the SRM Forum. We are using SRM 5.0. I am trying to create a backend PO. SRM defines the standard PO with a doc type as 'EC' and the same in ECC is defined as 'ZSTD'. This is getting created perfectly. Absol
-
I have a canon MX 7600 multifunction printer. Each time I print I get a dialog box asking for permission to allow connections to the printer. This box stays on my screen for a few seconds, if I don't click allow I get a communication error which the
-
Material block from Exteranl procurement
Hi friends, I have one requirement. I want to configure a material for which no exteranl procuement possible(I will not be able to create any purchase requisitions or Purchase orders). But at the same time I should be able to create
-
IBook G4 external HD on Windows
Hi, I hope someone here can help. I use my IBook as my main computer, but have a pc using Windows 7 as a backup. I keep a lot of pictures and music on an external HD connected to my iBook, but I am going to be sending it off soon to get its internal