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.