Java小程序无法找到JavaPOS的配置文件 [英] Java applet can't find JavaPOS configuration files

查看:877
本文介绍了Java小程序无法找到JavaPOS的配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个使用JavaPOS应用与用户的本地系统上的支付终端进行通信的小程序。

I've created an applet that uses JavaPOS to communicate with a payment terminal on the user's local system.

在从Eclipse IDE中运行,小程序工作正常,但不是当在浏览器中运行。在浏览器中,小程序似乎无法找到初级专业人员/ RES / jpos.properties和jposxml.cfg文件。

When run from within the Eclipse IDE, the applet works fine, but not when run in a browser. In a browser, the applet can't seem to find the jpos/res/jpos.properties and jposxml.cfg files.

在下面的语句是在执行小程序(在start()方法,而不是的init()):

When the following statements are executed in the applet (in the start() method, not init()):

JposEntryRegistry registry = JposServiceLoader.getManager().getEntryRegistry();
registry.load();

这是输出我在Java控制台窗口中看到:

this is the output I see in the Java console window:

jpos/res/jpos.properties file not found
jpos/res/jpos.properties file not found
jpos/res/jpos.properties file not found

和没有条目在JposEntry注册表加载。

And no entries are loaded in the JposEntry registry.

我试过下面让小程序看到的两个文件:

I've tried the following to get the applet to "see" the two files:


  1. 初级专业人员/ RES / jpos.properties已经是present由小应用程序所引用的罐子之一。不过,我已经添加了这个文件,applet的主要罐子。我也试着将它添加到目录中包含的罐子(用正确的相对路径)在服务器上。这一切都不工作。

  1. jpos/res/jpos.properties is already present in one of the jars referenced by the applet. Nevertheless, I've added this file to the applet's main jar. I've also tried adding it to the directory on the server containing the jars (with the correct relative path). None of this works.

我可以解决无法jpos.properties的通过与适当的值设置系统属性,像这样的发现:

I can work around the inability of jpos.properties to be found by setting System properties with the appropriate values, like this:

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");

然而,小程序仍然无法找到jposxml.cfg。此文件是applet的主jar文件的根目录present。我在同一个目录中的罐子试图把在服务器上。我也尝试创建一个只包含jposxml.cfg一个单独的jar文件,但这并不能工作。我得到在Java控制台窗口中下面的输出:

However, the applet still can't find jposxml.cfg. This file is present in the root of the applet's main jar file. I've tried putting on the server in the same directory as the jars. I've also tried creating a separate jar file containing only jposxml.cfg, but that doesn't work either. I get the following output in the Java console window:

[AbstractRegPopulator]getPopulatorFileIS(): populatorFileName=jposxml.cfg
[JposServiceLoader]manager.getEntryRegistry().load() OK
[AbstractRegPopulator]getPopulatorFileIS(): populatorFileName=jposxml.cfg

但是JposEntries的列表为空。其结果是小程序不能与付款终端通信

But the list of JposEntries is empty. As a result the applet can't communicate with the payment terminal.

该小程序是通过JNLP文件(并通过扩展JNLP所有需要的jar)加载。这两个JNLP文件已安全设置为<所有的权限/取代。所有的罐子都用相同的证书签名。同样的code完美的作品在Eclipse中。对这个问题是什么想法?

The applet is loaded via a JNLP file (and all required jars via a JNLP extension). Both JNLP files have security set to <all-permissions/>. All jars are signed with the same certificate. The same code works perfectly in Eclipse. Any ideas on what the problem is?

推荐答案

这是任何人都面临着类似问题的参考。

This is for the reference of anyone facing a similar problem.

我无法得到的时候,JavaPOS code看到jpos.properties文件,但装载值到系统属性上述作品所描述的,所以我会与坚持现在。

I couldn't get the JavaPOS code to see the jpos.properties file, but loading the values into System properties as described above works, so I'll stick with that for now.

要具有JavaPOS的负载jpos.xml或jposxml.cfg从一个URL,你需要设置该属性jpos.config.populatorFileURL而不是jpos.config.populatorFile。这可以在jpos.properties进行设置,或做不到这一点,作为一个系统属性。

To have JavaPOS load jpos.xml or jposxml.cfg from a URL, you need to set the property jpos.config.populatorFileURL and not jpos.config.populatorFile. This can be set either in jpos.properties, or failing that, as a System property.

这篇关于Java小程序无法找到JavaPOS的配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆