Ubuntu

Printing from Java does not work at all with cups > 1.2

Reported by Alex Grönholm on 2007-10-23
66
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cups (Debian)
Fix Released
Unknown
cupsys (Ubuntu)
Undecided
Unassigned
Nominated for Hardy by Brad Langhorst
sun-java5 (Baltix)
Undecided
Unassigned
sun-java5 (Ubuntu)
Undecided
Unassigned
Nominated for Hardy by Brad Langhorst
sun-java6 (Debian)
Fix Released
Unknown
sun-java6 (Ubuntu)
Undecided
Unassigned
Nominated for Hardy by Brad Langhorst

Bug Description

Binary package hint: sun-java6-bin

Printing from Java applications is completely broken in Gutsy. Not even the print dialog will open. Attempting to print from Eclipse causes it to crash. Swing based applications will just display some other errors (one of them saying simply "null attribute"). Printing from native applications works.
A similar bug was reported earlier at https://bugs.launchpad.net/ubuntu/+source/sun-java5/+bug/86970 but it refers to the bug in Feisty that has already been fixed.

wax (ewax) wrote :

I tested java 5 and 6 and in both cases printing won't work (both in gutsy).
i tried installing icedtea but the webapplet does not even want to start in there.

Christian Lins (cli) wrote :

Printing itself seems working if you print "blind" without showing any printing dialog.

arno_b (arno.b) wrote :

I confirm with jdk1.5.0_13-b05, 1.6.0_02-b05 and 1.7.0-ea-b15.
It worked on Feisty but no more on Gusty.

See also: https://bugs.launchpad.net/ubuntu/+source/cupsys/+bug/156776

Miguel Costa (seyon) wrote :

Yes, i can confirm that too

arno_b (arno.b) on 2007-10-28
Changed in sun-java6:
status: New → Confirmed
adam.hawthorne (adam-hawthorne) wrote :

It appears this has to do with CUPS_DEFAULT_DOMAINSOCKET #define being enabled in cups. As a workaround, you might try adding the environment variable CUPS_SERVER=localhost before running your Java application.

Alex Grönholm (agronholm) wrote :

That setting didn't fix the problem. Here's what happens when a Java application tries to open a print dialog:

...
Caused by: java.lang.NullPointerException: null attribute
        at sun.print.IPPPrintService.isAttributeValueSupported(IPPPrintService.java:1147)
        at sun.print.ServiceDialog$OrientationPanel.updateInfo(ServiceDialog.java:2121)
        at sun.print.ServiceDialog$PageSetupPanel.updateInfo(ServiceDialog.java:1263)
        at sun.print.ServiceDialog.updatePanels(ServiceDialog.java:437)
        at sun.print.ServiceDialog.initPrintDialog(ServiceDialog.java:195)
        at sun.print.ServiceDialog.<init>(ServiceDialog.java:124)
        at javax.print.ServiceUI.printDialog(ServiceUI.java:188)
        at sun.print.RasterPrinterJob.printDialog(RasterPrinterJob.java:855)
        at sun.print.PSPrinterJob.printDialog(PSPrinterJob.java:421)
...

arno_b (arno.b) wrote :

Like Alex, I still have the problem with the same generated exception.

MrTux (sstrickroth) wrote :

See also: https://bugs.launchpad.net/ubuntu/+source/sun-java6/+bug/86970

This is a major problem! Lots of ppl have it and the workaround which worked on feisty, doesn't work any more on gutsy.

larsk (larsk8) wrote :

I have the exact same problem in gutsy.

steve. (launchpad-coles) wrote :

Miguel Costa has posted a workaround in https://bugs.launchpad.net/ubuntu/+source/cupsys/+bug/156776
"With cupsys 1.2.8-0ubuntu8 i can print without problems"

In Synaptic I added the Feisty main repository, reloaded, searched for cupsys selected it then selected Package > Force Version and downgraded to the 1.2.8 version. Then Selected Package > Lock version to stop it upgrading and breaking again.

Now printing from Java works again in Gutsy :)

Ted Carnahan (tedcarnahan) wrote :

Confirm: steve's workaround works for me in Gutsy. Thanks.

Yan Li (yanli) wrote :
Download full text (5.3 KiB)

I observed same problem on my Gutsy 7.10 installation. The printing of Java applications doesn't work. It's a rather annoying problem.

System: x86 on a IBM ThinkPad T43p.

How to reproduce: Open any Java program (I tried Freemind and some others) and try to print.

Expect: Printing dialog appear on GUI

Actual: Nothing happens on GUI (no error message), however, I found following exception text appeared on console:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: null attribute
        at sun.print.IPPPrintService.isAttributeValueSupported(IPPPrintService.java:1147)
        at sun.print.ServiceDialog$OrientationPanel.updateInfo(ServiceDialog.java:2121)
        at sun.print.ServiceDialog$PageSetupPanel.updateInfo(ServiceDialog.java:1263)
        at sun.print.ServiceDialog.updatePanels(ServiceDialog.java:437)
        at sun.print.ServiceDialog.initPrintDialog(ServiceDialog.java:195)
        at sun.print.ServiceDialog.<init>(ServiceDialog.java:124)
        at javax.print.ServiceUI.printDialog(ServiceUI.java:188)
        at sun.print.RasterPrinterJob.printDialog(RasterPrinterJob.java:855)
        at sun.print.PSPrinterJob.printDialog(PSPrinterJob.java:421)
        at freemind.controller.Controller$PrintAction.actionPerformed(Controller.java:870)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
        at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
        at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1216)
        at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1257)
        at java.awt.Component.processMouseEvent(Component.java:6038)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
        at java.awt.Component.processEvent(Component.java:5803)
        at java.awt.Container.processEvent(Container.java:2058)
        at java.awt.Component.dispatchEventImpl(Component.java:4410)
        at java.awt.Container.dispatchEventImpl(Container.java:2116)
        at java.awt.Component.dispatchEvent(Component.java:4240)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
        at java.awt.Container.dispatchEventImpl(Container.java:2102)
        at java.awt.Window.dispatchEventImpl(Window.java:2429)
        at java.awt.Component.dispatchEvent(Component.java:4240)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispat...

Read more...

Yan Li (yanli) wrote :

To moderator: sorry that I added "sun-java5 (Baltix)" for mistake, please remove it. Thanks!

Yan Li (yanli) wrote :

Wrong package, should be for Ubuntu.

Changed in sun-java5:
status: New → Invalid
Gary Mansell (garymansell) wrote :

Any ideas when this is likely to be fixed?

Andrew J. Lazarus (drlaz) wrote :

Steve's downgrade also works in Fedora 8, except AFAIK the downgrade must be accomplished by hand with rpm. I'm also not aware of how to keep F8 from trying to "upgrade" cups, except clearing the checkbox whenever it asks me to do so.

I'm leaving this comment for the googlers trying, like me, to solve this problem. I'm amazed it seems like such a low priority for Sun.

Trinh Phuoc Thai (thai-trinh) wrote :

The problem is Java & Cups is not understand together. You can have it work by specifying the Orientation in every printers in Cups

System -> Printing

For each printer select Job Options tab and specify Orientation to whatever else instead of "Automatic Rotation".

jhasz (jhasz) wrote :

Trinh,

Thanks for that very simple work around. And timely, too. You posted that about 40 minutes before I found it.

Simple. Is it the best solution? or a fix? not really. Java should be able to handle the "Automatic" Orientation somehow. But personally I think it's an easy, and good solution.

Xijiang (miaoxj) wrote :

confirm Trinh's method.

Thanks!

Trinh's solution does not work for cups1.3 in hardy with java 1.6.

Here's what I tried with no success:

- echo "ServerName" > /etc/cups/client.conf
- changing orientation of local PDF printer
- removing any "-" characters in printer names

if this also affects you, vote for the bug at
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6633656

brad

Tom V (tvice) wrote :

Trinh's fix worked for me and an app called Moneydance. Thanks!!!!!!!!!!!!!!! This has bothered me for months.

Tom V (tvice) wrote :

I have a similar problem in Dapper with Java 1.6 and no page orientation option in the printer applet. Printing gets to the queue and then there is a job stopped error.

Geoff J (geoff-jankowski) wrote :

I can also confirm Trinh's method, at least for printing direct from OpenProj. However when I try to use the embedded java report generator it does not work. It bring up the printer dialog and sends data to my (HP 4050) printer but nothing prints.

I can work around it laboriously by printing to PDF then opening in Adobe and printing the sheet but it is then necessary to rename the file or delete it as OpenProj tries to save the next output wiht the smae file name Java_Printing.pdf and cannot overwrite as it does not have the permissions.

Ho hum. I guess 50% printing is better than none at all!

I hope they sort this out quickly as does little to make me want to swap to use OpenProj at the moment.

Ks (kstan79) wrote :

Hi, Unfortunately my printer still can't print from out.
The print dialog box appear, no error message displayed, but I the document still didn't print out. And the document not under print queue as well.
*All kind of Java application can't print.
Any help is greatly appreciated.

dmoyne (dmoyne-aliceadsl) wrote :

I have the same problem in gutsy and JDK jdk1.6.0_10 but also when using jdk 1.5* ; in Eclipse the printer is shadowed and other Java application supposed to propose a printer icon in a window to print window content does not display the printer icon !

Trinh Phuoc Thai's workaround worked for me on Kubuntu Gutsy, but I only have 3 printers which needed. This is not suitable for installations with large numbers of printers. I can't believe SUN let this bug stand for so long. Actually, I can. Proprietary products have this kind of track record. I'm on pins and needles waiting for the first fully complete Free version of Java.

Tony Schmidt (tony-yekibud) wrote :

I can also confirm Trinh's work-around on Gutsy - after re-starting X. This and Javaws not available for 64-bit and other Java issues make me not want to use Java or Java based tools at all.

Cristiano (crixtiano) wrote :

> You can have it work by specifying the Orientation in every printers in Cups
> System -> Printing
> For each printer select Job Options tab and specify Orientation to whatever else instead of "Automatic Rotation".
>

I comfirm Trinh Phuoc Thai is right.

I follow his instructions and now Java 6 executes Print Dialog.

Cristiano

Matthias Klose (doko) wrote :

please could you recheck with sun-java6 (b09) in hardy?

Matthias Klose wrote:
> please could you recheck with sun-java6 (b09) in hardy?
>
>
I've been following the JRE release notes, and nothing in there suggests
that this issue has been fixed.

James Stansell (jamesstansell) wrote :

> I've been following the JRE release notes, and nothing in there suggests
> that this issue has been fixed.

How about http://bugs.sun.com/view_bug.do?bug_id=6633656 and http://blogs.sun.com/darcy/entry/openjdk_6_sources_for_b09 ?

Does openjdk-6 (6b09-0ubuntu2) correct this for you?

Alex Grönholm (agronholm) wrote :

James Stansell wrote:
>> I've been following the JRE release notes, and nothing in there suggests
>> that this issue has been fixed.
>>
>
> How about http://bugs.sun.com/view_bug.do?bug_id=6633656 and
> http://blogs.sun.com/darcy/entry/openjdk_6_sources_for_b09 ?
>
> Does openjdk-6 (6b09-0ubuntu2) correct this for you?
>
>
According to the bug entry, the fix will be included in Sun JDK 6b10
which hasn't been released yet and as such won't be in ubuntu 8.04.
However, OpenJDK indeed seems to have this fix in b09 already so yay for
that.

Brad Langhorst wrote on 2008-01-20
>Trinh's solution does not work for cups1.3 in hardy with java 1.6.
I can confirm that.

In my particular environment, I'm not able to use openjdk which has been said to include the fix already (the java app seems incompatible, complaining about certificates), neither can use java 1.4.2 because it will simply crash firefox 3 - so this is a major blocker for me.

>if this also affects you, vote for the bug at
>http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6633656

Looks like there is a release 10 build 22 which includes the fix already - If this information is true, would it be possible to bump the sun-java6 version to include this fix?

Thanks,

 -Klaus

hede (michael-heide) wrote :

I had the same problem (no print dialog in freemind in hardy 8.04, sun-java6 build 1.6.0_06-b02/10.0-b22).
I changed the rotation to portrait and made one printer the default printer.
Printing works fine now in freemind.

Greek Ordono (grexk) wrote :

This is already fix in openjdk-6-jre in hardy.

Alex Grönholm (agronholm) wrote :

Greek Ordoño kirjoitti:
> This is already fix in openjdk-6-jre in hardy.
>
>
Until a fixed version of Sun's JDK is released for Ubuntu, this bug
should stay open.

Patricio (patricio-stwing) wrote :

I have the same problem (no print dialog in freemind in hardy 8.04, sun-java6 ).

Patricio (patricio-stwing) wrote :

Should I use openjdk-6-jre? After installing it. Do I have to uninstall Sun's JDK? How do I inform Freemind to use openjdk-6-jre?
Thanks!
Patricio

Confirming that in Hardy (kubuntu, kde 3.5.9)
using Sun's JRE 1.6.0_06 downloaded from the repositories
and running as usr/lib/jvm/java-6-sun/jre/bin/java
that attempting to print from:
. jedit causes:
        java.lang.NullPointerException: null attribute
 at sun.print.IPPPrintService.isAttributeValueSupported(IPPPrintService.java:1147)
. PDFStudio causes the cleaner:
        error printing document
        null attribute

I should add to the above:
. jarnal causes
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: null attribute

and that the
  CUPS_SERVER=localhost
workaround makes no difference.

In all cases simply pressing 'print' causes the above messages.

Elin3t (elin3t) wrote :
Download full text (10.9 KiB)

i do "dmeg" and this was...
[ 4218.503316] audit(1217623441.859:3): type=1503 operation="inode_permission" requested_mask="::r" denied_mask="::r" name="/var/run/samba/gencache.tdb" pid=11132 profile="/usr/sbin/cupsd" namespace="default"
[ 4218.503874] audit(1217623441.859:4): type=1503 operation="inode_permission" requested_mask="::r" denied_mask="::r" name="/var/run/samba/gencache.tdb" pid=11132 profile="/usr/sbin/cupsd" namespace="default"
[ 4218.581201] audit(1217623441.934:5): type=1503 operation="inode_permission" requested_mask="::rw" denied_mask="::rw" name="/dev/tty" pid=11138 profile="/usr/sbin/cupsd" namespace="default"
[ 4218.922452] audit(1217623442.278:6): type=1503 operation="inode_permission" requested_mask="::r" denied_mask="::r" name="/var/run/samba/unexpected.tdb" pid=11132 profile="/usr/sbin/cupsd" namespace="default"
[ 4219.014391] audit(1217623442.371:7): type=1503 operation="inode_permission" requested_mask="::r" denied_mask="::r" name="/var/run/samba/unexpected.tdb" pid=11132 profile="/usr/sbin/cupsd" namespace="default"
[ 4219.106317] audit(1217623442.463:8): type=1503 operation="inode_permission" requested_mask="::r" denied_mask="::r" name="/var/run/samba/unexpected.tdb" pid=11132 profile="/usr/sbin/cupsd" namespace="default"
[ 4219.106368] audit(1217623442.463:9): type=1503 operation="inode_permission" requested_mask="::r" denied_mask="::r" name="/var/run/samba/gencache.tdb" pid=11132 profile="/usr/sbin/cupsd" namespace="default"
[ 4219.188754] audit(1217623442.543:10): type=1503 operation="inode_permission" requested_mask="::r" denied_mask="::r" name="/var/run/samba/gencache.tdb" pid=11132 profile="/usr/sbin/cupsd" namespace="default"
[ 4219.188778] audit(1217623442.543:11): type=1503 operation="inode_permission" requested_mask="::r" denied_mask="::r" name="/var/run/samba/gencache.tdb" pid=11132 profile="/usr/sbin/cupsd" namespace="default"
[ 4219.334153] audit(1217623442.691:12): type=1503 operation="inode_permission" requested_mask="::r" denied_mask="::r" name="/var/run/samba/unexpected.tdb" pid=11132 profile="/usr/sbin/cupsd" namespace="default"
[ 4219.425082] audit(1217623442.782:13): type=1503 operation="inode_permission" requested_mask="::r" denied_mask="::r" name="/var/run/samba/unexpected.tdb" pid=11132 profile="/usr/sbin/cupsd" namespace="default"
[ 4219.517011] audit(1217623442.874:14): type=1503 operation="inode_permission" requested_mask="::r" denied_mask="::r" name="/var/run/samba/unexpected.tdb" pid=11132 profile="/usr/sbin/cupsd" namespace="default"
[ 4219.517058] audit(1217623442.874:15): type=1503 operation="inode_permission" requested_mask="::r" denied_mask="::r" name="/var/run/samba/gencache.tdb" pid=11132 profile="/usr/sbin/cupsd" namespace="default"
[ 4237.718154] audit(1217623461.087:16): type=1503 operation="inode_permission" requested_mask="::r" denied_mask="::r" name="/var/run/samba/gencache.tdb" pid=11149 profile="/usr/sbin/cupsd" namespace="default"
[ 4237.718194] audit(1217623461.087:17): type=1503 operation="inode_permission" requested_mask="::r" denied_mask="::r" name="/var/run/samba/gencache.tdb" pid=11149 profile="/usr/sbin/cupsd" namespace="default"
[ 4237.864755] audit(1217623461.23...

viktara (vik-propco) wrote :

Confirmed in Ubuntu Hardy with both Sun Java (6_06) and OpenJDK (6_11) trying to print from Jasper Reports Viewer.

Confirmed that setting the orientation as mentioned above provides a workaround in my case.

aurorius (aurorius) wrote :

Most of the solutions required you to change the setting using a GUI, for Linux who uses window managers such as Openbox or Fluxbox, can refer to http://www.pikopong.com/blog/2008/09/09/java-printing-fix-for-linux-with-cups/ for solution

Wizkid (jherod) wrote :

When I downgrade I get a error in the console. But If I reboot and print with java everything works except when I try to install another program I get the same error over and over again. I have filed a bug here>> https://bugs.launchpad.net/ubuntu/+source/cupsys/+bug/268972

Léo Studer (leo-studer) wrote :

I' using Java OpenJDK:

$ java -version
java version "1.6.0_0"
IcedTea6 1.4 (6b14~pre1-0ubuntu2~intrepid1) Runtime Environment (build 1.6.0_0-b14)
OpenJDK 64-Bit Server VM (build 11.0-b17, mixed mode)

And I have this issue occuring with Matlab when I'm trying to print:

java.lang.NullPointerException: null attribute
 at sun.print.IPPPrintService.isAttributeValueSupported(Unknown Source)
 at sun.print.ServiceDialog$OrientationPanel.updateInfo(Unknown Source)
 at sun.print.ServiceDialog$PageSetupPanel.updateInfo(Unknown Source)
 at sun.print.ServiceDialog.updatePanels(Unknown Source)
 at sun.print.ServiceDialog.initPrintDialog(Unknown Source)
 at sun.print.ServiceDialog.<init>(Unknown Source)
 at javax.print.ServiceUI.printDialog(Unknown Source)
 at com.mathworks.page.export.printdlg.Printdlg.setVisible(Printdlg.java:470)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at com.mathworks.jmi.AWTUtilities$Invoker$2.runWithOutput(AWTUtilities.java:432)
 at com.mathworks.jmi.AWTUtilities$Invoker$1.run(AWTUtilities.java:389)
 at java.awt.event.InvocationEvent.dispatch(Unknown Source)
 at java.awt.EventQueue.dispatchEvent(Unknown Source)
 at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
 at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
 at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
 at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
 at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
 at java.awt.EventDispatchThread.run(Unknown Source)

i'm using Ubuntu 8.04 (Hardy Heron), and the only work around that works for me is the one described by aurorius. basically, i couldn't find the "Job Options" tab. either i'm stupid, or else it is changed in my version of CUPS (which is 1.3.7-1ubuntu3).

you can read my long description of the bug and fix here:

    http://ubuntuforums.org/showpost.php?p=6858372&postcount=10

but all of this information is included above, or in references cited by the above listings. but i'll summarize the fix cited above:

i'm using Ubuntu 8.04 (really Kubuntu 8.04) Hardy Heron. what i did was edit /etc/cups/printers.conf and add the line

Option orientation-requested 3

just above </Printer> everywhere it appears in the file. for example:

ErrorPolicy retry-job
+ Option orientation-requested 3
</Printer>

you must be root to edit the file. to do this with sudo and vi:

% sudo vi /etc/cups/printers.conf

you should probably save a backup copy of the file before you edit it.

after you edit the file you must restarts the Cups daemon. try:

% sudo /etc/init.d/cupsys restart

Thank you for taking the time to report this bug and helping to make Ubuntu better. The issue that you reported is one that should be reproducible with the live environment of the Desktop CD of the development release - Maverick Meerkat. It would help us greatly if you could test with it so we can work on getting it fixed in the next release of Ubuntu. You can find out more about the development release at http://www.ubuntu.com/testing/ . Thanks again and we appreciate your help.

Changed in sun-java5 (Ubuntu):
status: New → Incomplete
Changed in sun-java6 (Ubuntu):
status: Confirmed → Incomplete
Changed in cupsys (Ubuntu):
status: New → Invalid
tags: added: udd-find
Changed in cups (Debian):
status: Unknown → Fix Released
Changed in sun-java6 (Debian):
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.