It is currently 24 Apr 2019 9:57


Post new topic  Reply to topic  [ 5 posts ] 
Author Message
PostPosted: 04 May 2007 5:16 
Hi

I have configured Control-M BPI suite 6.3.01 and java server is Tomcat.
We are able to trigger the jobs in tomcat server.
Always jobs return with success .

Looks like Control-M is getting OSCOMPSTAT as 0 always...

I am calling a simple method which returns 1 when exception occurs.
for me it is failure, but control-M completed job with Ok status..

Any one using control-M for java , please help me...


Top
   
PostPosted: 16 May 2007 3:19 
Offline
Nouveau
Nouveau
User avatar

Joined: 16 May 2007 12:00
Posts: 3
Location: Israel
Simple answer: Java class Control-M jobs fail if an exception was thrown.

A java type batch job (POJO) means running any method inside a java class.

The method can return any type of a parameter like more primitive types: int, char, strings, etc... or it can also return a complex class like date, employee, myClass,...
If a complex class is part of the Java account classpath, and it has a toString method, than toString will be in the sysout.

Q how does a Java job succeed?
A: If the method returned the return parameter, than the Job will succeed (the job will appear in Green color)


So in your case you have a method that returns an integer number. Any number is valid, and the job will succeed.

Q: How does a java job fail?
A: if an exception is thrown.


So if you want to indicate Control-M that the job failed, throw an exception instead of returning a value.
The exception will appear in the sysout.


Another alternative to throwing an exception is to do post processing to the sysout. So if you know that if you see in the sysout that the job returned 1 and it means failure, you can do post processing, and mark the job as failed.


Top
   
 Post subject:
PostPosted: 21 May 2007 4:05 
Thanks dkadosh! for your valuable suggestions...

I have tested successfully exception/postprocessing method.


Top
   
PostPosted: 05 Feb 2019 8:04 
Offline
Nouveau
Nouveau

Joined: 05 Feb 2019 8:01
Posts: 1
control-M for Web Services ,Java and Messaging (WJM, formerly BPI) allows Control-M to run Java applications.

Simply returning the code (0 or 1 or whatever) is not enough to determine whether the job actually fails or succeeds:

1Java methods can return any type of value which can have any meaning the developer wants. Best practice for Java programming is to use Exception handling if there is a failure. For more information, please refer to following link:

2. The Control-M Java CM (the caller) is a generic invoker and it does not know the meaning of the returned value from Java methods. So long as the invokation of the Java method was successful and there was no Exception thrown, then the CM will assume the job is OK.

If you would like Control-M to declare that the invokation should return NOTOK if the actual Java application fails, then you can do any of the followings:

a) Have your method returns a string, such as "Invokation failed". Then, add ON STMT processing to the CM job definition to declare job as NOTOK when encountering the "Invokation failed" statement.

b) Have your Java method thrown an Exception if it fails.

c) Place the method logic in the main() function with a call to System.exit(1) and set the CM job definition to invoke the main() method instead.
https://crbtech.in/java-training/top-ja ... nt-in-pune

_________________
I am java developer by profession


Top
   
PostPosted: 08 Mar 2019 12:12 
Offline
Nouveau
Nouveau

Joined: 08 Mar 2019 12:06
Posts: 2
Excellent answer by dkadosh. Thank you as I was searching the answer for the same question. Great help!!!

_________________
java online training


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 5 posts ] 

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited
The site created by Franck YOT. Images, logo, content and trademarks about Control-M products are property of BMC Software.
All the comments are property of their posters. Images, logo, content and design are © copyright by Scheduler-Usage.com. All Rights Reserved