简体   繁体   English

MacOS 和 JSVC:SCARD_E_NO_SERVICE:智能卡资源管理器未运行

[英]MacOS and JSVC: SCARD_E_NO_SERVICE: The Smart card resource manager is not running

I got a JAR file that needs to run as a daemon in MacOS Sierra and I decided to use Apache Commons Daemon and JSVC for that purpose.我有一个需要在 MacOS Sierra 中作为守护程序运行的 JAR 文件,为此我决定使用 Apache Commons Daemon 和 JSVC。 I am aware that maybe JSVC is not really needed for this purpose (it seems only allows to open ports in a low range) and it is possible to achieve the same with system/launch so any help/solution with or without JSVC is appreciated.我知道为此目的可能并不真正需要 JSVC(它似乎只允许在低范围内打开端口)并且可以通过系统/启动实现相同的目标,因此任何有或没有 JSVC 的帮助/解决方案都值得赞赏。

This is how I am running the jar from the command line, and it works properly.这就是我从命令行运行 jar 的方式,它运行正常。 It opens a WebSocket connection using port 8085 and waits for an incoming connection.它使用端口 8085 打开一个 WebSocket 连接并等待传入​​连接。 Then, it connects to a smart card reader and gets some data from the card.然后,它连接到智能卡读卡器并从卡中获取一些数据。

java -cp "myjar.jar:jars/*" full_class_name

Now, when I try to run the same jar with the Apache Commons Daemon interface and JSVC, the jar starts properly and it starts listening in port 8085.现在,当我尝试使用 Apache Commons Daemon 接口和 JSVC 运行相同的 jar 时,该 jar 会正常启动并开始侦听端口 8085。

./jsvc -debug -cp commons-daemon-1.1.0.jar:myjar.jar:jars/* -cwd . -pidfile /tmp/file.pid full_class_name

The issue is that, for some reason, there is an exception when trying to connect to the smart card reader.问题是,由于某种原因,尝试连接到智能卡读卡器时出现异常。

INFORMACIÓN: WebSocket Registered apps: URLs all start with ws://localhost:8085
may 15, 2018 10:04:37 AM org.glassfish.tyrus.server.Server start
INFORMACIÓN: WebSocket server started.
LISTENING
Daemon started successfully
java_start done
Waiting for a signal to be delivered
create_tmp_file: /tmp/541.jsvc_up
jnasmartcardio.Smartcardio$EstablishContextException: jnasmartcardio.Smartcardio$JnaPCSCException: SCardEstablishContext got response 0x8010001d (SCARD_E_NO_SERVICE: The Smart card resource manager is not running.)
    at jnasmartcardio.Smartcardio$JnaTerminalFactorySpi.engineTerminals(Smartcardio.java:81)
    at javax.smartcardio.TerminalFactory.terminals(TerminalFactory.java:351)
    at apdu4j.TerminalManager.getTheReader(TerminalManager.java:228)
    at com.st.middleware.a.a.b.connect(SourceFile:24)
    at com.st.middleware.a.b.connect(SourceFile:18)
    at com.st.middleware.a.b.getCertificates(SourceFile:1024)
    at com.st.middleware.MiddlewareImpl.a(SourceFile:113)
    at com.st.middleware.MiddlewareImpl.getAuthCertificates(SourceFile:151)
    at com.st.communication.card.websocket.a.handleMessage(SourceFile:79)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)

The fact that the jar works properly when running with java -jar makes me believe that the issue is something with the configuration. jar 在使用 java -jar 运行时正常工作这一事实让我相信问题出在配置上。 Any ideas on why the service is not available using JSVC?关于为什么使用 JSVC 无法使用该服务的任何想法?

Thanks in advance.提前致谢。

I had the same exception from jnasmartcardio under Linux.我在 Linux 下的 jnasmartcardio 也有同样的例外。 My solution was a missing native library.我的解决方案是缺少本机库。 I installed pcscd and the exception was gone.我安装了 pcscd 并且异常消失了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在MacOS X上使用JSVC包装器将Java应用程序注册(安装)为服务 - How to register(install) as service java application with JSVC wrapper on MacOS X 有没有办法在 macOS 上使用智能卡连接到 GIT HTTPS 站点? - Is there a way to connect to a GIT HTTPS site using a smart card on macOS? 在用户登录之前,MacOS 上的 LaunchDaemon 服务不会运行 - LaunchDaemon service on MacOS not running until user signs in 在 macOS Mojave 上运行 osascript -e [command] 时出现奇怪的错误 - Strange error running osascript -e [command] on macOS Mojave Java智能卡-读取Scosta智能卡 - Java Smart Card - Reading Scosta Smart Card 如何停止在 macOS Big Sur 下运行的 Mosquitto 服务 - How to stop Mosquitto service running under macOS Big Sur Synology 虚拟机管理器上的 macos - macos on Synology VM manager 从正在运行的 iOS / macOS 应用程序实例(Xamarin Forms)获取资源文件夹路径的正确方法是什么 - What is the correct way to obtain the Resource folder path from the running iOS / macOS app instance (Xamarin Forms) 在 macOS 上运行的服务无法访问附加卷上的文件 - Service running on macOS cannot access files on attached volumes Mac错误创建Android项目 - “项目中运行构建器'Android资源管理器'的错误” - Mac Error Create Android Project - “Errors running builder 'Android Resource Manager' on project”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM