weixin_39795116
2020-12-02 02:11 阅读 30

Could not initialize class oshi.jna.platform.linux.Libc$Sysinfo

The problem is just as the title and it is similar with https://github.com/oshi/oshi/issues/338 too.But my oshi-core is 3.4.0 with openjdk1.8 and glibc2.17.Don't know why I have the issue. image

该提问来源于开源项目:oshi/oshi

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

8条回答 默认 最新

  • weixin_39970823 weixin_39970823 2020-12-02 02:11

    Are you able to update to a more recent version? I see back in 3.4.0 I combined some of the various platform C libraries and it might be misreading "c" vs. "libc". 3.13.5 is the latest 3.X version.

    点赞 评论 复制链接分享
  • weixin_39970823 weixin_39970823 2020-12-02 02:11

    Or, of course, you could update to the latest release, 5.0.1 :)

    点赞 评论 复制链接分享
  • weixin_39795116 weixin_39795116 2020-12-02 02:11

    Okay . let me have a try

    点赞 评论 复制链接分享
  • weixin_39795116 weixin_39795116 2020-12-02 02:11

    I've tried oshi-core 3.5.0 and 3.13.5, but the exception is still there.There is another exception [ java.lang.UnsatisfiedLinkError: /tmp/jna-3506402/jna6307814886269756539.tmp: /tmp/jna-3506402/jna6307814886269756539.tmp: failed to map segment from shared object: Operation not permitted ] , raleted to this exception?

    点赞 评论 复制链接分享
  • weixin_39970823 weixin_39970823 2020-12-02 02:11

    Those other errors are related to the JNA dependency and the native library it installs. So this isn't an OSHI problem in particular, but something about your OS setup. What OS?

    How are you compiling your code? Are you using Maven or another dependency manager? What version of JNA are you using? I'm guessing there are problems finding libraries but I really don't have much to go on here.

    点赞 评论 复制链接分享
  • weixin_39795116 weixin_39795116 2020-12-02 02:12

    centos7 in aws, maven. Is jna in OSHI? I thinl it is 4.5.2. image

    点赞 评论 复制链接分享
  • weixin_39970823 weixin_39970823 2020-12-02 02:12

    Not really sure what the problem is, although I suspect configuration/permissions with your cloud server. I would suggest trying with the newest versions of both OSHI and JNA, although I don't know if that's going to help you.

    点赞 评论 复制链接分享
  • weixin_39795116 weixin_39795116 2020-12-02 02:12

    It is caused by the UnsatisfiedLinkError. I resolved the issue with using a tmp dir created by myself rather than the centos /tmp.

    点赞 评论 复制链接分享

相关推荐