【问题标题】:Include jpos.xml包括 jpos.xml
【发布时间】:2012-06-12 10:36:17
【问题描述】:

我正在制作 POS 系统,现在我正在尝试设置 pos 打印机 epson tm-t20。当我尝试打开端口时,打印机在哪里,我收到以下错误消息:

jpos.JposException: Could not connect to service with logicalName = POSPrinter: Exception.message=Could not create service instance. at jpos.loader.simple.SimpleServiceConnection.connect(Unknown Source) at jpos.BaseJposControl.open(Unknown Source) at tisk.Step1Frame.processWindowEvent(Step1Frame.java:83) at java.awt.Window.processEvent(Window.java:2009) at java.awt.Component.dispatchEventImpl(Component.java:4861) at java.awt.Container.dispatchEventImpl(Container.java:2287) at java.awt.Window.dispatchEventImpl(Window.java:2719) at java.awt.Component.dispatchEvent(Component.java:4687) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:703) at java.awt.EventQueue.access$000(EventQueue.java:102) at java.awt.EventQueue$3.run(EventQueue.java:662) at java.awt.EventQueue$3.run(EventQueue.java:660) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87) at java.awt.EventQueue$4.run(EventQueue.java:676) at java.awt.EventQueue$4.run(EventQueue.java:674) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:673) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139) at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)

我已经生成了 jpos.xml,但是我不知道应该把它放到项目中的什么地方..

【问题讨论】:

  • 确保所有的 dll 文件也被添加。我有同样的问题,从 java/jre/bin 添加更多的 dll 文件解决了这个问题

标签: java epson thermal-printer jpos


【解决方案1】:

文件可以放在任何地方,但最好从根目录开始。 /* 如果要将 jpos.xml 文件放在本地文件系统的其他位置,请取消注释 下一行并指定 jpos.xml 的完整路径。

 If you want to place the jpos.xml file on a webserver for access over the internet then uncomment
 the second System.setProperty line below and specify the full URL to jpos.xml.
 */

System.setProperty( JposPropertiesConst.JPOS_POPULATOR_FILE_PROP_NAME, "jpos.xml");

System.setProperty(JposPropertiesConst.JPOS_POPULATOR_FILE_URL_PROP_NAME, "http://some-where-remote.com/jpos.xml");

错误尝试添加这个

  System.setProperty("jpos.loader.serviceManagerClass", "jpos.loader.simple.SimpleServiceManager");
  System.setProperty("jpos.config.populatorFile", "jposxml.cfg");
  System.setProperty("jpos.util.tracing.TurnOnNamedTracers", "JposServiceLoader,SimpleEntryRegistry,SimpleRegPopulator,XercesRegPopulator");
  System.setProperty("jpos.util.tracing.TurnOnAllNamedTracers", "ON");

【讨论】:

  • 感谢您的回复。我终于发现,这个异常是由于 java pos 和 jre7 之间的不兼容造成的。当我将其更改为 6 时,我能够打开该端口。
  • 听起来更像是一个 ext jar 冲突。当环境中有多种设备时,可能会发生这种情况。
猜你喜欢
  • 2019-01-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多