No need for a java action, you can simply format the current date in the format you want directly in Mendix by using:
formatDateTime([%CurrentDateTime%],'yyyy-MM-dd')+'T'+formatDateTime([%CurrentDateTime%],'HH:mm:ss.000')
(Java allows you to insert letters into your formatted date string by enclosing them in single quotes, but since Mendix already uses single quotes for strings, that doesn't work. Therefore I have simply split it into two formatDateTime functions, not sure if there is a better way)
Pierre, what I think you have run into is a bug in the Mendix debugger where it will change strings that look like dates, and for some reason parse them and display them in a different format. I have seen this happening as well. If you change you Java code to something like
return "testString1678943436", does that show up in the debugger okay?
Also, please do not use variable names like 'd' or 'str'.