Search code examples
javaglassfishclassloaderjnawaffle

Run Web Application on Glassfish with newer version of jna library


I hava a web application that should run on glassfish.

The application uses jna version 4.1.0 and the jna-4.1.0.jar is packed with the application inside its lib folder.

Howerver, as far as I can tell the glassfish itself uses version 3.1 of the jna library and it is packed inside ibpam4j-repackaged.jar on the following path:

('C:/Program Files/glassfish-4.1.1/glassfish/modules').

As a result - the application is not running, and it throws

java.lang.NoSuchMethodError: com.sun.jna.Pointer.getWideString(J)Ljava/lang/String;

cause the wrong version of the library is being used.

Any Ideas how to overcome this issue?

Thanks.

(By the way it is not my application per se - I am just trying to run a waffle example on glassfish)


Solution

  • It turns out that setting <class-loader delegate="false"/> inside the glassfish-web.xml does the trick.

    Everything works now.