ImageMagick unable to find the path of convert.exe in packed WAR of Spring boot

442 views Asked by At

I am using ImageMagick to crop image file. I am deploying packed WAR with ImageMagick inside. searchForCmd() function of ProcessStarted class is unable to find the files of ImageMagick from WEB-INF/classes i.e.

file:/D:/Project/build/libs/proj-0.0.1-SNAPSHOT.war!/WEB-INF/classes!/ImageMagick-6.6.1-5

how can I access the convert.exe in packed war .

Below is the stacktrace.

 org.im4java.core.CommandException: java.io.FileNotFoundException: convert
    at org.im4java.core.ImageCommand.run(ImageCommand.java:219)
    at com.os.util.helper.ImageCropHelper.cropImageByImageMagic(ImageCropHelper.java:316)
    at com.os.util.helper.ImageCropHelper.cropImage(ImageCropHelper.java:375)
    at com.os.action.UserAction.mntnUserAvatar(UserAction.java:2566)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:899)
    at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1544)
    at ognl.ObjectMethodAccessor.callMethod(ObjectMethodAccessor.java:68)
    at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethodWithDebugInfo(XWorkMethodAccessor.java:96)
    at com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor.callMethod(XWorkMethodAccessor.java:88)
    at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:1620)
    at ognl.ASTMethod.getValueBody(ASTMethod.java:91)
    at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)
    at ognl.SimpleNode.getValue(SimpleNode.java:258)
    at ognl.Ognl.getValue(Ognl.java:470)
    at ognl.Ognl.getValue(Ognl.java:434)
1

There are 1 answers

3
xenoid On

WARs normally do no contain EXEs. If you have dependencies on external applications, they must be installed on the server (or in the container) where the WAR is deployed. Also consider that your Springboot can normally run on a Linux or a Windows server and the IM executable would be different for each...