添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
细心的荒野  ·  NextJS | Web Meeting ...·  2 月前    · 
英俊的汤圆  ·  The Qt Console for ...·  5 月前    · 
慷慨的蚂蚁  ·  TypeScript ...·  6 月前    · 

PrintServiceLookup - Will not list all printers on a print job queue

807580 Nov 10 2009 — edited Nov 10 2009
I have a simple class that fetches all the attached printers to a Linux system (with CUPS).
It returns, correctly, list of three printers.
PrintService[] printerServiceList;
printerServiceList = PrintServiceLookup.lookupPrintServices(null, null);
for (int i = 0; i < printerServiceList.length; i++) {
      System.out.println(printerServiceList.getName());
None of the three printers are physically attached to the Linux server.
If I fire a print to Printer1 or Printer2, the jobs just remain in the queue. However, if I fire print to Printer3, +strange+ thing happens. 
*The above PrintServiceLookup code stops returning Printer2 and Printer3. It just lists Printer1 as the avilable print service.*
CUPS still shows all the three printers as available. (Restart of the VM does not help - same behavior, lists only 1 printer).
The main difference between Printer1, 2 and Printer3 is that the DeviceURI of Printer1 and Printer2 are
socket://172.x.x.1/queue1
While the deviceURI of the Printer3 is
lpd://172.x.x.8/queue3
If I remove Printer3 from the printers on CUPS, everything works fine after it.
Also, if I just change the deviceURI of Printer3 to socket://... it starts behaving normally. (Of cource, I cannot do this).
What is happening here? Why is lpd causing that printer and an unrelated Printer2 not to be return by the print API? I would tend to believe that it is a Java API bug.
Any pointers or work-arounds would be really appreciated.
Thanks,
Edited by: jaswinder_singh on Nov 10, 2009 12:27 AM