Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
SDHON
Contributor III
Contributor III

Talend 7 compile errors - The constructor Date is undefined - There may be some other errors caused by JVM compatibility. Make sure your JVM setup is similar to the studio.

Hello,

I am migrating my Talend jobs version 5-java 7 to Talend 7-java 11. Installed JRE is correctly configured on java11.

Til now I had no issues, only some missing jars here and there which were solved rapidly and the jobs work correctly just as version 5.

Except for this 1 job. This job uses same configurations and setting as all previous successfully migrated jobs which is why I am unable to understand what is the problem.

On TOS 5 the same job is OK, but on TOS 7, the identical job has compilation issues.

The build shows this error :

0695b00000LwOHBAA3.png 

The java code on TOS 5 shows a difference on this part too. On TOS 5 the codes generated are exactly as I wrote in my expression builder. But on TOS 7, it is generating the codes and adding some more to it (see parts hightlighted in purple)

0695b00000LwOHzAAN.png 

Grateful if someone could bring some light and help me solve this issue 🤞. The migration task is almost halfway, I hope this is solved to not jeopardize the whole project undertaken til now

Many thanks.

Labels (2)
7 Replies
Anonymous
Not applicable

Hello,

 

There were many changes between versions 5.x and 7.x, especially with what operations were removed, changed, and added in. One suggestion we can make is to validate if the function that your team is trying to accomplish, is in the tMap for 7.3.1. Can you let us know what specifically is being done in the tMap itself?

SDHON
Contributor III
Contributor III
Author

Hello. Thank you rpooya for your assistance.

Yes indeed the issue is on a tMap on 7.3.1. If I remove the expression in the expression builder of the tMap, the job builds without issue.

For info: I am migrating the job (export from TOS 5 and import in TOS 7) as it is.

 

The tMap does this :

left join a table with links on keys (3 fields); one field DATE type contains the expression (in red below) to derive the correct date used as join key and col4 is used as output after this. The 2nd snapshot shows the full expression.

0695b00000LwYf3AAF.pngcompareDate (date1-1M, currentDate) if > 0 then (1st of currentDate-1M) else (1st of date1-1M)

0695b00000LwYLwAAN.pngAll concerning fields linked are of type DATE

Individually when tested with getCurrentDate on the expression builder, all the above works fine. The expressions evaluate to correct values, but strangely when using syntax ? : on DATE type, it seems problematic on TOS7. If am not mistaken, the syntax for TOS 7 is same right? condition?value if true:value if false

If you need any other info please let me know.

Many thanks for your help.

 

Anonymous
Not applicable

I can confirm you can still use the expression condition?value if true:value if false, have a try to remove the expression which is migrated from v5, and re-write it again on v7.

if you still have issue, can you please paste the expression in the post? I will test it on my sdie.

SDHON
Contributor III
Contributor III
Author

Thank you shong.

I have tried everything to rewrite in vain. When I do not include a condition in the expression there is no issue. e.g ony TalendDate.getCurrentDate() all is fine.

As soon as I include ? and :, the code generates the part in purple shown above and is in error - as if it genereates additional condition on my existig expression.

 

TalendDate.compareDate(

TalendDate.addDate(row16.BOM_Value_Date,-1,"MM"), TalendDate.getCurrentDate()) > 0 ?

TalendDate.parseDate("yyyy-MM-dd",TalendDate.formatDate("yyyy-MM", TalendDate.addDate(TalendDate.getCurrentDate(),-1,"MM"))+"-01")

:

TalendDate.parseDate("yyyy-MM-dd",TalendDate.formatDate("yyyy-MM", TalendDate.addDate(row16.BOM_Value_Date,-1,"MM"))+"-01")

Anonymous
Not applicable

@S DHON​ i use your expression and make a testing, it works in version 7.3.1, btw, I have JDK11 installation on my machine.

 

0695b00000LwkxsAAB.png0695b00000LwkxnAAB.pngIt seems you need to recreate this job in version 7.3.1.

 

Regards

Shong

 

 

 

SDHON
Contributor III
Contributor III
Author

Thank you shong - i have openjdk version "11.0.9.1" 2020-11-04 LTS installed on my machine.

i will re-create this job and see if it works. many thanks

SDHON
Contributor III
Contributor III
Author

Hello,

 

Thank you for your assistance.

I had to rework the job - not on the expression itself but on where it was located on my job.

It seems that on the tMap, IN shema (table1) join (table2) cannot be made from derived expression with if else directly.

I had to use the same expression in a previous tMap on my OUT shema to derive the expression value in a new column. Then on my current IN shema (table 1), use the new column (from new tMap on table1) to join my (table2).

Then the job works properly.0695b00000OA1paAAD.jpgHope it can help others.

Thank you!

Regards,

SDHON