- Troubleshooting
Lists the problematic JAR files and the known workarounds.
With Java actions, you can extend the functionality of your application in situations where it would be hard to implement this functionality in microflows.
For information about Java actions in Studio Pro, see Java Actions.
In .java files of your Java actions, the method executeAction
is called by the Mendix Runtime when the Java action is being executed. The method throws all exceptions that occur. This means you can do error handling in the microflow calling this Java action. If you would like to do your own error handling within the action, use try
/ catch
statements.
Between the lines // BEGIN USER CODE
and // END USER CODE
, you can write custom code that will always be called when executing the action. You can call other methods in the section between // BEGIN EXTRA CODE
and // END EXTRA CODE
.
Code outside the blocks is regenerated each time when you deploy your model, thus any modifications that you make in them will be overwritten. However, your imports will be preserved.
// This file was generated by Mendix Studio Pro.
//
// 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 app.
// Special characters, for example, é, ö, à, etc. are supported in comments.
package myfirstmodule.actions;
import com.mendix.systemwideinterfaces.core.IContext;
import com.mendix.webui.CustomJavaAction;
public class JavaAction_1 extends CustomJavaAction<java.lang.Void>
{
public JavaAction_1(IContext context)
{
super(context);
}
@java.lang.Override
public java.lang.Void executeAction() throws Exception
{
// BEGIN USER CODE
return true;
// END USER CODE
}
/**
* Returns a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
{
return "JavaAction_1";
}
// BEGIN EXTRA CODE
// END EXTRA CODE
}
You can use the Mendix Java library in the Java code that you write for your Java actions.
This library is automatically added to your libraries when you import your app into Eclipse, it is called mxruntime.jar.
For details on usage and examples, see Using the Java API.
Most cloud infrastructure services (including those used by Mendix Cloud) will close HTTP connections automatically if there is no traffic for a few minutes, even if your activity is still waiting for a response. This means that, if your activity calls a web service which takes a long time to respond, the connection may be closed without the activity being aware of this and your activity will not receive a response, but instead get stuck waiting indefinitely for data to arrive.
You should therefore ensure that you always set a timeout for any connections you make in your custom Java code.
For details on this topic, see Using Eclipse.
Lists the problematic JAR files and the known workarounds.
Describes how to set up Eclipse, and how to add a Mendix application to Eclipse and launch it.
Describes how to extend your application with custom Java code.
Describes how to add a Java action, edit it in Eclipse, and call it from a microflow.
Describes consequences for a Mendix app when migrating from one Java version to another.
Describes how to use the managed dependencies feature in Studio Pro