Compile Java error after downloading e-mail template module.

2
Hi, I had a project on 5.13 and upgraded it to 5.14. Upgrade was successful. After upgrade, I downloaded the e-mail module (5.14 version) from the Appstore but I get the following compile Java error. I have also downloaded the encryption module with 5.14 so I don't know what the reason is. How can I fix this? Buildfile: C:\Users\maria.m.dourouka\Documents\Planning solution-main\deployment\build_core.xml compile: [javac] Compiling 13 source files to C:\Users\maria.m.dourouka\Documents\Planning solution-main\deployment\run\bin [javac] C:\Users\maria.m.dourouka\Documents\Planning solution-main\javasource\emailtemplate\actions\SendEmail.java:130: error: cannot find symbol [javac] throw new CoreException("Unable to convert the Html body to plain text for email: " + this.Subject + " to: " + this.ToAddresses, e); [javac] ^ [javac] symbol: variable Subject [javac] C:\Users\maria.m.dourouka\Documents\Planning solution-main\javasource\emailtemplate\actions\SendEmail.java:133: error: cannot find symbol [javac] EmailModule.mail(config, this.HtmlBody, this.PlainBody, this.Subject, toList, ccList, bccList, this.getContext(), this.__AttachmentList); [javac] ^ [javac] symbol: variable Subject [javac] Note: C:\Users\maria.m.dourouka\Documents\Planning solution-main\javasource\com\mendix\core\Core.java uses or overrides a deprecated API. [javac] Note: Recompile with -Xlint:deprecation for details. [javac] Note: C:\Users\maria.m.dourouka\Documents\Planning solution-main\javasource\com\mendix\core\Core.java uses unchecked or unsafe operations. [javac] Note: Recompile with -Xlint:unchecked for details. [javac] 2 errors BUILD FAILED C:\Users\maria.m.dourouka\Documents\Planning solution-main\deployment\build_core.xml:27: Compile failed; see the compiler error output for details. Total time: 2 seconds
asked
3 answers
7

Maria, Do you have an entity called 'Subject'? The modeler has a habit of renaming input parameters if there is an entity with the exact same name.

When people import the email template module all works fine, but as soon as I create an entity with the exact same name as the input parameter of the java action it will rename part of the Java, and create compile errors.
The action you are working on has the parameter Subject, CC, BCC, etc... Those are what the Java code is expecting. When I create a new entity with the name: 'Subject', or an entity with the name 'BCC', the modeler will go into the Java action and in the Java do a partial rename, 'Subject' becomes 'SubjectParameter', 'BCC' becomes 'BCCParameter'.

Obviously the appstore team cannot cover all cases, ultimately no matter which names are used in the module, the problem remains. If you have an entity with the same name a rename occurs.

What is probably best now is to open the Java action in a text editor, and on all the places where it uses this.Subject replace it by this.SubjectParameter

In your action on line 55 you can see the exact name the modeler gave to the parameter.
On line 130 and 133 Subject is being used, replace this.Subject by this.SubjectParameter.

After replacing those 2 words in your action, it should resolve your issue.

answered
0

there are 2 modules dependency need to import for email template

1- CommonCommunity

2- Reflection

 

then you have to refresh all object module with reflection

 

hope this help

 

answered
-1

The compile error doesn't make much sense and I was unable to reproduce this scenario by importing mx model reflection (the previous version), encryption and the email module with templates into a new project, I don't have an explanation for this. Can you reproduce this in the same way as I did with a clean project?

answered