[zeromq-dev] Two apps on the same JVM
Siam Rafiee
siamraf at gmail.com
Tue May 28 13:03:47 CEST 2013
Just to clarify here - this isn't a problem with ZeroMQ Contexts, it's down
to restrictions on the JVM itself not being able to load a native library
from different classloaders. Setting the LD_LIBRARY_PATH (or the
-Djava.library.path) alone won't work because you need to specifically tell
your container (WebSphere) to load the jzmq native libraries in the parent
classloader, in order for it to be available to both your applications'
classloaders.
There are steps on how to configure shared libraries in WebSphere here
http://pic.dhe.ibm.com/infocenter/wasinfo/v8r0/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Ftcws_sharedlib_nativelib.html
.
Siam
On 25 May 2013 08:22, Erwin Karbasi <erwin at optinity.com> wrote:
> 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
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130528/0b2f9be5/attachment.htm>
More information about the zeromq-dev
mailing list