JDK-8058316 : lookupDefaultPrintService returns null on Solaris 11 when default printer is set using lpoptions command
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 7u45,8,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_11
  • CPU: unknown
  • Submitted: 2014-09-12
  • Updated: 2021-03-26
  • Resolved: 2016-03-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u121Fixed 9 b110Fixed
Related Reports
Duplicate :  
Description
On some Solaris 11 hosts lookupDefaultPrintService() returns null while lpstat -d reports an ipp printer.
lookupPrintServices(null, null) returns one service.

I have several identical Solaris 11 machines, all configured to use the same CUPS printer on  a remote host.
I don't understand where configuration is stored on this system; /etc/cups/printers.conf is empty on the machines.  lpstat reports the service, and it is default and active from the point of view of lpstat. Printer is visible from localhost:631 and may be used to print a test page etc. It was set as a default by a call  "lpoptions -d printername".

Attempt to set the printer as a server default from WEB interface fails with a message to the effect of "you should access this page via certain URL not on your localhost".
Comments
The issue was caused by the fact that CUPSPrinter.java#getDefaultPrinter() searches for server-defined default destination by connecting to CUPS server but if the user sets the default printer using "lpoptions -d <printername>" command, server will not have any knowledge of this settings and this user-set default printer (which is stored in ~/.cups/lpoptions file) was not searched and getDefaultPrinter() returns null since it could not find any server default printer. Fix is to call cupsGetDest API to search for a lpoptions-defined default printer and if not set, then search for server-defined destination.
03-03-2016

> They have some jdk8 under test on that machine. It doesn't see that printer. I can believe it does not see your "default" setting. It is also possible that even if this maps to a valid "ipp" printer resource and you try to see if that printer exists at all (regardless of the default setting), that it may not be found properly because I think there may be a separate open bug relating to properly handing ipp URIs. We may have (tried to) fix some of that but I also cannot say off-hand if it is backported to 8. We should see if we can debug & test on that actual system once it is not being actively used.
25-02-2016

The host has different ssh key now and seems to be updated since 2014. It doesn't have default printer set anymore. I guess my setup changes are lost as well. lpstat -v reports the same device though. I have rather restricted access to it now and will try to find some empty time there and/or a similar less loaded host. Perhaps the interesting part is that printer is printername: ipp://some_other_solaris11_2_host:631/printers/thesameprintername and not a dedicated device like that ricoh. And we need setup data from that another machine too.
24-02-2016

Is there anything in ~/.cups ? Does the problem still reproduce as before ? cups docs indicate that it uses ~.cups/lpoptions : http://www.cups.org/documentation.php/man-lpoptions.html and this seems like it must store something in your user-specific location else I don't see how it has any effect.
24-02-2016

http://www.cups.org/documentation.php/man-lpoptions.html Can you share your /etc/cups/lpoptions or ~/.cups/lpoptions file? what CUPS version you are using? Also, what are the files you have in ~/cups/ directory? Also, what is the exact command you passed in "lpoptions -d printername" so that I can do the same in my m/c.
23-02-2016

I am not able to reproduce this problem in my solaris 11.2 system with jdk9 prasanta@solaris-prasanta:~/jdk9/client/build/solaris-x86_64-normal-server-fastdebug$ ./jdk/bin/java LUS IPP Printer : Ricoh-Aficio-MP-5000B prasanta@solaris-prasanta:~/jdk9/client/build/solaris-x86_64-normal-server-fastdebug$ lpstat -d system default destination: Ricoh-Aficio-MP-5000B prasanta@solaris-prasanta:~/jdk9/client/build/solaris-x86_64-normal-server-fastdebug$ ./jdk/bin/java -version java version "1.9.0-internal-fastdebug" Java(TM) SE Runtime Environment (build 1.9.0-internal-fastdebug-prasanta_2015_10_12_11_51-b00) Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-internal-fastdebug-prasanta_2015_10_12_11_51-b00, mixed mode) ==================== Even with jdk8, it passed prasanta@solaris-prasanta:~/jdk9/client/build/solaris-x86_64-normal-server-fastdebug$ /opt/jdk1.8.0_60/bin/java LUS IPP Printer : Ricoh-Aficio-MP-5000B
05-11-2015

Should be applicable to 8 but I'm not sure about 6. 7u45 was the stable JDK running sniffers on aurora hosts (and having this issue) but as to 6, I didn't try.
04-02-2015

Is it applicable to JDK 6-8?
03-02-2015

Apparetly there is a default printer :- sca00bjk% lpstat -d system default destination: ussj866116bdbl But we aren't reporting it :- } sca00bjk% jdk1.9.0/bin/java -version java version "1.9.0-ea" Java(TM) SE Runtime Environment (build 1.9.0-ea-b30) Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b30, mixed mode) more LUS.java import javax.print.*; public class LUS { public static void main(String args[]) { System.out.println(PrintServiceLookup.lookupDefaultPrintService()); } jdk1.9.0/bin/java LUS null Possibly there is an issue with CUPS handling on Solaris ?
17-09-2014