我正在使用magick API将cmyk图像转换为RGB我的代码编译时没有任何错误但是在运行时我得到的类没有找到类型的异常请求帮助(我在servlet中进行转换)。我试过的代码附在下面。
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
MagickImage image = null;
try {
image = new MagickImage(new ImageInfo("D:\\1\\ftp\\cmyk.jpg"));
image.rgbTransformImage(ColorspaceType.RGBColorspace);
byte[] bytes =image.imageToBlob(new ImageInfo("D:\\1\\ftp\\cmyk.jpg"));
response.getOutputStream().write(bytes);
} catch (MagickException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
堆栈跟踪:
ava.lang.NoClassDefFoundError: Could not initialize class magick.MagickImage
at servlet.ImageServlet.doGet(ImageServlet.java:58)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:844)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:242)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:216)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:132)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:338)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:221)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3284)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3254)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2163)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2089)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2074)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1513)
at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)