users@glassfish.java.net

Re: Native library already loaded in another classloader

From: Major Péter <majorpetya_at_sch.bme.hu>
Date: Tue, 20 Apr 2010 18:53:08 +0200

Hi,

If you're not changing the library during deploys, then you could simply
catch the UnsatisfiedLinkError like this:
try {
    System.load("/home/usr/glassfish/glassfish/lib/libPlcVirtualEjb.so");
} catch (UnsatisfiedLinkError ex) {
    //DO NOTHING
}

But if your library is changing all the time, then you can't do anything
about it, you have to restart the VM, because the library was already
loaded in that VM.

Regards,
Peter

2010-04-20 18:50 keltezéssel, glassfish_at_javadesktop.org írta:
> Hello,
>
> I am using Glassfish server for my EJB application. Each time I change the server side and run my application, I get this message:
>
> Native Library already loaded in another classloader.
>
> To avoid this I have to restart the server each time.
>
> I tried to move my .so library to ~/gf/lib directory and tried :
> ./asadmin set server.java-config.native-library-path-suffix=/home/usr/glassfish/glassfish/lib/libPlcVirtualEjb.so
>
> but I am getting
>
> bash: ./asadmin: is a directory
>
> Please suggest what can I do.
>
> Thanks,
>
> H
> [Message sent by forum member 'h_p']
>
> http://forums.java.net/jive/thread.jspa?messageID=398065