Пытаюсь разработать приложение Java для чтения данных от Honeywell YJ-HF500. Я установил драйверы и «Interme c Scan Engine SDK (версия 1.6)». Я использую образец (ScannerSample. java) из него, но при попытке открыть сканер программно возникает ошибка. Утилита проверки JavaPOS от Honeywell_JavaPOS_Suite работает хорошо.
ОС: Windows 10 x64 с Liberica JDK11. Сканер находится в режиме COM-порта.
Ошибка stacktrace:
jpos.JposException: Could not connect to service with logicalName = YJHF500: Exception.message=com.honeywell.jpos.HHPJposServiceInstanceFactory
at jpos.loader.simple.SimpleServiceConnection.connect(Unknown Source)
at jpos.BaseJposControl.open(Unknown Source)
at sample.ScannerSampleFrame.open(ScannerSample.java:352)
at sample.ScannerSampleFrame$2.actionPerformed(ScannerSample.java:184)
at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279)
at java.desktop/java.awt.Component.processMouseEvent(Component.java:6632)
at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
at java.desktop/java.awt.Component.processEvent(Component.java:6397)
at java.desktop/java.awt.Container.processEvent(Container.java:2263)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5008)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4840)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4840)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Java метод:
void open()
{
System.setProperty(JposPropertiesConst.JPOS_POPULATOR_FILE_PROP_NAME, "D:\\repos\\barcode-scanner\\src\\jpos.xml");
try
{
scanner.open("YJHF500");
deviceEnableCheckBox.setSelected(false);
enabled = false;
dataEventEnabledCheckBox.setSelected(false);
decodeDataCheckBox.setSelected(false);
freezeEventsCheckBox.setSelected(false);
autoDisableCheckBox.setSelected(false);
}
catch(JposException e)
{
e.printStackTrace();
processJposException(e);
}
}
build.gradle
plugins {
id 'java'
}
group 'org.example'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
implementation files("lib/jpos113.jar");
implementation files("lib/xerces.jar");
implementation files("lib/IntermecService113.jar");
testCompile group: 'junit', name: 'junit', version: '4.12'
}
jpos. xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE JposEntries PUBLIC "-//JavaPOS//DTD//EN"
"jpos/res/jcl.dtd">
<JposEntries>
<!--Saved by JavaPOS jpos.config/loader (JCL) version 2.2.0 on 07.05.2020, 13:16-->
<JposEntry logicalName="YJHF500">
<creation factoryClass="com.honeywell.jpos.HHPJposServiceInstanceFactory" serviceClass="com.honeywell.jpos.scanner.ScannerService"/>
<vendor name="Honeywell" url="www.honeywell.com"/>
<jpos category="Scanner" version="1.14"/>
<product description="Honeywell JPOS Service Driver, (c) 2019 Honeywell, Inc." name="Honeywell Products, Inc. Services for JavaPOS(TM) Standard" url="www.honeywell.com"/>
<!--Other non JavaPOS required property (mostly vendor properties and bus specific properties i.e. RS232 )-->
<prop name="DECODE_GS1_LTD" type="Integer" value="0"/>
<prop name="GOODSCANCOUNT" type="Integer" value="2"/>
<prop name="MAXIMUMTIMEOUT" type="String" value="300000"/>
<prop name="AUTO_RESYNCH" type="Integer" value="0"/>
<prop name="LOGFILE" type="String" value=""/>
<prop name="DebugType" type="String" value=""/>
<prop name="ClearLogFile" type="String" value="False"/>
<prop name="FWDebugFile" type="String" value=""/>
<prop name="deviceName" type="String" value="YJHF500"/>
<prop name="FWDebugLevel" type="Integer" value="1"/>
<prop name="DEVICE_POLL_FREQUENCY" type="Long" value="2000"/>
<prop name="LogServiceFile" type="String" value=""/>
<prop name="FWDebugType" type="Integer" value="0"/>
<prop name="SCANDATAOPTION_01" type="Integer" value="0"/>
<prop name="autodetect" type="String" value="True"/>
<prop name="CombinedSDKLog" type="String" value="True"/>
<prop name="Manufacturer" type="String" value="Honeywell"/>
<prop name="Port" type="String" value="COM1"/>
<prop name="COMMANDTIMEOUT" type="String" value="10000"/>
<prop name="CLAIMTIMEOUT_0" type="Integer" value="500"/>
<prop name="NoOfBackupFiles" type="String" value="0"/>
<prop name="LogFileSize" type="String" value="10240"/>
<prop name="FWProtocolFile" type="String" value=""/>
<prop name="SDKDebugLevel" type="Integer" value="0"/>
</JposEntry>
</JposEntries>