1

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)
James Z
  • 12,209
  • 10
  • 24
  • 44
Ravi
  • 195
  • 3
  • 15
  • I will just point out that ImageMagick-6.6.1-5 is ancient. It is over 400 versions old. You might want to consider an upgrade. – fmw42 May 02 '18 at 16:16

1 Answers1

0

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...

xenoid
  • 8,396
  • 3
  • 23
  • 49
  • I will just point out that ImageMagick-6.6.1-5 is ancient. It is over 400 versions old. You might want to consider an upgrade. – fmw42 May 01 '18 at 21:19
  • @fmw42 this is a comment about the question, not about this answer? – xenoid May 02 '18 at 11:43
  • `@Xenoid` Sorry, I accidentally posted in the wrong place. It was not my intention. Thanks. I will repost in the correct spot. – fmw42 May 02 '18 at 16:16