0
我在我的spring項目中使用Ghost4J 0.5.1。執行Ghost4J的java.lang.IllegalStateException(Linux 32 vs 64位)
在本地一切工作正常(32位),但當我部署到EC2(64位),java.lang.IllegalStateException引發。
final Ghostscript ghostScript = Ghostscript.getInstance();
synchronized(ghostScript)
{
try
{
ghostScript.initialize(optimicePdfArguments); //here raises the exception
}
catch (GhostscriptException e)
{
LOGGER.error("Error");
}
}
我表示32/64位,因爲我覺得這是兩個系統之間的主要差異,並發現它indicanting其他相關問題。
我該如何讓Ghost4j在我的64位機器上工作?
編輯 我正在用Spring集成服務捕捉異常。當我不這樣做,將出現一個內部誤差:
這是重要的部分:
Caused by: java.lang.UnsatisfiedLinkError: Unable to load library 'gs': libgs.so: cannot open shared object file: No such file or directory
這是一個完整的堆棧跟蹤:
2014-07-16 20:16:15,159 DEBUG [userId = 1] [transformPdfToHpubChannelExecutor-1] o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'errorChannel'
2014-07-16 20:16:15,160 DEBUG [userId = 1] [transformPdfToHpubChannelExecutor-1] o.s.i.c.DirectChannel - preSend on channel 'v1.manageIssueChange.channel.error', message: [Payload MessageHandlingException content=org.springframework.messaging.MessageHandlingException: java.lang.IllegalStateException: Cannot process message][Headers={id=12dbbf58-eda5-14b7-0ad9-8058225b6353, timestamp=1405541775160}]
2014-07-16 20:16:15,160 WARN [userId = 1] [transformPdfToHpubChannelExecutor-1] o.s.i.c.MessagePublishingErrorHandler - Error message was not delivered.
org.springframework.messaging.MessageDeliveryException: Dispatcher has no subscribers for channel 'org.springframework.web.context.WebApplicationContext:/MagmaServer.v1.manageIssueChange.channel.error'.
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:81) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:255) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.channel.MessagePublishingErrorHandler.handleError(MessagePublishingErrorHandler.java:83) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:55) [spring-integration-core-4.0.2.RELEASE.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_60]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_60]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_60]
Caused by: org.springframework.integration.MessageDispatchingException: Dispatcher has no subscribers
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:107) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:97) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
... 6 common frames omitted
2014-07-16 20:16:15,162 ERROR [userId = 1] [transformPdfToHpubChannelExecutor-1] o.s.i.c.MessagePublishingErrorHandler - failure occurred in messaging task with message: [Payload UpdateIssueRequestDTO [email protected]250][Headers={errorChannel=v1.manageIssueChange.channel.error, operationType=createFromPdf, id=bd35e61d-7492-fb61-0d7f-49eea3b5c3f7, timestamp=1405541773441}]
org.springframework.messaging.MessageHandlingException: java.lang.IllegalStateException: Cannot process message
at org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:78) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.handler.ServiceActivatingHandler.handleRequestMessage(ServiceActivatingHandler.java:71) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:170) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.handler.MessageHandlerChain$1.send(MessageHandlerChain.java:150) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:114) ~[spring-messaging-4.0.3.RELEASE.jar:4.0.3.RELEASE]
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:44) ~[spring-messaging-4.0.3.RELEASE.jar:4.0.3.RELEASE]
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:93) ~[spring-messaging-4.0.3.RELEASE.jar:4.0.3.RELEASE]
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendMessage(AbstractReplyProducingMessageHandler.java:260) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendReplyMessage(AbstractReplyProducingMessageHandler.java:241) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.produceReply(AbstractReplyProducingMessageHandler.java:205) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleResult(AbstractReplyProducingMessageHandler.java:199) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:177) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.handler.MessageHandlerChain$1.send(MessageHandlerChain.java:150) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:114) ~[spring-messaging-4.0.3.RELEASE.jar:4.0.3.RELEASE]
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:44) ~[spring-messaging-4.0.3.RELEASE.jar:4.0.3.RELEASE]
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:93) ~[spring-messaging-4.0.3.RELEASE.jar:4.0.3.RELEASE]
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendMessage(AbstractReplyProducingMessageHandler.java:260) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.sendReplyMessage(AbstractReplyProducingMessageHandler.java:241) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.produceReply(AbstractReplyProducingMessageHandler.java:205) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleResult(AbstractReplyProducingMessageHandler.java:199) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:177) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.handler.MessageHandlerChain.handleMessageInternal(MessageHandlerChain.java:131) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:101) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.dispatcher.UnicastingDispatcher.access$000(UnicastingDispatcher.java:48) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.dispatcher.UnicastingDispatcher$1.run(UnicastingDispatcher.java:92) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:52) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_60]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_60]
at java.lang.Thread.run(Thread.java:745) [na:1.7.0_60]
Caused by: java.lang.IllegalStateException: Cannot process message
at org.springframework.integration.util.MessagingMethodInvokerHelper.processInternal(MessagingMethodInvokerHelper.java:284) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.util.MessagingMethodInvokerHelper.process(MessagingMethodInvokerHelper.java:142) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:75) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
... 33 common frames omitted
Caused by: java.lang.UnsatisfiedLinkError: Unable to load library 'gs': libgs.so: cannot open shared object file: No such file or directory
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:166) ~[jna-3.3.0.jar:3.3.0 (b0)]
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:239) ~[jna-3.3.0.jar:3.3.0 (b0)]
at com.sun.jna.Library$Handler.<init>(Library.java:140) ~[jna-3.3.0.jar:3.3.0 (b0)]
at com.sun.jna.Native.loadLibrary(Native.java:393) ~[jna-3.3.0.jar:3.3.0 (b0)]
at com.sun.jna.Native.loadLibrary(Native.java:378) ~[jna-3.3.0.jar:3.3.0 (b0)]
at org.ghost4j.GhostscriptLibraryLoader.loadLibrary(GhostscriptLibraryLoader.java:39) ~[ghost4j-0.5.1.jar:na]
at org.ghost4j.GhostscriptLibrary.<clinit>(GhostscriptLibrary.java:34) ~[ghost4j-0.5.1.jar:na]
at org.ghost4j.Ghostscript.initialize(Ghostscript.java:323) ~[ghost4j-0.5.1.jar:na]
at com.proyecti.magma.services.v1.issue.transformpdf.TransformPdfToHpubServiceImpl.optimizePdf(TransformPdfToHpubServiceImpl.java:217) ~[TransformPdfToHpubServiceImpl.class:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_60]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_60]
at org.springframework.expression.spel.support.ReflectiveMethodExecutor.execute(ReflectiveMethodExecutor.java:63) ~[spring-expression-4.0.3.RELEASE.jar:4.0.3.RELEASE]
at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:122) ~[spring-expression-4.0.3.RELEASE.jar:4.0.3.RELEASE]
at org.springframework.expression.spel.ast.MethodReference.access$000(MethodReference.java:44) ~[spring-expression-4.0.3.RELEASE.jar:4.0.3.RELEASE]
at org.springframework.expression.spel.ast.MethodReference$MethodValueRef.getValue(MethodReference.java:258) ~[spring-expression-4.0.3.RELEASE.jar:4.0.3.RELEASE]
at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:84) ~[spring-expression-4.0.3.RELEASE.jar:4.0.3.RELEASE]
at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:114) ~[spring-expression-4.0.3.RELEASE.jar:4.0.3.RELEASE]
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:111) ~[spring-expression-4.0.3.RELEASE.jar:4.0.3.RELEASE]
at org.springframework.integration.util.AbstractExpressionEvaluator.evaluateExpression(AbstractExpressionEvaluator.java:159) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
at org.springframework.integration.util.MessagingMethodInvokerHelper.processInternal(MessagingMethodInvokerHelper.java:268) ~[spring-integration-core-4.0.2.RELEASE.jar:na]
... 35 common frames omitted
請在完整的堆棧跟蹤中包含完整的例外。 –
@Banthar我已經收錄了它 –