Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Talend Cloud AWS EU Scheduled Outage: Starting Tues 26 May 21:00 CEST with expected completion Wed 27 May 01:00 CEST
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Import Jar in Component

Hello,

 

I am writing a component for TOS 6.4.1 in which I want to use ARX Anonymasiation (http://arx.deidentifier.org/). I downloaded the jar from the homepage and importet it to my component (see the XML) and added it to the Java Build Path in TOS.

 <IMPORTS> 
      <IMPORT MODULE="libarx-3.6.0.jar" NAME="libarx" REQUIRED="true"/> 
    </IMPORTS> 

Now I want to use one of the classes.

In the _begin.javajet file I write

imports="
		org.talend.core.model.process.INode 
		org.talend.core.model.process.ElementParameterParser 
		org.talend.core.model.metadata.IMetadataTable 
		org.talend.core.model.metadata.IMetadataColumn 
		org.talend.core.model.process.IConnection
		org.talend.core.model.process.IConnectionCategory
		org.talend.designer.codegen.config.CodeGeneratorArgument
		org.talend.core.model.metadata.types.JavaTypesManager
		org.talend.core.model.metadata.types.JavaType
		java.util.List 
		java.util.Map
		org.deidentifier.arx.ARXAnonymizer
	" 
%>
<% 
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();

 	
org.deidentifier.arx.ARXAnonymizer anonymizer = new org.deidentifier.arx.ARXAnonymizer.ARXAnonymizer();
%>

but I keep getting an error message "The import org.deidentifier cannot be resolved".

 

Thanks for your help.

Labels (1)
21 Replies
Anonymous
Not applicable
Author

Can you upload your component XML file please?
Anonymous
Not applicable
Author

Sure.

 

Greetings,

Miri


ARXforTOS_java.xml
Anonymous
Not applicable
Author

You can try changing custom component location.
Alternatively, you can use tLibraryLoad component to load libarx jar explictly in your talend job.
Anonymous
Not applicable
Author

I already tried more than one location for the as as well as the whole component.

 

The import with the tLibraryLoad only works if I write my code in tJavaFlex. But the import of the jar for the component doesn't seem to work. Furthermore I cannot connect tLibraryLoad with my component.

I also think that this is not the best solution: I want to offer the functionality of arx within this component. When the user has to load the Jar in an external component he doesn't need the extra component any more..

 

Greetings,

Miri

Anonymous
Not applicable
Author

I agree, this is not the solution.
What i meant is,you can test the new component using tLibraryLoad. (I am sure jar would be available to new component).

The probable reason for your error is , not the latest XML for your component is being compiled by studio. In which case , you should try by changing your custom component location and workspace.
Anonymous
Not applicable
Author

Even when I use tLibraryLoad I get the error message. My Job looks like that

0683p000009Lr7Y.png

(File Input is a simple example csv for the analysis) 

 

I copied the component to a different direction and changed the component path of TOS to this folder but that doesn't help either.

 

Could there be a mistake in the import in the javajet?

 

Anonymous
Not applicable
Author

Remove org.deidentifier.arx from import section in javajet.
I guess import section is for library already packaged with jet engine.

Hope that helps !
Anonymous
Not applicable
Author

It doesn't help.

The line 

org.deidentifier.arx.ARXAnonymizer anonymizer = new org.deidentifier.arx.ARXAnonymizer();

gives 2 errors: 2 times "org.deidentifier cannot be resolved to a type"

Anonymous
Not applicable
Author

Did you use tLibraryLoad this time?
Anonymous
Not applicable
Author

It is the same job as the Screenshot you can see, so yes