You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Amit k <op...@gmail.com> on 2011/04/07 10:13:40 UTC

How to hide tomcat console when installed as service

Hi there,

I am using tomcat 6.0.29 (32bit) source to build the tomcat. The same, after
it is built, is installed as windows service. I am installing it on windows
XP (32 bit), Windows 7 and windows 2K8 (both 64 bit) systems as service. I
dont want the tomcat console to appear when it is installed as service and
whenever started. I have read that when tomcat is installed as service, it
doesnot show the tomcat console. But in my case it does not happen, I get to
see the tomcat console whenever it is installed as service and started.
Interestingly the same is done with Tomcat 5.5.X but it does not show the
console window when it is started. Any help urgently will be highly
appreciated.


Thanks,
Amit

Re: How to hide tomcat console when installed as service

Posted by Mladen Turk <mt...@apache.org>.
On 04/12/2011 11:43 AM, Amit k wrote:
> Hi,
>
> Tomcat documentation says that if tomcat is installed as service, it doesn't
> show up the console. But in my case this doesn't hold true. Again if the
> console is required for std out/err, then redirecting them to file etc wont
> help to display the console?
>
> Really is there not any way out?
>

Nope. As soon you say: "Allow service to interact with desktop"
the window will be shown. Hey you said you won't that.

Services are console applications, and usually need a Console.
Our reason is because JVM uses stderr/stdout which only
work when the process has active console.
Earlier versions of Commons Daemon didn't allocate that
so lot of startup/shudown info was lost (no Console :)

But I already said all of that.

You have few choices:
1) Create a proper GUI<->Service interaction by using IPC
2) Use javaw.exe to run your Tomcat in user session and
    forget about services.
3) Modify Daemon code and comment out the AllocConsole
    API call, loosing Tomcat console messages.
4) Convince Microsoft to ditch the UAC

IMHO anything but 1) is a complete waste of time.
Since Microsoft says you should use IPC to interact with
services from desktop well:
When in Rome, do as Romans do.

Or just use Linux and forget everything about GUI,
desktops, services, Session0, etc ...


Regards
-- 
^TM

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to hide tomcat console when installed as service

Posted by Amit k <op...@gmail.com>.
Had a look at this information before too. I think, writing a service, using
this information, to check for tomcat service and to check for console and
ultimately hiding it seems the way now.

Anyways, thanks for reminding me.
Only thing wanted to know if is there any way, like making any change in
Tomcat configuration/installation files, that would solve my purpose. As of
now, I think there is not any way in this direction to solve the problem.

Thanks,

On Tue, Apr 12, 2011 at 6:39 PM, Caldarale, Charles R <
Chuck.Caldarale@unisys.com> wrote:

> > From: Amit k [mailto:opteemusprime@gmail.com]
> > Subject: Re: How to hide tomcat console when installed as service
>
> > Really is there not any way out?
>
> Did you bother to read the link that Mladen provided?
>
> http://msdn.microsoft.com/en-us/library/ms683502%28v=vs.85%29.aspx
>
>  - 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: How to hide tomcat console when installed as service

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Amit k [mailto:opteemusprime@gmail.com] 
> Subject: Re: How to hide tomcat console when installed as service

> Really is there not any way out?

Did you bother to read the link that Mladen provided?

http://msdn.microsoft.com/en-us/library/ms683502%28v=vs.85%29.aspx

 - 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: How to hide tomcat console when installed as service

Posted by Amit k <op...@gmail.com>.
Hi,

Tomcat documentation says that if tomcat is installed as service, it doesn't
show up the console. But in my case this doesn't hold true. Again if the
console is required for std out/err, then redirecting them to file etc wont
help to display the console?

Really is there not any way out?

On Mon, Apr 11, 2011 at 11:26 AM, Mladen Turk <mt...@apache.org> wrote:

> On 04/11/2011 07:01 AM, Amit k wrote:
>
>> Hi,
>>
>> I actually tried that option. I know it works but under one situation it
>> fails. When your application require tomcat to interact with desktop it
>> fails and in my case, application in tomcat interacts with Desktop through
>> JNI call. So I cant use this option.
>>
>> And moreover it is required to be done with script and not manually.
>>
>> Hope someone has solution for this problem or specifically for scenario.
>>
>>
> Usually services and desktop interaction are mutually exclusive.
> What happens when you boot the box and no user is present.
>
> It might work with XP, but making it work with Vista+ is
> almost impossible cause services run in a different session.
>
> Console window will be shown (not with older versions of
> Commons Daemon, so that's why an older 5.5 didn't pop-up)
> because it is needed for stdout/stderr redirection since
> we explicitly call 'AllocConsole' which isn't displayed
> with services cause services don't have GUI.
> "Interact with desktop" usage is strongly discouraged since
> you need some pretty complex stuff to make it work.
> See:
> http://msdn.microsoft.com/en-us/library/ms683502%28v=vs.85%29.aspx
>
> We have a sort of service interaction (for making thread dumps)
> but this is done via an mutex registered to a Global session.
> (Basically a sort of IPC)
>
> So I'd suggest you modify your application to use some sort
> of IPC to communicate between the service and desktop processes
> like suggested by MSDN.
>
>
>
> Regards
> --
> ^TM
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: How to hide tomcat console when installed as service

Posted by Mladen Turk <mt...@apache.org>.
On 04/11/2011 07:01 AM, Amit k wrote:
> Hi,
>
> I actually tried that option. I know it works but under one situation it
> fails. When your application require tomcat to interact with desktop it
> fails and in my case, application in tomcat interacts with Desktop through
> JNI call. So I cant use this option.
>
> And moreover it is required to be done with script and not manually.
>
> Hope someone has solution for this problem or specifically for scenario.
>

Usually services and desktop interaction are mutually exclusive.
What happens when you boot the box and no user is present.

It might work with XP, but making it work with Vista+ is
almost impossible cause services run in a different session.

Console window will be shown (not with older versions of
Commons Daemon, so that's why an older 5.5 didn't pop-up)
because it is needed for stdout/stderr redirection since
we explicitly call 'AllocConsole' which isn't displayed
with services cause services don't have GUI.
"Interact with desktop" usage is strongly discouraged since
you need some pretty complex stuff to make it work.
See:
http://msdn.microsoft.com/en-us/library/ms683502%28v=vs.85%29.aspx

We have a sort of service interaction (for making thread dumps)
but this is done via an mutex registered to a Global session.
(Basically a sort of IPC)

So I'd suggest you modify your application to use some sort
of IPC to communicate between the service and desktop processes
like suggested by MSDN.



Regards
-- 
^TM

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How to hide tomcat console when installed as service

Posted by Amit k <op...@gmail.com>.
Hi,

I actually tried that option. I know it works but under one situation it
fails. When your application require tomcat to interact with desktop it
fails and in my case, application in tomcat interacts with Desktop through
JNI call. So I cant use this option.

And moreover it is required to be done with script and not manually.

Hope someone has solution for this problem or specifically for scenario.

Thanks,

2011/4/8 הילה <hi...@gmail.com>

> Hey,
> in the service properties, under "Log on" Tab, view the box of "Allow
> service to interact with desktop".
>
> if it's checked- clear it.
>
> This what has worked for me :]
>
> Thanks
> Hila :]
>
>
> 2011/4/8 Amit k <op...@gmail.com>
>
> > Hi,
> >
> > The tomcat is build from source and it is integrated in the installer.
> Not
> > to use binaries was the decision taken long back and cant be revoked.
> >
> > The tomcat is started exactly in two ways
> > 1. With sc.exe (That is with the SC tool) that is sc.exe start Tomcat6
> > 2. With net start Tomcat6 command
> >
> > When it is started in process mode, it does not show the tomcat console.
> > But
> > when tomcat is installed in service mode, it shows the console. I want to
> > hide it.
> >
> > Thanks,
> > Amit
> >
> > On Thu, Apr 7, 2011 at 4:47 PM, Pid <pi...@pidster.com> wrote:
> >
> > > On 4/7/11 9:13 AM, Amit k wrote:
> > > > I am using tomcat 6.0.29 (32bit) source to build the tomcat.
> > >
> > > Why not just use the binary?
> > >
> > > How are you starting Tomcat when it exhibits the issue, exactly?
> > >
> > >
> > > p
> > >
> > >
> >
>

Re: How to hide tomcat console when installed as service

Posted by הילה <hi...@gmail.com>.
Hey,
in the service properties, under "Log on" Tab, view the box of "Allow
service to interact with desktop".

if it's checked- clear it.

This what has worked for me :]

Thanks
Hila :]


2011/4/8 Amit k <op...@gmail.com>

> Hi,
>
> The tomcat is build from source and it is integrated in the installer. Not
> to use binaries was the decision taken long back and cant be revoked.
>
> The tomcat is started exactly in two ways
> 1. With sc.exe (That is with the SC tool) that is sc.exe start Tomcat6
> 2. With net start Tomcat6 command
>
> When it is started in process mode, it does not show the tomcat console.
> But
> when tomcat is installed in service mode, it shows the console. I want to
> hide it.
>
> Thanks,
> Amit
>
> On Thu, Apr 7, 2011 at 4:47 PM, Pid <pi...@pidster.com> wrote:
>
> > On 4/7/11 9:13 AM, Amit k wrote:
> > > I am using tomcat 6.0.29 (32bit) source to build the tomcat.
> >
> > Why not just use the binary?
> >
> > How are you starting Tomcat when it exhibits the issue, exactly?
> >
> >
> > p
> >
> >
>

Re: How to hide tomcat console when installed as service

Posted by Amit k <op...@gmail.com>.
Hi,

The tomcat is build from source and it is integrated in the installer. Not
to use binaries was the decision taken long back and cant be revoked.

The tomcat is started exactly in two ways
1. With sc.exe (That is with the SC tool) that is sc.exe start Tomcat6
2. With net start Tomcat6 command

When it is started in process mode, it does not show the tomcat console. But
when tomcat is installed in service mode, it shows the console. I want to
hide it.

Thanks,
Amit

On Thu, Apr 7, 2011 at 4:47 PM, Pid <pi...@pidster.com> wrote:

> On 4/7/11 9:13 AM, Amit k wrote:
> > I am using tomcat 6.0.29 (32bit) source to build the tomcat.
>
> Why not just use the binary?
>
> How are you starting Tomcat when it exhibits the issue, exactly?
>
>
> p
>
>

Re: How to hide tomcat console when installed as service

Posted by Pid <pi...@pidster.com>.
On 4/7/11 9:13 AM, Amit k wrote:
> I am using tomcat 6.0.29 (32bit) source to build the tomcat.

Why not just use the binary?

How are you starting Tomcat when it exhibits the issue, exactly?


p