tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pid <>
Subject Re: Printing using system commands from Tomcat as a service
Date Tue, 12 Oct 2010 11:10:44 GMT
On 12/10/2010 11:57, F2Andy wrote:
> Using Ruby on Rails on Tomcat, I want to sent a file to a printer, which
> should be easy via a system command. It works if I run Tomcat from the
> command line, but not if Tomcat is running as a service.
> Some details...
> I am using Tomcat 6 on Windows Server 2003, Rail 2.3.9, JRuby 1.5.2 (I
> appreciate most people around here will not be familar with Ruby on Rails,
> but I think this is a Tomcat problem, not a RoR problem). I am trying to
> deploy an application in which records can be printed to a label printer. To
> print, it creates a new file, which is then copied to lpt4: (which is
> actually a USB port on a networked computer, via "net use") with a system
> command:
> "copy C:\tomcat-6\webapps\print\WEB-INF\print.txt lpt4"
> This works fine in development (using Webrick as the web server), but I
> found it does not work when I try to deploy to production (i.e., using
> Tomcat on the same physical machine). The message returned from the OS is "0
> file(s) copied", nothing more helpful than that. The command looks fine, and
> indeed, I can copy the command and paste it into the command prompt, and the
> label is spat out. Clearly the file is being created and saved properly, and
> the file is formatted okay for the printer to understand.

How are you constructing the command and calling it?

Are you setting up the environment to match your environment in the
command prompt?


> However, when I run Tomcat from the command prompt ("tomcat6"), it does work
> (and this is using the same Tomcat installation, by the way).
> My first guess was a permissions issue, so I had the Tomcat service using
> the admin account, but still nothing.
> Anyone any suggestions for what the problem might be? At this stage, I am
> not even sure where to look.

View raw message