Convert PDF to PNG (tess4j) - localy work correct but not in server JBoss

386 views Asked by At

I tired convert PDF file to PNG's.

Used maven library:

<dependency>
    <groupId>net.sourceforge.tess4j</groupId>
    <artifactId>tess4j</artifactId>
    <version>1.3.0</version>
</dependency> 

In local Development Intellij and globally maven it correct work, but at the server Wildfly 8.2.0-final is error:

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:145) [jna-3.0.9.jar:3.0.9 b0]
            at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:188) [jna-3.0.9.jar:3.0.9 b0]
            at com.sun.jna.Library$Handler.<init>(Library.java:123) [jna-3.0.9.jar:3.0.9 b0]
            at com.sun.jna.Native.loadLibrary(Native.java:255) [jna-3.0.9.jar:3.0.9 b0]
            at com.sun.jna.Native.loadLibrary(Native.java:241) [jna-3.0.9.jar:3.0.9 b0]
            at org.ghost4j.GhostscriptLibraryLoader.loadLibrary(GhostscriptLibraryLoader.java:39) [ghost4j-0.5.1.jar:]
            at org.ghost4j.GhostscriptLibrary.<clinit>(GhostscriptLibrary.java:34) [ghost4j-0.5.1.jar:]
            at org.ghost4j.Ghostscript.initialize(Ghostscript.java:323) [ghost4j-0.5.1.jar:]
            at net.sourceforge.vietocr.PdfUtilities.convertPdf2Png(PdfUtilities.java:102) [tess4j-1.3.0.jar:1.3.0]
            at utils.Test.test(Test.java:20) [project-1.2.0.jar:]
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_21]
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_21]
            at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_21]
            at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
            at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
            at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
            at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:407)
            at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:82) [wildfly-weld-8.2.0.Final.jar:8.2.0.Final]
            at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:93) [wildfly-weld-8.2.0.Final.jar:8.2.0.Final]
            at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
            at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
            at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
            at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43) [wildfly-ejb3-8.2.0.Final.jar:8.2.0.Final]
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
            at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47) [wildfly-jpa-8.2.0.Final.jar:8.2.0.Final]
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
            at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:407)
            at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:46) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]
            at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:83) [wildfly-weld-8.2.0.Final.jar:8.2.0.Final]
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
            at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45) [wildfly-ee-8.2.0.Final.jar:8.2.0.Final]
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
            at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
            at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
            at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
            at org.jboss.as.ejb3.component.interceptors.NonPooledEJBComponentInstanceAssociatingInterceptor.processInvocation(NonPooledEJBComponentInstanceAssociatingInterceptor.java:59) [wildfly-ejb3-8.2.0.Final.jar:8.2.0.Final]
            at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
            at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInNoTx(CMTTxInterceptor.java:260) [wildfly-ejb3-8.2.0.Final.jar:8.2.0.Final]
            ... 107 more

File file = new File("path/to/file.pdf");

In line 20 is:

File[] arrayOfFile = PdfUtilities.convertPdf2Png(file);

Any idea, why this not work at jboss ?

1

There are 1 answers

0
ErikHH On BEST ANSWER

I think the ghost script library is not installed on the server. According to the documentation that's needed for PDF support.