Page 1 of 1

Accessing java class from DataStage

Posted: Mon Jan 07, 2013 12:09 pm
by techiexavier
Hi All,

I am working with Java client stage to invoke a java class file. I am just calling simple class file to print a message. My design is

Java client stage -> seq_file

I am not returning anything out of my java class. In the link to seq_file I am just having one filed but I am not passing through any data in it. Once this class invoked and I am able to print the string I will proceed to return data from the file and will load to seq file.

But I am getting below error and my job is getting aborted.

Java_Transformer_9,0: Error: java.lang.ClassCastException: Print_ds incompatible with com.ascentialsoftware.jds.InternalStage

Print_ds is my class name. I am not able to get proper input from sites. Please help he.

TIA.

Posted: Mon Jan 07, 2013 12:18 pm
by techiexavier
My Java code is:

Public class Print_ds
{
Public static void main(Stringp[] args)
{
System.out.println("Success");
}
}

Posted: Mon Jan 07, 2013 4:58 pm
by jwiles
Your class is not defined correctly. More specifically, it does not extend the Stage class, as described in documentation for the Java Pack.

Have you read the documentation regarding the Java Pack and Java Client Stages? It describes how to properly create your Java class and programs for use with DataStage and provides examples for source and target Client stages. Here's the link for IS 8.7: http://publib.boulder.ibm.com/infocente ... apack.html

Regards,

Posted: Mon Jan 07, 2013 7:01 pm
by lstsaur
Your class wouldn't even get compiled with "Stringp[]".

Posted: Mon Jan 07, 2013 11:29 pm
by jwiles
Good catch! I missed that little typo...might need some new glasses :(

Regards,

Posted: Tue Jan 08, 2013 4:37 am
by techiexavier
Thanks for the inputs.

Stringp is typo error.. Will check the docs and will update the result.