Java Transformer problem with external jar

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
xjonny
Participant
Posts: 16
Joined: Tue Oct 03, 2006 2:06 am

Java Transformer problem with external jar

Post by xjonny »

Hello, all!
I have a problem with DS Java Transformer. I am not a novice in DS... Moreover, I'm using lots of Java Transformers... But now I need to include 3-rd party jars (actually, 5 - for dictionary fuzzy search).

I've failed... DS cannot find jar on classpath. I have tried to unpack jars to the same directory with my classes and it could... But I would rather use jars - in order to be able to update versions... And I do not want to have a fight with DB2's JDBC driver (2 of these jars) as it uses license saved in the second jar.

Briefly: how can I make DS see external jars?
I've tried: to put jars to classpath (I mean the one you can adjust in DS Designer), to put jars to DS's jre folder. Does not work.
Works but not that good: unpack jars to the same directory with classes.

If necessary: I use RHEL AS 4.0, DS 8.0.1. Need to use: Spring, DBCP, DB2 JDBC and "one-cool-secret-lib". Yes, it was me who installed the server. Yes, I have adjusted all necessary environment variables (and kernel params too)... ;)

Thank you in advance. Really in a hurry...
IT happens...
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

We don't do "urgent".

If you want it bad, you get it bad.

DSXchange is an all-volunteer site whose members post as and when they can, if they have something to say. If you need urgent advice sign up with your support provider for priority service, and learn the true cost of "urgent".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
lstsaur
Participant
Posts: 1139
Joined: Thu Oct 21, 2004 9:59 pm

Post by lstsaur »

To make DS to see your external .jar files, you can go to Websphere App. Server-->Resources to create your own JDBC Provider or from Environment-->Shared Libraries to add your .jar files in the classpath of the newly created Shared Libraries.
xjonny
Participant
Posts: 16
Joined: Tue Oct 03, 2006 2:06 am

Post by xjonny »

lstsaur wrote:To make DS to see your external .jar files, you can go to Websphere App. Server-->Resources to create your own JDBC Provider or from Environment-->Shared Libraries to add your .jar files in the classpath of the newly created Shared Libraries.
Thank you very much for the reply!!!
I've tried this way (through environment), but my job still aborts with "Java_Transformer_3,0: Error: java.lang.NoClassDefFoundError: org.springframework.core.io.Resource".

I am not sure java transformers start within WebSphere... Or (probably) I do not understand something...

Any ideas???

Thanks again.

PS Found the same problem description on IBM's site (in a forum) - unanswered question since 2005... :(
IT happens...
lstsaur
Participant
Posts: 1139
Joined: Thu Oct 21, 2004 9:59 pm

Post by lstsaur »

Did you reboot the Websphere App. Server after you created the new Shared Libraries? Did you populate your .jar files in the Class path of the Shared Libraries like /opt/IBM/WebSphere/AppServer/lib/db2jdbc.jar;/opt/IBM/WebSphere/AppServer/lib/spring.jar;.....
xjonny
Participant
Posts: 16
Joined: Tue Oct 03, 2006 2:06 am

Post by xjonny »

lstsaur wrote:Did you reboot the Websphere App. Server after you created the new Shared Libraries? Did you populate your .jar files in the Class path of the Shared Libraries like /opt/IBM/WebSphere/AppServer/lib/db2jdbc.jar;/opt/IBM/WebSphere/AppServer/lib/spring.jar;.....
Thanks for the reply!

Yes, I applied changes in configuration and rebooted...

I still cannot understand how WebSphere is associated with Java Transformer. But I've done everything as you told me...

Any other ideas???
IT happens...
lstsaur
Participant
Posts: 1139
Joined: Thu Oct 21, 2004 9:59 pm

Post by lstsaur »

No, Java Transformer stage is using tr4j.jar which is stored in the /dsengine/java/lib and it's associated with DS. However, since you want to use external .jar files, then you can utilize WebSphere App. Server, J2EE compliant server, Shared Library's class path for your application.

Please elaborate more detail on how you are using the Java Transfomer stage to call these external .jar files.
xjonny
Participant
Posts: 16
Joined: Tue Oct 03, 2006 2:06 am

Post by xjonny »

I use external classes in jars by including

Code: Select all

import org.springframework.*
...
into my code. ;)

Actually I've coped with described problem by unzipping all jars to my "classes" directory. (So, the project is no more in danger). I still suppose there is no connection between JavaPACK and WebSphere as they use different JRE-s.

Moreover, I've seen message in logs with "classpath=/opt/IBM.../tr4j.jar" when I tried to play with JRE parameters (in Designer client). This is why I believe JavaTransformer starts in another process and I cannot understand how WebSphere's Shared libraries can affect behaviour of JavaTransformer.

There is an idea how to add jar support to JavaTransformer... If I manage to write my own class loader, I'll post it here. ;)

Thank you very much. You really tried to teach me something new. :D
IT happens...
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

This is a very interesting problem.... I haven't had to do this myself, so haven't encountered it or had much to offer, but reading thru it tonite, it dawned on me that perhaps there could be something interesting going on with enterprise edition because everything (each stage/operator) is in its own process........ I wonder if you'd have this issue in a simple Server Job......in that case, the jvm is loaded into the (usually) single process of the job....... might not be the ultimate solution, but it might perhaps tell us something and be worth a quick test (the Java Transformer mostly looks and acts the same in a Server Job.)

Ernie
Ernie Ostic

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