PdfNET SDK with Glassfish: java.lang.UnsatisfiedLinkError: pdftron.PDF.PDFDoc.PDFDocCreate([B)J

Hi,

I’m trying to use PdfNET Sdk in java application. I got some problem with multiple instanciation onf the library in the classloader, so I put the PdfNet.Initialize() in and otherEJB. The initialize is call in the @PostConstruct of the EJB.
But when I run the other EJB that need PDFNet SDK, I got that error: java.lang.UnsatisfiedLinkError: pdftron.PDF.PDFDoc.PDFDocCreate([B)J.

How can I use the PdfNET Sdk with java and Glassfish.

Thanks in advance,

Julien

You will need to make sure that the Java application can locate the PDFNetC library (PDFNetC.dll, libPDFNetC.so, or libPDFNetC.dylib). The easiest solution is to place the library in the following locations:

  1. On Windows, place PDFNetC.dll to %WINDIR%\System32 or %WINDIR%\SysWOW64
  2. On Linux, place libPDFNetC.so to /usr/lib
  3. On Mac, place libPDFNetC.dylib to /Library/Java/Extensions.

Please keep in mind that you will need the same architecture of PDFNetC with the architecture of Java you are using. For example, 64-bit Java will only load 64-bit PDFNetC.

I’ve check in the classloader and I can see that my library is loaded. But I continue to receive that Error.

The strange thing i that, when I call directly in the ejb that need the library the PDFNet.Initialize(), it’s working the first time but when I redeploy, it’s not working anymore because it says that the native library is already loaded. So if I ignore the loading (but i’m sure that the lib is in the classloader). I got the error shown in the subject of this thread.

Regards
Le mercredi 18 septembre 2013 01:28:54 UTC+2, Vincent Ycasas a écrit :

You will need to make sure that the Java application can locate the PDFNetC library (PDFNetC.dll, libPDFNetC.so, or libPDFNetC.dylib). The easiest solution is to place the library in the following locations:

  1. On Windows, place PDFNetC.dll to %WINDIR%\System32 or %WINDIR%\SysWOW64
  2. On Linux, place libPDFNetC.so to /usr/lib
  3. On Mac, place libPDFNetC.dylib to /Library/Java/Extensions.

Please keep in mind that you will need the same architecture of PDFNetC with the architecture of Java you are using. For example, 64-bit Java will only load 64-bit PDFNetC.