[zeromq-dev] Two apps on the same JVM

Erwin Karbasi erwin at optinity.com
Sat May 25 09:22:59 CEST 2013


Siam Rafiee <siamraf <at> gmail.com> writes:

> 
> 
> What container are you using to bring up the applications? The JVM won't
let you load the same native library from different classloaders. You'll
need to ensure the library is loaded in a parent classloader, available to
both application classloaders. For example, in Tomcat you would achieve this
by placing the jzmq jar in 'tomcat/lib' and the native libraries in
'tomcat/bin'.
> 
> 
> You might find it easier to swap out JZMQ for JeroMQ
(https://github.com/zeromq/jeromq), which is a pure Java implementation with
no need for native libraries.
> 
> Siam
> 
> 
> On 24 May 2013 12:51, Erwin Karbasi <erwin <at> optinity.com> wrote:
> 
> 
> 
> 
> Hello Guys,
> Following our use cases:
> 
> 1. We have two applications that packaged the SO file (C lib files) and
JZMQ.jar as part of the applications  jar.
> We have tried to deploy these apps on the same JVM and encountered
following error:
> 
> 
> java.lang.UnsatisfiedLinkError:
> jzmq (Not found in java.library.path)
> 
> 2. We have also tried to set the lib files in the LD_LIBERARY_PATH
(instead of above approach of packaging the lib as part of the application
jar) and use separate Context object per application on the same JVM but we
came across following error:
> 
> 
> 
> 
> 
> 
> java.lang.UnsatisfiedLinkError:
> jzmq (Library is already loaded in another ClassLoader)
> 
>                
> at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1053)
> 
>                
> at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1017)
> 
>                
> at java.lang.System.loadLibrary(System.java:474)
> 
>                
> at org.zeromq.ZMQ.<clinit>(ZMQ.java:36)
> 
> 
> Your insight regarding above two issues would highly appreciated.
> 
> Thanks,
> Erwin Karbasi
> 
> 
> AT&T, Senior Software Architect
> 
> 
> _______________________________________________
> zeromq-dev mailing listzeromq-dev <at>
lists.zeromq.orghttp://lists.zeromq.org/mailman/listinfo/zeromq-dev
> 
> 
> 
> 
> 
> 
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev <at> lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> 


Hello Siam,

Thanks a lot for fast turnaround response.

I'm using WebSphere application server.

1. I know that if I'll add the library as a shared lib to the JVM I can use
two Context object in the same JVM, but is it possible to add the
LD_LIBERARY_PATH to the machine properties or using -Djava.lib.path as
property of the JVM and to create two separate Context on separate app
deployed on the same JVM?

2. I'd happy to use the JeroMQ, but as I know its performance is not a same
as JZMQ and it could degrade the messaging performance significantly.

Thanks,
Erwin




More information about the zeromq-dev mailing list