Use of java client/ transformer stage

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
dsouza
Participant
Posts: 6
Joined: Fri Aug 02, 2013 4:30 am

Use of java client/ transformer stage

Post by dsouza »

Hi,

I am new to Java client stage. I am trying to run java program through datastage. My job looks like

Java stage-----> Sequential File stage

I have an employee.java program. It has details of employee like employee ID, name, designation, place.

I am trying to run .java class through datastage but getting error as javaclassnot found.exception

Please advise where should be .class file placed and also what should be the user's classpath in java client stage?

also any dsenv need to be set before runnning the job.

I am using Dstage 8.5

Thanks
lstsaur
Participant
Posts: 1139
Joined: Thu Oct 21, 2004 9:59 pm

Post by lstsaur »

Under User's Classpath of Java client stage, you need to put the .class path info. in the PATH.
dsouza
Participant
Posts: 6
Joined: Fri Aug 02, 2013 4:30 am

Post by dsouza »

I placed my .class file on c drive and gave path as
C:\Users\dsouza

and for transformer class name i gave
Employee (.class file)

But it's not working
lstsaur
Participant
Posts: 1139
Joined: Thu Oct 21, 2004 9:59 pm

Post by lstsaur »

"I have an employee.java program", so your .class file is employee not Employee.

Also I am assuming you know that you don't need to include the .class extension for the Transformer Class Name.
dsouza
Participant
Posts: 6
Joined: Fri Aug 02, 2013 4:30 am

Post by dsouza »

My .class file is Employee only (mistake in case for E) and i gave it correctly.

Also i have not included the .class extension for transformer Class Name.

And at user classpath I have given this path where i have placed my .class file

C:\Users\dsouza

Getting error as "java.lang.ClassNotFoundException: Employee"
dsouza
Participant
Posts: 6
Joined: Fri Aug 02, 2013 4:30 am

Post by dsouza »

Please help :(
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

There is a lot more to this than just the classpath....

First, have you coded your Employee.java along with the JavaPack API? DataStage works very closely with the java code that you write, invoking various pre-defined methods that you include in your code. In those methods you place your own logic along with the various API calls that allow you to interact with the DataStage engine.

Assuming you have done that, and included your local jars and also the JavaPack API jars and it has all compiled appropriately, then you can move to the next step which is trying to run it inside of your Job.

At that point, the classpath is typically dependent upon some of the specifics that are inside of your class, such as the Package. Java standards vary --- you will often find some very detailed Package names, and those Package names will often establish a real sub-directory hierarchy. For simple testing purposes I tend to have a single name package, such as "myStuff". Under those circumstances my Classpath goes as deep as "one level higher" than the subdirectory that matches my Package name.

...so that means on disk, myClass.class sits in a subdirectory called

c:\myBusiness\myStuff

...and then I include c:\myBusiness in my Classpath.

If you are not familiar with the details I noted above about the pre-defined classes and the API, you need to spend a lot of time with the documentation and the many examples that are identified in the forum and elsewhere.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Post Reply