ftp action no longer pulling file across to server after migration

0
Hi, we have a java action that that sends across a modeler generated xml file as an invoice from an app in custom cloud onto the customer own server to be used in the accounting package. We have implemented this in v2551 and has been working great with no faults. We have now migrated to v333 and we don't seem to get the file pulled across anymore. We get no exceptions, file is still correctly generated, just never gets to the other side. Server credentials are still the same. Not sure if we need to update any jar?! I've updated the commons-net jar just in case, but that didn't seem to make any difference. We use a couple of other actions that use IPP (internet print protocol) and that still works great. Docs are sent directly to customer print server. Not sure what would be the issue with ftp, especially when there are no errors outputted. here is the java: // This file was generated by Mendix Business Modeler 3.0. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list // - the code between BEGIN USER CODE and END USER CODE // - the code between BEGIN EXTRA CODE and END EXTRA CODE // Other code you write will be lost the next time you deploy the project. // Special characters, e.g., é, ö, à, etc. are supported in comments. package services.actions; import java.io.IOException; import java.io.InputStream; import org.apache.commons.net.ftp.FTP; import org.apache.commons.net.ftp.FTPClient; import com.mendix.core.Core; import com.mendix.m2ee.log.ILogNode; import com.mendix.systemwideinterfaces.core.IMendixObject; import com.mendix.systemwideinterfaces.core.UserAction; /** * uploads fileDocument to FF ftp server */ public class FTPUploadFile extends UserAction<boolean> { private String FTPAddress; private String Username; private String Password; private IMendixObject __FileDoc; private system.proxies.FileDocument FileDoc; public FTPUploadFile(String FTPAddress, String Username, String Password, IMendixObject FileDoc) { super(); this.FTPAddress = FTPAddress; this.Username = Username; this.Password = Password; this.__FileDoc = FileDoc; } @Override public Boolean executeAction() throws Exception { this.FileDoc = __FileDoc == null ? null : system.proxies.FileDocument.initialize(this.getContext(), __FileDoc); // BEGIN USER CODE if (this.FileDoc == null) { throw new IllegalArgumentException("File Document object cannot be empty"); } FTPClient client = new FTPClient(); InputStream is = null; String remote = null; try { client.connect(this.FTPAddress); client.login(this.Username, this.Password); //######### move the following line onto a param passed on from the modeler #####// //remote = "//ProgramData//Sage//InvoicesIn//" + this.FileDoc.getName() + ".xml"; remote = "//Users//streamgroup//Printing//" + this.FileDoc.getName() + ".xml"; info("About to ftp the file to: " + remote); is = Core.getFileDocumentContent(this.getContext(), this.FileDoc.getMendixObject()); info("MendixObj: " + is); client.setFileType(FTP.BINARY_FILE_TYPE); client.enterLocalPassiveMode(); client.storeFile(remote, is); client.logout(); return true; } catch (IOException e) { e.printStackTrace(); return false; } finally { try { if (is != null) { is.close(); } client.disconnect(); } catch (IOException e) { e.printStackTrace(); } } // END USER CODE } /** * Returns a string representation of this action */ @Override public String toString() { return "FTPUploadFile"; } // BEGIN EXTRA CODE private ILogNode logger = Core.getLogger("FTPDocument"); private void info(Object obj) { logger.info(obj != null ? obj.toString() : ""); } // END EXTRA CODE }
asked
2 answers
1
} catch (IOException e) {
    e.printStackTrace();
    return false;
}

That just ignores all your exception and you will never be able to see them. Just remove the catch so that you can actually see if there is an exception thrown. (most probably: yes)

answered
0
An unhandled error occurred in the MxRuntime.

java.lang.NoClassDefFoundError: services/proxies/File at services.actions.FTPUploadFile.executeAction(FTPUploadFile.java:44) at services.actions.FTPUploadFile.executeAction(FTPUploadFile.java:24) at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:48) at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:435) at hk.b(SourceFile:156) at com.mendix.core.Core.execute(SourceFile:212) at lo.a(SourceFile:70) at mA.a(SourceFile:73) at mz.executeAction(SourceFile:101) at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:48) at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:435) at hk.b(SourceFile:156) at com.mendix.core.Core.executeSync(SourceFile:189) at lp.a(SourceFile:71) at mA.a(SourceFile:73) at mz.executeAction(SourceFile:101) at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:48) at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:435) at hk.b(SourceFile:156) at com.mendix.core.Core.execute(SourceFile:212) at gd.execute(SourceFile:184) at iI.a(SourceFile:311) at iI.a(SourceFile:240) at iI.processRequest(SourceFile:179) at iL.a(SourceFile:71) at com.mendix.core.MxRuntime.processRequest(SourceFile:857) at com.mendix.m2ee.server.handler.RuntimeHandler.handle(RuntimeHandler.java:43) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111) at org.eclipse.jetty.server.Server.handle(Server.java:351) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454) at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:900) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:954) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:857) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534) at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.ClassNotFoundException: services.proxies.File at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at services.actions.FTPUploadFile.executeAction(FTPUploadFile.java:44) at services.actions.FTPUploadFile.executeAction(FTPUploadFile.java:24) at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:48) at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:435) at hk.b(SourceFile:156) at com.mendix.core.Core.execute(SourceFile:212) at lo.a(SourceFile:70) at mA.a(SourceFile:73) at mz.executeAction(SourceFile:101) at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:48) at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:435) at hk.b(SourceFile:156) at com.mendix.core.Core.executeSync(SourceFile:189) at lp.a(SourceFile:71) at mA.a(SourceFile:73) at mz.executeAction(SourceFile:101) at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:48) at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:435) at hk.b(SourceFile:156) at com.mendix.core.Core.execute(SourceFile:212) at gd.execute(SourceFile:184) at iI.a(SourceFile:311) at iI.a(SourceFile:240) at iI.processRequest(SourceFile:179) at iL.a(SourceFile:71) at com.mendix.core.MxRuntime.processRequest(SourceFile:857) at com.mendix.m2ee.server.handler.RuntimeHandler.handle(RuntimeHandler.java:43) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111) at org.eclipse.jetty.server.Server.handle(Server.java:351) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454) at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:900) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:954) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:857) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534) at java.lang.Thread.run(Thread.java:662)

answered