trafodion-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Liu, Ming (Ming)" <>
Subject 答复: TMUDF questions, jar dependencies
Date Sun, 01 May 2016 13:45:39 GMT
Thanks Kevin,

I tried the two ways, but both meet problems. I think there are some basic misunderstanding.
So I do need a step-by-step instructions about how to do this.

First try:
 Step 1: Use 'jar xvf' to extract all depended jars into a single folder: solr  (for example)
 Step 2: Then compile the UDR source java file: javac, this will generate a solrUDR.class.
I copy this into the solr folder created above
 Step 3: cd into 'solr'
       Run 'jar cvf solrUDR.jar *'
It does generate a solrUDR.jar file, but at runtime, it still report 'class not found'. I
think jar file contains a MANIFEST.MF file, which now only contains the last one when I do
'jar xvf' in the first step. So I still cannot make it work. Not sure what should be the correct
way to do this?

Then I switch to Maven approach, I use Eclipse this time, create a Maven project, add dependencies
and make a build, but still cannot get what I want to get. There must be something very basic
wrong, but for a java newbie, that is a mountain to climb to understand what goes wrong...
So a real working example will really help me...

Here is the pom.xml I created:

<project xmlns="" xmlns:xsi=""





And 'mvn package' will generate a jar file. But as I run 'jar tf' against it, it still not
package all dependencies into the final jar file. I don't know which part of pom.xml will
tell the Maven to put all dependencies into the final jar?

# jar tf solrudf-0.0.1-SNAPSHOT.jar


发件人: Xu, Kai-Hua (Kevin) [] 
发送时间: 2016年5月1日 20:40
抄送: Hans Zeller <>
主题: RE: TMUDF questions, jar dependencies

There is a simple way if you don't have too many JARs. A JAR is a zip file. Unzip them and
put them together, then pack them into one JAR. Another way is to use Maven plugin( just put
serveral lines into pom.xml), and run "mvn package". 

Best Regards,
Kevin Xu

-----Original Message-----
From: Liu, Ming (Ming) [] 
Sent: 2016年5月1日 19:00
Cc: Hans Zeller <>
Subject: TMUDF questions, jar dependencies

Hi, all,

I was trying to write a sample TMUDF, which is using java. The UDF java code invoke some functions
provided by other jars. At runtime, I got 'classNotFound' issue. The function required by
the sample needs many depended jars, I still cannot find a way to correct put them in a single
jar. I am not good at java. If that is required, can anyone kindly give me some real examples?
I searched for many days 'how to put multiple jar into one jar' but cannot find a real useful
guide yet.

And what is a typical way to use TMUDF which has some jar dependencies?

I think in the Kafka UDF example, ,one should add jars
for Kafka as well, how did you do that?


View raw message