ImageMagick无法在Spring启动的压缩WAR中找到convert.exe的路径

时间:2018-05-01 10:33:58

标签: java spring-boot imagemagick im4java

我正在使用ImageMagick裁剪图像文件。我正在使用ImageMagick部署压缩WAR。 ProcessStarted类的searchForCmd()函数无法从WEB-INF / classes中找到ImageMagick的文件,即

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

如何在打包战争中访问convert.exe。

下面是堆栈跟踪。

 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 个答案:

答案 0 :(得分:0)

WAR通常不包含EXE。如果您对外部应用程序有依赖关系,则必须将它们安装在部署WAR的服务器(或容器)中。还要考虑你的Springboot通常可以在Linux或Windows服务器上运行,每个IM的可执行文件都不同......