users@glassfish.java.net

Re: Glassfish with JNI

From: Saloustros Georgios <gesalous_at_gmail.com>
Date: Thu, 11 Sep 2008 12:42:42 +0300

Hello Joss.
I was also had the same problem with you
When my service is excecuted for the first time (with the use of a boolean
flag) it executes System.loadlibrary("libraryname.so") like this

if(!loaded){
            try{
            System.loadLibrary("ddot");
            loaded=true;
            } catch(UnsatisfiedLinkError exc){}
        }

and the jvm loads the library - everything goes ok.
The problem is when you undeploy your web service and redeploy it again the
.so library is still loaded so you get an UnsatisfiedLinkError Exc, as you
can see from the code above.
One possible solution would to order jvm to unload the .so library when your
application is undeployed.
I haven't found a way to do this (I am curious), i haven't found a command
that unloads the library.
I think though, that isn't going to be a problem cause when your application
is in it's final version there will not be an obvious reason to
deploy/undeploy it.

2008/9/11 <glassfish_at_javadesktop.org>

> I am trying to use a JNI library .so file from within a webservice deployed
> on the glassfish AS.
> When I start GF the native method runs correctly but if I do a
> undeploy/deploy and then try to execute the webservice I get a
> java.lang.UnsatisfiedLinkError when I call the native method. If I restart
> GF then the native method will work again until I do a undeploy/deploy.
> I am using glassfish-v2-ur2-b04-patch-20080715.
> Has anyone else come across this problem or suggest a solution?
>
> Thanks
> Joss Armstrong
> [Message sent by forum member 'jarmstrong001' (jarmstrong001)]
>
> http://forums.java.net/jive/thread.jspa?messageID=298582
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>