Core.storeFileDocumentContent() either takes 10 minutes or doesnt finish

0
Hi, I'm making a scheduled event that imports an excel file from an samba server. The following code is using the jcifs.jar to connect and retrieve the file from the samba server. Is there a way to double check the authentication to the samba server worked in the debug? Im using Eclipse photon. public class JA_GetSharedFile extends CustomJavaAction<IMendixObject> { private IMendixObject __XLSFileParameter1; private importutility.proxies.XLSFile XLSFileParameter1; private java.lang.String ImportDirectory; private java.lang.String FileExtension; public JA_GetSharedFile(IContext context, IMendixObject XLSFileParameter1, java.lang.String ImportDirectory, java.lang.String FileExtension) { super(context); this.__XLSFileParameter1 = XLSFileParameter1; this.ImportDirectory = ImportDirectory; this.FileExtension = FileExtension; } @Override public IMendixObject executeAction() throws Exception { this.XLSFileParameter1 = __XLSFileParameter1 == null ? null : importutility.proxies.XLSFile.initialize(getContext(), __XLSFileParameter1); // BEGIN USER CODE SharedFileGetter GetHer = new SharedFileGetter(); IContext context = this.getContext(); IMendixObject ScheduledFile = null; if (ImportDirectory == null) { ScheduledFile = GetHer.GetFileUnspecified(context, __XLSFileParameter1); } else { ScheduledFile = GetHer.GetFileFromDirectory(context, __XLSFileParameter1, ImportDirectory, FileExtension); } return ScheduledFile; // END USER CODE } /** * Returns a string representation of this action */ @Override public java.lang.String toString() { return "JA_GetSharedFile"; } // BEGIN EXTRA CODE private class SharedFileGetter { public IMendixObject GetFileFromDirectory(IContext context, IMendixObject XLSFile, String ImportDirectory, String FileExtension) throws IOException { String user = "user"; String pass = "pass"; String server = "smb://server/0412_Project_Request_Form_Master_Data_export-en-us.xlsx"; // Authenticate NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(null, user, pass); SmbFile dir = new SmbFile(server, auth); SmbFileInputStream in = new SmbFileInputStream(dir); Core.storeFileDocumentContent(context, XLSFile, in); in.close(); return XLSFile; } public IMendixObject GetFileUnspecified(IContext context, IMendixObject XLSFile) throws IOException { String user = "user"; String pass = "pass"; String server = "smb://server/0412_Project_Request_Form_Master_Data_export-en-us.xlsx"; // Authenticate SmbFile scheduledFile = null; NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("", user, pass); scheduledFile = new SmbFile(server, auth); InputStream in = scheduledFile.getInputStream(); Core.storeFileDocumentContent(context, XLSFile,"0412_Project_Request_Form_Master_Data_export-en-us", in); in.close(); return XLSFile; } } // END EXTRA CODE }  
asked
1 answers
1

When you start your app from eclipse in debug mode you can set breakpoints on your code to inspect everthing that is happening.

For more information on how to debug your java actions read the following how-to:

https://docs.mendix.com/howto/monitoring-troubleshooting/debug-java-actions

answered