Giter Site home page Giter Site logo

When I set the setcap cap_net_raw,cap_net_admin=eip /path/to/java; the java can not run anymore, it report the error below about pcap4j HOT 10 CLOSED

xiaoleihuang avatar xiaoleihuang commented on July 18, 2024
When I set the setcap cap_net_raw,cap_net_admin=eip /path/to/java; the java can not run anymore, it report the error below

from pcap4j.

Comments (10)

kaitoy avatar kaitoy commented on July 18, 2024 2

Try ln -s /usr/local/java/jre/lib/amd64/jli/libjli.so /usr/lib/.
Or echo /usr/local/java/jre/lib/amd64/jli/ >> /etc/ld.so.conf

from pcap4j.

kaitoy avatar kaitoy commented on July 18, 2024

It's probably the same issue as this.
Setting LD_LIBRARY_PATH to include where libjli.so is may solve the issue.

from pcap4j.

xiaoleihuang avatar xiaoleihuang commented on July 18, 2024

I tried this method to set libjli.so in the PATH, but it did not work either. I tried following in either /etc/profile or ~/.bashrc:

libjli.so path

export PATH=/usr/local/java/jre/lib/amd64/jli/libjli.so:$PATH

Later, I tried:

libjli.so path

export PATH=/usr/local/java/jre/lib/amd64/jli:$PATH

They did not work at all. Then I tried root,
under root account, java -v does not work, but java -version does work....

from pcap4j.

kaitoy avatar kaitoy commented on July 18, 2024

How was LD_LIBRARY_PATH? Did you try it?

from pcap4j.

xiaoleihuang avatar xiaoleihuang commented on July 18, 2024

Yeah, I just tried it with the following code in either /etc/profile or ~/.bashrc:
export LD_LIBRARY_PATH=/usr/local/java/jre/lib/amd64/jli
export PATH=${LD_LIBRARY_PATH}:$PATH
#export PATH=/usr/local/java/jre/lib/amd64/jli/libjli.so:$PATH

It did not work. T-T, sad Saturday afternoon.

from pcap4j.

xiaoleihuang avatar xiaoleihuang commented on July 18, 2024

Thank you. The first command works! I appreciate your help.

I have not tried the second command.
BTW, I am curious why the both commands would work.
Why making such soft link could solve the problem? Does that mean to add the file to lib path?

from pcap4j.

kaitoy avatar kaitoy commented on July 18, 2024

You are right.
The error occurred because java couldn't find a shared library, libjli.so. The reason why the java lost sight of it after setting setcap cap_net_raw,cap_net_admin=eip is explained at the link I indicated above.
All of my suggestions intended to let the java know the place of libjli.so. Generally speaking, shared libraries are searched in specific directories. LD_LIBRARY_PATH and /etc/ld.so.conf are to specify the directories. ln -s /usr/local/java/jre/lib/amd64/jli/libjli.so /usr/lib/ is another approach that adds libjli.so to the directory (i.e. /usr/lib/) which is searched by default.

from pcap4j.

xiaoleihuang avatar xiaoleihuang commented on July 18, 2024

Thank you. BTW, pcap packet seems to contains no timestamp, instead, I have
to use handler.gettimestamp method to retrieve the time. Will this cause
any time errors? Is there a method to retrieve packets that contain
timestamp inside of them?

On Sat, May 14, 2016 at 2:20 AM, Kaito Yamada [email protected]
wrote:

You are right.
The error occurred because java couldn't find a shared library, libjli.so.
The reason why the java lost sight of it after setting setcap
cap_net_raw,cap_net_admin=eip is explained at the link I indicated above.
All of my suggestions intended to let the java know the place of
libjli.so. Generally speaking, shared libraries are searched in specific
directories. LD_LIBRARY_PATH and /etc/ld.so.conf are to specify the
directories. ln -s /usr/local/java/jre/lib/amd64/jli/libjli.so /usr/lib/
is another approach that adds libjli.so to the directory (i.e. /usr/lib/)
which is searched by default.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#63 (comment)

from pcap4j.

kaitoy avatar kaitoy commented on July 18, 2024

No, PcapHandler#getTimestamp() returns a correct timestamp.

from pcap4j.

bjwktcsnzh avatar bjwktcsnzh commented on July 18, 2024

@xiaoleihuang

This blog explains the reason .

from pcap4j.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.