[solved] import talend Routines in jet part to use own Utils

Six Stars

[solved] import talend Routines in jet part to use own Utils

Hello
i am trying the following:
i want to use the package routines to read metadata for GENERATING, not at runtime of the component
<%@ jet
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.core.model.process.EConnectionType
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
java.util.HashMap
java.util.Set
java.math.BigInteger
routines.DB
"
%>
And the result is:
Execution failed : Failed to generate code.

[----------

1. ERROR in E:\x163842\Workspace\.JETEmitters\src\org\talend\designer\codegen\translators\dataquality\TFileAidIMSQABeginJava.java (at line 18)

import routines.DB;

       ^^^^^^^^

The import routines cannot be resolved



How can i qualify the
package routines
that it will be found by the jetengine ????

Thanks for your help Smiley Happy
Community Manager

Re: [solved] import talend Routines in jet part to use own Utils

You will need to remove the semi colon after "routines.DB" and ensure that you have compiled your routines into a Jar and that the Jar is in the classpath of the component. 
Six Stars

Re: [solved] import talend Routines in jet part to use own Utils

thank you for the responds, i removed the ; already.
I think the jar in the componentfolder will help only in the case that i want to use it inside the component or not ?
regards
dj
Six Stars

Re: [solved] import talend Routines in jet part to use own Utils

i solved it by placing the routines Folder with the compiled classfiles into
C:\Program Files (x86)\Talend-Studio-V5.4.1\plugins\org.talend.designer.codegen_5.4.1.r111943\
Community Manager

Re: [solved] import talend Routines in jet part to use own Utils

That is pretty much what I was suggesting, however you will now have two routines folders/files to update. You will have the one which is available to your Studio for development and the one that is in your components classpath. It would be more logical to create the code that you want for your component, compile as a Jar and then package it with the component. 
Six Stars

Re: [solved] import talend Routines in jet part to use own Utils

I will try that, thank you
actually i am fighting with an
JETException: InvocationTargetException
running the code, which runs perfectly in my unittest. Might be still some config Problem Smiley Sad

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Downloads and Trials

Test drive Talend's enterprise products.

Downloads