Windows Server 2008 JBoss EAP 6.3.0 上的 lookupPrintServices 看不到网络打印机

Network printer not visible to lookupPrintServices on Windows Server 2008 JBoss EAP 6.3.0

我在管理员组的 Active Directory 用户帐户下有 JBoss EAP 6.3.0 运行 作为 Windows 2008 服务。网络打印机(型号 KONICA MINOLTA 423SeriesPS)通过 RDPing 使用其帐户连接到该用户,然后通过其 \server\printerName 路径连接到打印机。该打印机也被设为该用户的默认打印机。然后我调出 JBoss 服务和我的应用程序 EAR 加载。它包含一个 WAR 文件,该文件使用 PrintServiceLookup.lookupPrintServices(null, null) 查找打印机。返回的唯一打印机是 "Microsoft XPS Document Writer"。怎么了?

更新 我在 Windows 事件查看器中发现了这个错误。似乎不太可能相关,因为在创建用户和打印机之前有很多这些,但就其价值而言:

The print spooler failed to load a plug-in module TPVMMon.dll, error code 0x7e See the event user data for context information.

事实证明,如此配置的网络打印机不会可靠地出现在从 PrinterJob.lookupPrintServicesPrintServiceLookup.lookupPrintServices() 返回的打印机列表中,至少在 Windows Server 2008 中是这样 Java 1.7。 (奇怪的是,似乎确实存在网络打印机 do 出现在本地系统以外的帐户的情况,但我还没有确定它们到底是什么。)为了得到它们为任何 Active Directory 用户可靠地显示:

  1. 转到“控制面板”的“设备和打印机”面板
  2. select "Add"
  3. 指定 "Local Printer"
  4. 指定 "Local Port"
  5. 对于端口,输入Windows网络打印机的路径
  6. 完成向导

以这种方式配置的网络打印机将始终显示。至少他们对我有用。