Hi all I have upgraded Mendix from 9.24 to 10.18. I have been updating modules and I am getting this error when launching. Community commons will not be updated as the version I am v10.2.0 was the same for version 9, and I would need to move to 10.21 of mendix to update to the next CC version. I have reinstalled Community Commons to ensure it's up to date and not modified. My initial thought was userlib folder, and I have checked for duplicates and also ran the userlib cleaner. The cleaner only removes one .jar which ends up breaking the email connector module and does not seen to be related to community common. Either way I get the community commons error. C:\Users\username\Mendix\appname\javasource\communitycommons\Misc.java:677: error: incompatible types: try-with-resources not applicable to variable type try (Overlay overlay = new Overlay()) { ^ (Overlay cannot be converted to AutoCloseable)Note: Some input files use or override a deprecated API.Note: Recompile with -Xlint:deprecation for details.Note: Some input files use unchecked or unsafe operations.Note: Recompile with -Xlint:unchecked for details.1 error FAILURE: Build failed with an exception. * What went wrong:Execution failed for task ':compile'.> Compilation failed; see the compiler error output for details. * Try:> Run with --scan to get full insights. BUILD FAILED in 15s The line referenced in the error is in this code snippet, try (Overlay overlay = new Overlay()) { public static boolean overlayPdf(IContext context, IMendixObject generatedDocumentMendixObject, IMendixObject overlayMendixObject, boolean onTopOfContent) throws IOException { Logging.trace(LOGNODE, "Retrieve generated document"); try ( PDDocument inputDoc = PDDocument.load(Core.getFileDocumentContent(context, generatedDocumentMendixObject)); PDDocument overlayDoc = PDDocument.load(Core.getFileDocumentContent(context, overlayMendixObject)); ByteArrayOutputStream baos = new ByteArrayOutputStream()) { Logging.trace(LOGNODE, "Overlay PDF start, retrieve overlay PDF"); Logging.trace(LOGNODE, "Perform overlay"); try (Overlay overlay = new Overlay()) { overlay.setInputPDF(inputDoc); overlay.setDefaultOverlayPDF(overlayDoc); if (onTopOfContent) { overlay.setOverlayPosition(Overlay.Position.FOREGROUND); } else { overlay.setOverlayPosition(Overlay.Position.BACKGROUND); } Logging.trace(LOGNODE, "Save result in output stream"); overlay.overlay(new HashMap<>()).save(baos); } Logging.trace(LOGNODE, "Duplicate result in input stream"); try (InputStream overlayedContent = new ByteArrayInputStream(baos.toByteArray())) { Logging.trace(LOGNODE, "Store result in original document"); Core.storeFileDocumentContent(context, generatedDocumentMendixObject, overlayedContent); } } Logging.trace(LOGNODE, "Overlay PDF end"); return true; }
asked
Garion Swann
1 answers
1
That looks like you may have two versions of pdfbox.jar in your application. There shouldn't be one in userlib, just one in vendorlib. Do you happen to have one in both locations?