java.library.path中没有jzmq [英] No jzmq in java.library.path

查看:101
本文介绍了java.library.path中没有jzmq的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个交易引擎上工作,在运行时,我从engine.log获取日志,如下所示,

I work on a trading engine where at the time of run, I get the log from the engine.log like the following,

2018_01_02_03_28_20_684 INFO  ZMQCommunicatorService REMOTE_EXECUTOR_MARKET_ADMIN-ALL_MARKETS-0-5 - no jzmq in java.library.path, sleeping 2 minutes then try again
2018_01_02_03_28_20_697 INFO  ZMQCommunicatorService ENGINE_MARKET_ADMIN-ALL_MARKETS-0-4 - Could not initialize class org.zeromq.ZMQ, sleeping 2 minutes then try again
2018_01_02_03_30_20_696 INFO  ZMQCommunicatorService REMOTE_EXECUTOR_MARKET_ADMIN-ALL_MARKETS-0-5 - Could not initialize class org.zeromq.ZMQ, sleeping 2 minutes then try again
2018_01_02_03_30_20_710 INFO  ZMQCommunicatorService ENGINE_MARKET_ADMIN-ALL_MARKETS-0-4 - Could not initialize class org.zeromq.ZMQ, sleeping 2 minutes then try again
2018_01_02_03_32_20_697 INFO  ZMQCommunicatorService REMOTE_EXECUTOR_MARKET_ADMIN-ALL_MARKETS-0-5 - Could not initialize class org.zeromq.ZMQ, sleeping 2 minutes then try again
2018_01_02_03_32_20_711 INFO  ZMQCommunicatorService ENGINE_MARKET_ADMIN-ALL_MARKETS-0-4 - Could not initialize class org.zeromq.ZMQ, sleeping 2 minutes then try again
2018_01_02_03_34_20_698 INFO  ZMQCommunicatorService REMOTE_EXECUTOR_MARKET_ADMIN-ALL_MARKETS-0-5 - Could not initialize class org.zeromq.ZMQ, sleeping 2 minutes then try again
2018_01_02_03_34_20_712 INFO  ZMQCommunicatorService ENGINE_MARKET_ADMIN-ALL_MARKETS-0-4 - Could not initialize class org.zeromq.ZMQ, sleeping 2 minutes then try again
2018_01_02_03_36_20_699 INFO  ZMQCommunicatorService REMOTE_EXECUTOR_MARKET_ADMIN-ALL_MARKETS-0-5 - Could not initialize class org.zeromq.ZMQ, sleeping 2 minutes then try again
2018_01_02_03_36_20_713 INFO  ZMQCommunicatorService ENGINE_MARKET_ADMIN-ALL_MARKETS-0-4 - Could not initialize class org.zeromq.ZMQ, sleeping 2 minutes then try again

我相信第一行说明了主要问题

I believe the first line tells the main issue,

No jzmq in java.library.path

我遵循了ZMQ binding for Java

I followed the setup manual for the ZMQ binding for Java,

cd /root
wget https://github.com/zeromq/jzmq/archive/v3.1.0.tar.gz -O jzmq-3.1.0.tar.gz
tar zxf jzmq-3.1.0.tar.gz
cd jzmq-3.1.0
./autogen.sh
./configure --prefix=/opt/jzmq-3.1.0
nice make
make install

加载项目后,需要在项目根目录中运行命令

After I load the project, it was required to run the commands in the project root,

root@debian:~# export LD_LIBRARY_PATH=/opt/jzmq-3.1.0/lib

root@debian:~# java -Xss256k -cp /opt/jzmq-3.1.0/share/java/zmq.jar:draglet-common/target/lib/*:draglet-balser/target/lib/*:draglet-engine/target/lib/*:draglet-remote/target/lib/*:draglet-mapu/target/lib/*:draglet-shaba/target/lib/*:draglet-meba/target/lib/* -Dlog4j.configurationFile=draglet-common/src/main/resources/log4j2.xml -DisThreadContextMapInheritable=true com.draglet.batch.Batch draglet.yml

当时我得到类似

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

Tue Jan 02 03:59:17 EST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

问题与Intellij终端中提供的警告有关吗?如何检查jzmq是否在java.library.path中?

Is the issue has anything to do with the warning provided in the Intellij terminal? How do I check if the jzmq is in the java.library.path?

推荐答案

好.因此,让我们一起动手吧:

在计算机上查看是否可以正常运行,是否经过适当安装:

Ok. So, let's get hands dirty together:

to see on your machine, if this works as it ought, after a due installation, or not:

最简单的形式原型之一是 REQ/REP 示例,该示例包含两个部分,一个部分-一个"服务器":

One of the simplest formal-archetype is a REQ/REP example, that uses two parts, one - a "server":

import org.zeromq.ZMQ;
import org.zeromq.ZMQ.Context;
import org.zeromq.ZMQ.Socket;

public class rrserver{
    public static void main (String[] args) {
        Context context = ZMQ.context(1);

        //  Socket to talk to clients
        Socket responder  = context.socket(ZMQ.REP);
        responder.bind("tcp://localhost:5560");

        System.out.println("launch and connect server.");

        while (!Thread.currentThread().isInterrupted()) {
            //  Wait for next request from client
            byte[] request = responder.recv(0);
            String string = new String(request);
            System.out.println("Received request: ["+string+"].");

            //  Do some 'work'
            try {
                Thread.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

            //  Send reply back to client
            responder.send("World".getBytes(), 0);
        }

        //  We never get here but clean up anyhow
        responder.close();
        context.term();
    }
}


和另一部分," client ":

import org.zeromq.ZMQ;
import org.zeromq.ZMQ.Context;
import org.zeromq.ZMQ.Socket;

public class rrclient{

    public static void main(String[] args) {
        Context context = ZMQ.context(1);

        //  Socket to talk to server
        Socket requester = context.socket(ZMQ.REQ);
        requester.connect("tcp://localhost:5560"); // REF ABOVE AND LET START THIS AFTER "server"

        System.out.println("launch and connect client.");

        for (int request_nbr = 0; request_nbr < 10; request_nbr++) {
            requester.send("Hello", 0);
            String reply = requester.recvStr(0);
            System.out.println("Received reply " + request_nbr + " [" + reply + "]");
        }

        //  We never get here but clean up anyhow
        requester.close();
        context.term();
    }
}

应该正确安装并运行,以显示安装是否正确.代码是从ZeroMQ借来的琐碎示例中借鉴来的.

This ought get up and running quite fast to show, if the installation was done right or not. Code was borrowed from ZeroMQ published trivial examples for inspiration.

如果确实想涉足分布式计算领域,请毫不犹豫地从Pieter HINTJENS读一本很棒的书,"Code Connected,Volume 1"(也提供pdf版本).值得时间和精力.

If indeed serious about going into a domain of distributed computing, do not hesitate to read a great book from Pieter HINTJENS, "Code Connected, Volume 1" ( also available in pdf ). Worth time and efforts.

这篇关于java.library.path中没有jzmq的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆