You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Tan Raymond <he...@yahoo.com.sg> on 2009/01/11 19:49:03 UTC
Unsuccessful printing from Servlet
Hi,
I am running Tomcat 5.5 Server from a Windows Vista Home Premium OS.
When I try to print from a servlet and use the following code to get a PrintService.
> PrintService service = PrintServiceLookup.lookupDefaultPrintService();
It return a null value.
However I am able to get the PrintService when I run the above code in a standalone Java program.
Is there any solutions for the above problem?
Thanks
New Email names for you!
Get the Email name you've always wanted on the new @ymail and @rocketmail.
Hurry before someone else does!
http://mail.promotions.yahoo.com/newdomains/sg/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Unsuccessful printing from Servlet
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: André Warnier [mailto:aw@ice-sa.com]
> Subject: Re: Unsuccessful printing from Servlet
>
> You can change the user under which the Tomcat service runs, using the
> "My Computer" .. Manage .. Services .. applet.
Actually, I had tried that, setting my normal account via the tomcat6w.exe Logon tab, but I still couldn't get PrintServiceLookup to return anything but null. However, changing the account via the Services snap-in as you suggested did allow retrieval of the PrintService from a servlet.
Don't know what the problem is with tomcat6w.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Unsuccessful printing from Servlet
Posted by André Warnier <aw...@ice-sa.com>.
Caldarale, Charles R wrote:
>> From: Tan Raymond [mailto:hexadome@yahoo.com.sg]
>> Subject: Unsuccessful printing from Servlet
>>
>> PrintServiceLookup.lookupDefaultPrintService();
>> It return a null value.
>
> Are you running Tomcat as a Windows service? Try running it with the startup.bat script instead; services don't appear to have access to the PrintService.
>
> You'll need to use the .zip download rather than the .exe to get the scripts.
>
Not contradicting what Chuck says above, and despite my lack of precise
knowledge about Vista, the reason may be as follows :
By default, when Tomcat is installed as a Windows Service, it runs under
the user-id "LocalSystem". That standard user has very wide privileges
on the local machine, but no access to Windows "network services", among
which is probably the print service.
You can change the user under which the Tomcat service runs, using the
"My Computer" .. Manage .. Services .. applet.
If you are in a Windows Domain, you will need a valid Domain user,
otherwise just create a local user "tomcat", and use it to run Tomcat as
a Service. It will then probably have access to the print service.
If you run Tomcat from the command-line, as Chuck indicates above, it
will run in a console (not as a service), under your own login user-id.
That will also do the trick, but if you close the command window or log
off, Tomcat will stop.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Unsuccessful printing from Servlet
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Tan Raymond [mailto:hexadome@yahoo.com.sg]
> Subject: Unsuccessful printing from Servlet
>
> PrintServiceLookup.lookupDefaultPrintService();
> It return a null value.
Are you running Tomcat as a Windows service? Try running it with the startup.bat script instead; services don't appear to have access to the PrintService.
You'll need to use the .zip download rather than the .exe to get the scripts.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org