Is it possible to deploy Java actions as a jar file?

4
Is it possible to deploy Java actions as a jar file? The comments in application.conf suggest that it is. I have tried the following: putting all the actions in a jar and dropping it into WEB-INF/actions directory updating the application.conf file to point to the jar file explicitly using the “ActionPath” parameter updating the application.conf file to point to the directory containing the jar file using the “ActionPath” parameter putting the jar file in the userlib directory putting the jar file in the WEB-INF/lib directory All of which fail with the same error. Does anyone know how this might be accomplished?
asked
3 answers
3

I am kind of curious what kind of error you receive.

But no it isn't possible to deploy all your actions as a jar file. In most cases it won't be necessary to put your actions in a jar file. When you do want to use a separate jar it doesn't require any special changes in the application.conf file, the config can remain the same as it was when your actions were still located in the WEB-INF/action folder.

At Mendix we use eclipse to build our java code, it also provides an easy way of creating jar files:
- Open eclipse and find your code in the package explorer.
- Select the classes/packages you want to export
- Click with your right mouse button on the selected items and choose the option 'Export'
- In the popup that opens, choose the option Java/Jar-file and press the button 'Next'
- In the next popup form validate if all Java files you want in the jar are actually checked
- Choose an export path where eclipse should place the Jar file
- Press the 'Finish' button or the 'Next' button in case you want to change some advanced settings
- No located the just created jar file, place it in the userlib folder
- If you start the XAS with the new jar, make sure the code you've just exported won't be compiled because that could give some strange errors

answered
2

The errors on startup look like:

2009-09-25 14:55:40.936 ERROR - CORE_ACTIONMANAGEMENT: Action 'System.SelectLdapDirectory' not found!

When attempting to run one of the actions the stacktrace looks like:

2009-09-25 14:56:27.647 ERROR - CORE_ACTIONMANAGEMENT: Action with name 'xxx.yyy not found. 2009-09-25 14:56:27.647 ERROR - MICROFLOWENGINE: Exception occurred in microflow 'xxx.yyy for activity 'Read file'', all database changes executed by this microflow were rolled back 2009-09-25 14:56:27.647 ERROR MICROFLOWENGINE: java.lang.IllegalArgumentException: Action should not be null com.mendix.core.Core.execute(Core.java:358) com.mendix.modules.microflowengine.B.E.B.B(JavaAction.java:62) com.mendix.modules.microflowengine.microflow.E.A(MicroflowObject.java:63) com.mendix.modules.microflowengine.microflow.Microflow.executeAction(Microflow.java:95) com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:60) com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:378) java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) java.util.concurrent.FutureTask.run(FutureTask.java:138) java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) java.lang.Thread.run(Thread.java:619)

Caused by: Action should not be null com.mendix.core.actionmanagement.B.B(ActionManager.java:143) com.mendix.core.Core.execute(Core.java:351) com.mendix.modules.microflowengine.B.E.B.B(JavaAction.java:62) com.mendix.modules.microflowengine.microflow.E.A(MicroflowObject.java:63) com.mendix.modules.microflowengine.microflow.Microflow.executeAction(Microflow.java:95) com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:60) com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:378) java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) java.util.concurrent.FutureTask.run(FutureTask.java:138) java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) java.lang.Thread.run(Thread.java:619)

The reason we want to create a jar for the actions is for ease of deployment and also so that we can integrate with Maven and produce archiveable binary distributables in a Maven repository. By using standard Java build environment tools (such as the Maven release plugin) we can automate as much of this as possible, but that is not really possible when dealing with a directory structure of .class files.

answered
1

If you open your jar file with any kind of zip tool (winzip, winrar, 7zip, etc.) which directories do you see?

The content of the jar file should contain the same folders (and folder structure) as in the javasource folder(not the javasource folder itself)

answered