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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Integer Context Variable causing generate error in tMongoDBConnection

Hello,
I am using an integer context variable to specify the connect port to a MongoDB database, which is different for DEV and PROD and other environments. This is in the tMongoDBConnection
However, whenever I define the context variable for PORT in the component section, I get a generate failed message like below:
Execution failed : Failed to generate code.
[org.eclipse.emf.codegen.jet.JETException: InvocationTargetException in ....
The following is captured in the logs...
Caused by: org.eclipse.emf.codegen.jet.JETException: InvocationTargetException
at org.eclipse.emf.codegen.jet.JETEmitter.generate(JETEmitter.java:475)
at org.eclipse.emf.codegen.jet.JETEmitter.generate(JETEmitter.java:447)
at org.eclipse.emf.codegen.jet.JETEmitter.generate(JETEmitter.java:438)
at org.talend.designer.codegen.proxy.JetProxy.generate(JetProxy.java:54)
at org.talend.designer.codegen.CodeGenerator.generateComponentCode(CodeGenerator.java:928)
... 44 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.emf.codegen.jet.JETEmitter.generate(JETEmitter.java:467)
... 48 more
Caused by: java.lang.NumberFormatException: For input string: "context.target_port"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.<init>(Unknown Source)
at org.talend.designer.codegen.translators.nosql.mongodb.TMongoDBConnectionBeginJava.generate(TMongoDBConnectionBeginJava.java:62)
I entered a numeric value in the Port field of the connection so I can get the code generated. Here is the image from the code.
0683p000009MEnD.jpg 0683p000009MEnI.jpg 0683p000009MEYF.jpg
Labels (3)
3 Replies
Anonymous
Not applicable
Author

Have you tried defining it as a String rather than an int?
Anonymous
Not applicable
Author

Yes, I had tried defining the variable as a string as well but getting the same issue.
Note that the port number expects a numeric value.
Anonymous
Not applicable
Author

Hi,
Execution failed : Failed to generate code.
[org.eclipse.emf.codegen.jet.JETException: InvocationTargetException in ....

Could you use other talend version to see if this issue repro? Or restart your studio..
Best regards
Sabrina