草庐IT

java - 错误的 ELF 类 : ELFCLASS32 (Possible cause: architecture word width mismatch)

coder 2023-06-18 原文

我有一个奇怪的异常,说错误的 ELF 类,但包装器设置正确。

使用此 SDK 从比利时身份证发行商官方网站读取比利时身份证:http://eid.belgium.be/en/binaries/beid-sdk-3.5.3-ubuntu-9.10-i686-6193_tcm147-94066_tcm406-114986.tgz

$ uname -a # Using NetBeans IDE 7.3 in Ubuntu 12.10 64-bit
Linux sun-M14xR2 3.5.0-25-generic #39-Ubuntu SMP Mon Feb 25 18:26:58 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
$ java -version
java version "1.7.0_15"
OpenJDK Runtime Environment (IcedTea7 2.3.7) (7u15-2.3.7-0ubuntu1~12.10.1)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)

代码:

package javaapplication1;

import java.lang.*;
import be.belgium.eid.*;

public class JavaApplication1 {
  //*****************************************************************************
  // Get the data and dump to the screen
  // Beware: The data coming from the cards is encoded in UTF8!
  //*****************************************************************************

  private static void getSISData(BEID_SISCard card) throws Exception {
    BEID_SisId sisId = card.getID();

    System.out.println();

    System.out.println("\tPeronal data:");
    System.out.println("\t-------------");
    System.out.println("\tName                 : " + sisId.getName());
    System.out.println("\tSurname              : " + sisId.getSurname());
    System.out.println("\tInitials             : " + sisId.getInitials());
    System.out.println("\tGender               : " + sisId.getGender());
    System.out.println("\tDateOfBirth          : " + sisId.getDateOfBirth());
    System.out.println("\tSocialSecurityNumber : " + sisId.getSocialSecurityNumber());

    System.out.println();

    System.out.println("\tCard data:");
    System.out.println("\t----------");
    System.out.println("\tLogicalNumber        : " + sisId.getLogicalNumber());
    System.out.println("\tDateOfIssue          : " + sisId.getDateOfIssue());
    System.out.println("\tValidityBeginDate    : " + sisId.getValidityBeginDate());
    System.out.println("\tValidityEndDate      : " + sisId.getValidityEndDate());
  }

  //*****************************************************************************
  // Get the data from a Belgian SIS card
  //*****************************************************************************
  private static void getSISCardData(BEID_ReaderContext readerContext) throws Exception {
    BEID_SISCard card = readerContext.getSISCard();
    getSISData(card);
  }

  //*****************************************************************************
  // Get the data and dump to the screen
  // Beware: The data coming from the cards is encoded in UTF8!
  //*****************************************************************************
  private static void getEIDData(BEID_EIDCard card) throws Exception {
    BEID_EId eid = card.getID();

    if (card.isTestCard()) {
      card.setAllowTestCard(true);
      System.out.println("");
      System.out.println("Warning: This is a test card.");
    }

    System.out.println("\tDocumentVersion    : " + eid.getDocumentVersion());
    System.out.println("\tDocumentType       : " + eid.getDocumentType());

    System.out.println();

    System.out.println("\tPeronal data:");
    System.out.println("\t-------------");
    System.out.println("\tFirstName          : " + eid.getFirstName());
    System.out.println("\tSurname            : " + eid.getSurname());
    System.out.println("\tGender             : " + eid.getGender());
    System.out.println("\tDateOfBirth        : " + eid.getDateOfBirth());
    System.out.println("\tLocationOfBirth    : " + eid.getLocationOfBirth());
    System.out.println("\tNobility           : " + eid.getNobility());
    System.out.println("\tNationality        : " + eid.getNationality());
    System.out.println("\tNationalNumber     : " + eid.getNationalNumber());
    System.out.println("\tSpecialOrganization: " + eid.getSpecialOrganization());
    System.out.println("\tMemberOfFamily     : " + eid.getMemberOfFamily());
    System.out.println("\tAddressVersion     : " + eid.getAddressVersion());
    System.out.println("\tStreet             : " + eid.getStreet());
    System.out.println("\tZipCode            : " + eid.getZipCode());
    System.out.println("\tMunicipality       : " + eid.getMunicipality());
    System.out.println("\tCountry            : " + eid.getCountry());
    System.out.println("\tSpecialStatus      : " + eid.getSpecialStatus());

    System.out.println("");

    System.out.println("\tCard data:");
    System.out.println("\t----------");
    System.out.println("\tLogicalNumber      : " + eid.getLogicalNumber());
    System.out.println("\tChipNumber         : " + eid.getChipNumber());
    System.out.println("\tValidityBeginDate  : " + eid.getValidityBeginDate());
    System.out.println("\tValidityEndDate    : " + eid.getValidityEndDate());
    System.out.println("\tIssuingMunicipality: " + eid.getIssuingMunicipality());
  }

  //*****************************************************************************
  // Get the data from a Belgian kids EID card
  //*****************************************************************************
  private static void getKidsCardData(BEID_ReaderContext readerContext) throws Exception {
    BEID_KidsCard card = readerContext.getKidsCard();
    getEIDData(card);
  }

  //*****************************************************************************
  // Get the data from a Belgian foreigner EID card
  //*****************************************************************************
  private static void getForeignerCardData(BEID_ReaderContext readerContext) throws Exception {
    BEID_ForeignerCard card = readerContext.getForeignerCard();
    getEIDData(card);
  }

  //*****************************************************************************
  // Get the data from a Belgian EID card
  //*****************************************************************************
  private static void getEidCardData(BEID_ReaderContext readerContext) throws Exception {
    BEID_EIDCard card = readerContext.getEIDCard();
    getEIDData(card);
  }

  //*****************************************************************************
  // get a string representation of the card type
  //*****************************************************************************
  private static String getCardTypeStr(BEID_ReaderContext readerContext) throws Exception {
    String strCardType = "UNKNOWN";
    BEID_CardType cardType = readerContext.getCardType();

    if (cardType == BEID_CardType.BEID_CARDTYPE_EID) {
      strCardType = "BEID_CARDTYPE_EID";
    } else if (cardType == BEID_CardType.BEID_CARDTYPE_KIDS) {
      strCardType = "BEID_CARDTYPE_KIDS";
    } else if (cardType == BEID_CardType.BEID_CARDTYPE_FOREIGNER) {
      strCardType = "BEID_CARDTYPE_FOREIGNER";
    } else if (cardType == BEID_CardType.BEID_CARDTYPE_SIS) {
      strCardType = "BEID_CARDTYPE_SIS";
    } else {
      strCardType = "BEID_CARDTYPE_UNKNOWN";
    }
    return strCardType;
  }

  //*****************************************************************************
  // Show the info of the card in the reader
  //*****************************************************************************
  private static void showCardInfo(String readerName) throws Exception {
    BEID_ReaderContext readerContext = BEID_ReaderSet.instance().getReaderByName(readerName);
    if (readerContext.isCardPresent()) {
      System.out.println("\tType               : " + getCardTypeStr(readerContext));

      BEID_CardType cardType = readerContext.getCardType();

      if (cardType == BEID_CardType.BEID_CARDTYPE_EID) {
        getEidCardData(readerContext);
      } else if (cardType == BEID_CardType.BEID_CARDTYPE_KIDS) {
        getKidsCardData(readerContext);
      } else if (cardType == BEID_CardType.BEID_CARDTYPE_FOREIGNER) {
        getForeignerCardData(readerContext);
      } else if (cardType == BEID_CardType.BEID_CARDTYPE_SIS) {
        getSISCardData(readerContext);
      } else {
      }
    }
  }

  //*****************************************************************************
  // Show the reader info an get the data of the card if present
  //*****************************************************************************
  private static void showReaderCardInfo(String readerName) throws Exception {
    BEID_ReaderContext readerContext = BEID_ReaderSet.instance().getReaderByName(readerName);

    System.out.println("Reader: " + readerName);
    System.out.println("\tCard present: " + (readerContext.isCardPresent() ? "yes" : "no"));

    showCardInfo(readerName);

    System.out.println("");
  }

  //*****************************************************************************
  // scan all the card readers and if a card is present, show the content of the
  // card.
  //*****************************************************************************
  private static void scanReaders() throws Exception {
    long nrReaders = BEID_ReaderSet.instance().readerCount();
    System.out.println("Nr of card readers detected: " + nrReaders);

    for (int readerIdx = 0; readerIdx < nrReaders; readerIdx++) {
      String readerName = BEID_ReaderSet.instance().getReaderName(readerIdx);
      showReaderCardInfo(readerName);
    }
  }

  //*****************************************************************************
  // Main entry point
  //*****************************************************************************
  public static void main(String argv[]) {
    System.out.println("[Info]  eID SDK sample program: read_eid");

    String osName = System.getProperty("os.name");

    if (-1 != osName.indexOf("Windows")) {
      System.out.println("[Info]  Windows system!!");
      System.loadLibrary("beid35libJava_Wrapper");
    } else {
      System.loadLibrary("beidlibJava_Wrapper");
    }

    try {
      BEID_ReaderSet.initSDK();
      scanReaders();
    } catch (BEID_Exception e) {
      System.out.println("[Catch] BEID_Exception:" + e.GetError());
    } catch (Exception e) {
      System.out.println("[Catch] Exception:" + e.getMessage());
    }


    try {
      BEID_ReaderSet.releaseSDK();
    } catch (BEID_Exception e) {
      System.out.println("[Catch] BEID_Exception:" + e.GetError());
    } catch (Exception e) {
      System.out.println("[Catch] Exception:" + e.getMessage());
    }
  }
}

输出:

[Info]  eID SDK sample program: read_eid
Exception in thread "main" java.lang.UnsatisfiedLinkError: /home/sun/Downloads/beidsdk/beidlib/Java/unsigned/libbeidlibJava_Wrapper.so.3.5.3: /home/sun/Downloads/beidsdk/beidlib/Java/unsigned/libbeidlibJava_Wrapper.so.3.5.3: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1750)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1675)
    at java.lang.Runtime.loadLibrary0(Runtime.java:840)
    at java.lang.System.loadLibrary(System.java:1047)
    at javaapplication1.JavaApplication1.main(JavaApplication1.java:269)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

编辑:

https://code.google.com/p/eid-viewer/ https://code.google.com/p/eid-mw/

最佳答案

它不起作用,因为您使用的是 64 位版本的 Java,而您尝试使用的 SDK 包含 32 位 native 库 (libbeidlibJava_Wrapper.so.3.5.3)。 64 位 JRE 无法加载 32 位 native 库。

您需要使用 32 位版本的 Java,或找到具有 64 位 native 库的 SDK 版本。

关于java - 错误的 ELF 类 : ELFCLASS32 (Possible cause: architecture word width mismatch),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16188672/

有关java - 错误的 ELF 类 : ELFCLASS32 (Possible cause: architecture word width mismatch)的更多相关文章

  1. ruby-on-rails - Rails 常用字符串(用于通知和错误信息等) - 2

    大约一年前,我决定确保每个包含非唯一文本的Flash通知都将从模块中的方法中获取文本。我这样做的最初原因是为了避免一遍又一遍地输入相同的字符串。如果我想更改措辞,我可以在一个地方轻松完成,而且一遍又一遍地重复同一件事而出现拼写错误的可能性也会降低。我最终得到的是这样的:moduleMessagesdefformat_error_messages(errors)errors.map{|attribute,message|"Error:#{attribute.to_s.titleize}#{message}."}enddeferror_message_could_not_find(obje

  2. java - 等价于 Java 中的 Ruby Hash - 2

    我真的很习惯使用Ruby编写以下代码:my_hash={}my_hash['test']=1Java中对应的数据结构是什么? 最佳答案 HashMapmap=newHashMap();map.put("test",1);我假设? 关于java-等价于Java中的RubyHash,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/22737685/

  3. ruby-on-rails - 迷你测试错误 : "NameError: uninitialized constant" - 2

    我遵循MichaelHartl的“RubyonRails教程:学习Web开发”,并创建了检查用户名和电子邮件长度有效性的测试(名称最多50个字符,电子邮件最多255个字符)。test/helpers/application_helper_test.rb的内容是:require'test_helper'classApplicationHelperTest在运行bundleexecraketest时,所有测试都通过了,但我看到以下消息在最后被标记为错误:ERROR["test_full_title_helper",ApplicationHelperTest,1.820016791]test

  4. ruby-on-rails - 如何在 Rails View 上显示错误消息? - 2

    我是rails的新手,想在form字段上应用验证。myviewsnew.html.erb.....模拟.rbclassSimulation{:in=>1..25,:message=>'Therowmustbebetween1and25'}end模拟Controller.rbclassSimulationsController我想检查模型类中row字段的整数范围,如果不在范围内则返回错误信息。我可以检查上面代码的范围,但无法返回错误消息提前致谢 最佳答案 关键是您使用的是模型表单,一种显示ActiveRecord模型实例属性的表单。c

  5. 使用 ACL 调用 upload_file 时出现 Ruby S3 "Access Denied"错误 - 2

    我正在尝试编写一个将文件上传到AWS并公开该文件的Ruby脚本。我做了以下事情:s3=Aws::S3::Resource.new(credentials:Aws::Credentials.new(KEY,SECRET),region:'us-west-2')obj=s3.bucket('stg-db').object('key')obj.upload_file(filename)这似乎工作正常,除了该文件不是公开可用的,而且我无法获得它的公共(public)URL。但是当我登录到S3时,我可以正常查看我的文件。为了使其公开可用,我将最后一行更改为obj.upload_file(file

  6. ruby-on-rails - 错误 : Error installing pg: ERROR: Failed to build gem native extension - 2

    我克隆了一个rails仓库,我现在正尝试捆绑安装背景:OSXElCapitanruby2.2.3p173(2015-08-18修订版51636)[x86_64-darwin15]rails-v在您的Gemfile中列出的或native可用的任何gem源中找不到gem'pg(>=0)ruby​​'。运行bundleinstall以安装缺少的gem。bundleinstallFetchinggemmetadatafromhttps://rubygems.org/............Fetchingversionmetadatafromhttps://rubygems.org/...Fe

  7. ruby - #之间? Cooper 的 *Beginning Ruby* 中的错误或异常 - 2

    在Cooper的书BeginningRuby中,第166页有一个我无法重现的示例。classSongincludeComparableattr_accessor:lengthdef(other)@lengthother.lengthenddefinitialize(song_name,length)@song_name=song_name@length=lengthendenda=Song.new('Rockaroundtheclock',143)b=Song.new('BohemianRhapsody',544)c=Song.new('MinuteWaltz',60)a.betwee

  8. ruby-on-rails - 每次我尝试部署时,我都会得到 - (gcloud.preview.app.deploy) 错误响应 : [4] DEADLINE_EXCEEDED - 2

    我是Google云的新手,我正在尝试对其进行首次部署。我的第一个部署是RubyonRails项目。我基本上是在关注thisguideinthegoogleclouddocumentation.唯一的区别是我使用的是我自己的项目,而不是他们提供的“helloworld”项目。这是我的app.yaml文件runtime:customvm:trueentrypoint:bundleexecrackup-p8080-Eproductionconfig.ruresources:cpu:0.5memory_gb:1.3disk_size_gb:10当我转到我的项目目录并运行gcloudprevie

  9. ruby-on-rails - Rails 5 Active Record 记录无效错误 - 2

    我有两个Rails模型,即Invoice和Invoice_details。一个Invoice_details属于Invoice,一个Invoice有多个Invoice_details。我无法使用accepts_nested_attributes_forinInvoice通过Invoice模型保存Invoice_details。我收到以下错误:(0.2ms)BEGIN(0.2ms)ROLLBACKCompleted422UnprocessableEntityin25ms(ActiveRecord:4.0ms)ActiveRecord::RecordInvalid(Validationfa

  10. arrays - 这是 Ruby 中 Array.fill 方法的错误吗? - 2

    这个问题在这里已经有了答案:Arraysmisbehaving(1个回答)关闭6年前。是否应该这样,即我误解了,还是错误?a=Array.new(3,Array.new(3))a[1].fill('g')=>[["g","g","g"],["g","g","g"],["g","g","g"]]它不应该导致:=>[[nil,nil,nil],["g","g","g"],[nil,nil,nil]]

随机推荐