"NULL Param" errors writing from tStatCatcher to parametric conn to DB

One Star

"NULL Param" errors writing from tStatCatcher to parametric conn to DB

Hello everybody.
I'm a newbie in talend world, looking for advice.


I'm trying to develop the following job:
- read database connection parameters from a cfg file and put them in context variables (LibContextReader, inspired by talendbyexample.com, page talend-reusable-context-load-job )
- define and test a connection to DB that uses the context variables
- do some input-output with the connected DB
- store in a DB table the stats from tStatCatcher

If I put the caught stats in a file or in a table through a non-parametric connection, it works, also if I leave the tStatCatcher as Starting Job, with no problem.


But if I try to put the stats in a table using a parametric connection or the existing connection (both of them use context variables), I get the "NULL parameter" kind of error from tMysqlOutput component.

I tried to start tStartCatcher after the reading of parameters and after the first test of the connection (rif Main_Job screenshot), but it doesn't help.
It seems to me that the iMysqlOutput component tries to resolve its connection parameters before they are available.
(The screenshot isn't the real job, I have left only the relevant components)


Trying to use the Existing connection (rif. screenshot) I get in the console:

"Exception in component tMysqlOutput_5
java.lang.NullPointerException
    at dwh_king.king_dwh_build_0_1.king_dwh_build.tStatCatcher_1Process(king_dwh_build.java:6519)
    at dwh_king.king_dwh_build_0_1.king_dwh_build.runJobInTOS(king_dwh_build.java:17766)
    at dwh_king.king_dwh_build_0_1.king_dwh_build.main(king_dwh_build.java:17477)"

and the component reaches the table (can create it) but doesn't write the stats into it, and the main job is labeled as failed.



Trying a direct parametric connection (rif. screenshot) I get in the console:

"Exception in component tMysqlOutput_3
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Cannot load connection class because of underlying exception:

'java.lang.NumberFormatException: For input string: "null"'.
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
    at com.mysql.jdbc.Util.getInstance(Util.java:384)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1013)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:973)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:918)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:353)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at dwh_king.king_dwh_build_0_1.king_dwh_build.tStatCatcher_1Process(king_dwh_build.java:6542)
    at dwh_king.king_dwh_build_0_1.king_dwh_build.runJobInTOS(king_dwh_build.java:17828)
    at dwh_king.king_dwh_build_0_1.king_dwh_build.main(king_dwh_build.java:17539)
Caused by: java.lang.NumberFormatException: For input string: "null"
    at java.lang.NumberFormatException.forInputString(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at com.mysql.jdbc.NonRegisteringDriver.port(NonRegisteringDriver.java:913)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:344)
    ... 5 more"

the main job is labeled as failed,
but the component reaches the table and writes the stats into it (exactly like the non-parametric, non-error component).

This second way seems to get the work done, but I would prefer understand and get rid of those error messages.

Thank for your help.

One Star

Re: "NULL Param" errors writing from tStatCatcher to parametric conn to DB

I uploaded the screenshots, but now i can't see them...
They appear if I click UPLOAD...
One Star

Re: "NULL Param" errors writing from tStatCatcher to parametric conn to DB

Adding these two messages (DEF UNABLE TO SHOW UPLOADED IMAGES), I can se that the error happens one single time, at the start of the main job (I don't now why and for which job), and then succeeds one time for each stats row (as wanted).
Checked again every component, the only ones having the "tStatCatcher Statistics" flag are after the definition of connection parameters.
It seems to me that there is a first, self-generated, too-early, trigger of tStatCatcher and/or tMysqlOutput that causes the error before of parameters reading.
Any way to manage this?

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 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog