Java Mailing List Archive

http://www.junlu.com/

Home » users-digest.tomcat »

users Digest 11 Mar 2013 21:59:30 -0000 Issue 11289

users-digest-help

2013-03-11


Author LoginPost Reply

users Digest 11 Mar 2013 21:59:30 -0000 Issue 11289

Topics (messages 240257 through 240284)

Tomcat jdbc pool connection failover
 240257 by: amit shah
 240260 by: André Warnier
 240262 by: Daniel Mikusa
 240264 by: amit shah
 240266 by: André Warnier
 240272 by: Shanti Suresh
 240275 by: Daniel Mikusa
 240280 by: Christopher Schultz

Console when running as a service.
 240258 by: Sam Takoy
 240259 by: André Warnier
 240261 by: Harris, Jeffrey E.
 240263 by: André Warnier
 240269 by: Howard W. Smith, Jr.
 240274 by: pid.pidster.com
 240276 by: André Warnier
 240277 by: Mark Eggers

[OT] Console when running as a service.
 240265 by: Leo Donahue - RDSA IT
 240267 by: Harris, Jeffrey E.
 240268 by: André Warnier
 240278 by: André Warnier

date format in Last-modified header
 240270 by: getridofthespam
 240271 by: André Warnier
 240281 by: Christopher Schultz
 240283 by: André Warnier

Re: java.util.logging.SimpleFormatter vs org.apache.juli.OneLineFormatter
 240273 by: Jesse Farinacci

[OT] Re: Console when running as a service.
 240279 by: verlag.preisser.t-online.de
 240282 by: André Warnier

Having WebSocket Issues (Tomcat 8)
 240284 by: Nick Williams

Administrivia:

---------------------------------------------------------------------
To post to the list, e-mail: users@(protected)
To unsubscribe, e-mail: users-digest-unsubscribe@(protected)
For additional commands, e-mail: users-digest-help@(protected)

----------------------------------------------------------------------


Attachment: users_240257.eml (zipped)
Hello,
    I would like to know if the tomcat jdbc pool (7.0.34+) provides
connection failover capabilities i.e. to transparently close all the open
database connections and switch to a another database server on an
planned/unplanned database server outage event.
    I read through the tomcat documentation but didn't find any details
related to this. If this feature is not supported are there any recommended
alternatives and any future plans to add this feature to the jdbc pool?

Thank you,
Amit.

Attachment: users_240260.eml (zipped)
amit shah wrote:
> Hello,
>      I would like to know if the tomcat jdbc pool (7.0.34+) provides
> connection failover capabilities i.e. to transparently close all the open
> database connections and switch to a another database server on an
> planned/unplanned database server outage event.
>      I read through the tomcat documentation but didn't find any details
> related to this. If this feature is not supported are there any recommended
> alternatives and any future plans to add this feature to the jdbc pool?
>
Hi.
This is not a direct answer to your question, and I am not able to provide one.
But one alternative to your above scenario which does exist, is to have a pool of Tomcats,
each with its own database server.



Attachment: users_240262.eml (zipped)
On Mar 11, 2013, at 12:52 AM, amit shah wrote:

> Hello,
>     I would like to know if the tomcat jdbc pool (7.0.34+) provides
> connection failover capabilities i.e. to transparently close all the open
> database connections and switch to a another database server on an
> planned/unplanned database server outage event.
>     I read through the tomcat documentation but didn't find any details
> related to this. If this feature is not supported are there any recommended
> alternatives and any future plans to add this feature to the jdbc pool?

You might want to see if your JDBC driver will handle this for you. I know that some do, like MySQL [1].

Dan

[1] - https://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-configuration-properties.html

>
> Thank you,
> Amit


Attachment: users_240264.eml (zipped)
Apparently we use Oracle as our data store while the solution you mentioned
is for mysql.

Is there a way tomcat can provide a notification after all its retries to
the database server have failed? This way at least I can create a new
connection pool configured to a different database server in order to
simulate a automatic connection failover from the application side. I
understand that this step would require time for the retries and creation
of new pool.

Thanks.


On Mon, Mar 11, 2013 at 6:15 PM, Daniel Mikusa <dmikusa@(protected):

> On Mar 11, 2013, at 12:52 AM, amit shah wrote:
>
> > Hello,
> >     I would like to know if the tomcat jdbc pool (7.0.34+) provides
> > connection failover capabilities i.e. to transparently close all the open
> > database connections and switch to a another database server on an
> > planned/unplanned database server outage event.
> >     I read through the tomcat documentation but didn't find any
> details
> > related to this. If this feature is not supported are there any
> recommended
> > alternatives and any future plans to add this feature to the jdbc pool?
>
> You might want to see if your JDBC driver will handle this for you. I
> know that some do, like MySQL [1].
>
> Dan
>
> [1] -
> https://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-configuration-properties.html
>
> >
> > Thank you,
> > Amit
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)
>
>

Attachment: users_240266.eml (zipped)
Hi.
Don't "top post".

amit shah wrote:
> Apparently we use Oracle as our data store while the solution you mentioned
> is for mysql.

And did you check if the Oracle JDBC driver provides such an option ?

>
> Is there a way tomcat can provide a notification after all its retries to
> the database server have failed? This way at least I can create a new
> connection pool configured to a different database server in order to
> simulate a automatic connection failover from the application side. I
> understand that this step would require time for the retries and creation
> of new pool.

I am not a Java specialist, but I would imagine that at least your application would get
some kind of I/O exception when that happens on a read or a write.
Can you not catch that and do whatever you need to then ?
After all, even if the driver itself handles the primary case, there would still be a
possibility that even your backup database server would also be unreachable, no ?

>
> Thanks.
>
>
> On Mon, Mar 11, 2013 at 6:15 PM, Daniel Mikusa <dmikusa@(protected):
>
>> On Mar 11, 2013, at 12:52 AM, amit shah wrote:
>>
>>> Hello,
>>>     I would like to know if the tomcat jdbc pool (7.0.34+) provides
>>> connection failover capabilities i.e. to transparently close all the open
>>> database connections and switch to a another database server on an
>>> planned/unplanned database server outage event.
>>>     I read through the tomcat documentation but didn't find any
>> details
>>> related to this. If this feature is not supported are there any
>> recommended
>>> alternatives and any future plans to add this feature to the jdbc pool?
>> You might want to see if your JDBC driver will handle this for you. I
>> know that some do, like MySQL [1].
>>
>> Dan
>>
>> [1] -
>> https://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-configuration-properties.html
>>
>>> Thank you,
>>> Amit
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@(protected)
>> For additional commands, e-mail: users-help@(protected)
>>
>>
>



Attachment: users_240272.eml (zipped)
On Mon, Mar 11, 2013 at 11:00 AM, André Warnier <aw@(protected):

>
> amit shah wrote:
>
>> Apparently we use Oracle as our data store while the solution you
>> mentioned
>> is for mysql.
>>
>
> And did you check if the Oracle JDBC driver provides such an option ?
>
>
>
>> Is there a way tomcat can provide a notification after all its retries to
>> the database server have failed? This way at least I can create a new
>> connection pool configured to a different database server in order to
>> simulate a automatic connection failover from the application side. I
>> understand that this step would require time for the retries and creation
>> of new pool.
>>
>
> I am not a Java specialist, but I would imagine that at least your
> application would get some kind of I/O exception when that happens on a
> read or a write.
> Can you not catch that and do whatever you need to then ?
> After all, even if the driver itself handles the primary case, there would
> still be a possibility that even your backup database server would also be
> unreachable, no ?
>
>
How often does an unplanned outage occur? It would seem drastic if an
unplanned database server outage occurs often.
For planned server outages, usually, the failover is done out-of-band with
Tomcat. Please correct me if I am wrong.
Some simple options I can think of include:
* DNS mapping - map the DNS name of the Oracle server to the new IP address
of the second server - make sure that "networkaddress.cache.ttl=1800" or
something other than "-1" in the jre/lib/java.security file
* a loadbalancer listing both database servers with one inactive - then you
mark the secondary server as active, and the primary as inactive during
maintenance of the primary database server.

Thanks.

              -Shanti

>
>
>> On Mon, Mar 11, 2013 at 6:15 PM, Daniel Mikusa <dmikusa@(protected)>
>> wrote:
>>
>> On Mar 11, 2013, at 12:52 AM, amit shah wrote:
>>>
>>> Hello,
>>>>     I would like to know if the tomcat jdbc pool (7.0.34+) provides
>>>> connection failover capabilities i.e. to transparently close all the
>>>> open
>>>> database connections and switch to a another database server on an
>>>> planned/unplanned database server outage event.
>>>>     I read through the tomcat documentation but didn't find any
>>>>
>>> details
>>>
>>>> related to this. If this feature is not supported are there any
>>>>
>>> recommended
>>>
>>>> alternatives and any future plans to add this feature to the jdbc pool?
>>>>
>>> You might want to see if your JDBC driver will handle this for you. I
>>> know that some do, like MySQL [1].
>>>
>>

Attachment: users_240275.eml (zipped)
On Mar 11, 2013, at 10:09 AM, amit shah wrote:

> Apparently we use Oracle as our data store while the solution you mentioned
> is for mysql.

I'm not an Oracle guy, but I'm pretty sure that it supports failover. Not sure it's as simple as changing the JDBC URL though, you'll probably want to check with your DBA to figure out more.

>
> Is there a way tomcat can provide a notification after all its retries to
> the database server have failed?

This should throw an exception and indicate it was unable to create a connection. I suppose that you could catch this and do something else. It's not the best approach though. I think the JDBC driver could handle this more seamlessly, since it's closer to the DB.

> This way at least I can create a new
> connection pool configured to a different database server in order to
> simulate a automatic connection failover from the application side. I
> understand that this step would require time for the retries and creation
> of new pool.

Perhaps you could create two datasources on startup, a primary and a secondary. The application would always default to the primary, unless it couldn't get a connection. Then it would use the secondary. Not a great solution, but sounds similar to what you mentioned.

Dan



>
> Thanks.
>
>
> On Mon, Mar 11, 2013 at 6:15 PM, Daniel Mikusa <dmikusa@(protected):
>
>> On Mar 11, 2013, at 12:52 AM, amit shah wrote:
>>
>>> Hello,
>>>     I would like to know if the tomcat jdbc pool (7.0.34+) provides
>>> connection failover capabilities i.e. to transparently close all the open
>>> database connections and switch to a another database server on an
>>> planned/unplanned database server outage event.
>>>     I read through the tomcat documentation but didn't find any
>> details
>>> related to this. If this feature is not supported are there any
>> recommended
>>> alternatives and any future plans to add this feature to the jdbc pool?
>>
>> You might want to see if your JDBC driver will handle this for you. I
>> know that some do, like MySQL [1].
>>
>> Dan
>>
>> [1] -
>> https://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-configuration-properties.html
>>
>>>
>>> Thank you,
>>> Amit
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@(protected)
>> For additional commands, e-mail: users-help@(protected)
>>
>>


Attachment: users_240280.eml (zipped)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Amit,

On 3/11/13 12:52 AM, amit shah wrote:
> Hello, I would like to know if the tomcat jdbc pool (7.0.34+)
> provides connection failover capabilities i.e. to transparently
> close all the open database connections and switch to a another
> database server on an planned/unplanned database server outage
> event. I read through the tomcat documentation but didn't find any
> details related to this. If this feature is not supported are there
> any recommended alternatives and any future plans to add this
> feature to the jdbc pool?

This is usually done at the driver level. What database are you using?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlE+PYkACgkQ9CaO5/Lv0PAAtgCeIMaEODHLFvVqG5losN1EApM6
CxMAnRyRG7Qdx3hI+uQ4pD4yx07p++tx
=UVeg
-----END PGP SIGNATURE-----


Attachment: users_240258.eml (zipped)
Hi,

Just installed Tomcat 7 as a service (by running "service install").

This is a change for me: historically, I've been running tomcat by running "startup" in "tomcat/bin", but now I want to get with the times.

With my new, better way of running tomcat, how do I monitor with the server is writing to stdout and stderr? I know where to find the content (tomcat7-stderr.2013-03-11.log, etc.) but what is a good way to monitor it, i.e. see what's going on as it is happening?

Many thanks in advance!

Sam

Attachment: users_240259.eml (zipped)
Sam Takoy wrote:
> Hi,
>
> Just installed Tomcat 7 as a service (by running "service install").
>
> This is a change for me: historically, I've been running tomcat by running "startup" in "tomcat/bin", but now I want to get with the times.
>
> With my new, better way of running tomcat, how do I monitor with the server is writing to stdout and stderr? I know where to find the content (tomcat7-stderr.2013-03-11.log, etc.) but what is a good way to monitor it, i.e. see what's going on as it is happening?
>

Well, basically it is either the one or the other, can't have your cake and eat it, etc..
A "Service" or "daemon", by definition, runs in the background and doesn't give you a
real-time console to look at.
Under Unix/Linux, you could use a command like "tail -f <logfile>" which would display the
end of the logfile as it is being written. But I do not know if Windows has any
equivalent thing.

Talking about "getting with the times", maybe you are missing another evolutionary step
here : virtualisation (see Vmware etc.). Basically, this allows you to create a "virtual
machine" in which to run Windows (and Tomcat), and to connect from a remote location to
the (also virtual) console of that machine. This would allow you to continue to run
Tomcat in a command window (and see STDOUT/STDERR), without some of the inconvenients due
to having to have a physical console to run it on.

HTH.


Attachment: users_240261.eml (zipped)


> -----Original Message-----
> From: André Warnier [mailto:aw@(protected)]
> Sent: Monday, March 11, 2013 4:34 AM
> To: Tomcat Users List
> Subject: Re: Console when running as a service.
>
> Sam Takoy wrote:
> > Hi,
> >
> > Just installed Tomcat 7 as a service (by running "service install").
> >
> > This is a change for me: historically, I've been running tomcat by
> running "startup" in "tomcat/bin", but now I want to get with the
> times.
> >
> > With my new, better way of running tomcat, how do I monitor with the
> server is writing to stdout and stderr? I know where to find the
> content (tomcat7-stderr.2013-03-11.log, etc.) but what is a good way to
> monitor it, i.e. see what's going on as it is happening?
> >
>
> Well, basically it is either the one or the other, can't have your cake
> and eat it, etc..
> A "Service" or "daemon", by definition, runs in the background and
> doesn't give you a real-time console to look at.
> Under Unix/Linux, you could use a command like "tail -f <logfile>"
> which would display the end of the logfile as it is being written. But
> I do not know if Windows has any equivalent thing.
>

Yes, there are versions of tail for Windows; Google is our friend. One version is at http://tailforwin32.sourceforge.net/.

> Talking about "getting with the times", maybe you are missing another
> evolutionary step here : virtualisation (see Vmware etc.). Basically,
> this allows you to create a "virtual machine" in which to run Windows
> (and Tomcat), and to connect from a remote location to the (also
> virtual) console of that machine. This would allow you to continue to
> run Tomcat in a command window (and see STDOUT/STDERR), without some of
> the inconvenients due to having to have a physical console to run it
> on.

But some of the advantages of using a service (whether on a physical or virtual server) are automatic startup (without having to be logged into the server) at boot time, and the ability to restart the service or to take other action if the service should stop (presuming that the cause of the stoppage was not something that would prevent the service from starting again).

And the console only contains a limited amount of information (even considering the data accessible by scrolling back in the window), so if one is not constantly monitoring the console, one is likely to miss events that would also be captured in the log files.

>
> HTH.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)


This e-mail and any attachments are intended only for the use of the addressee(s) named herein and may contain proprietary information. If you are not the intended recipient of this e-mail or believe that you received this email in error, please take immediate action to notify the sender of the apparent error by reply e-mail; permanently delete the e-mail and any attachments from your computer; and do not disseminate, distribute, use, or copy this message and any attachments.


Attachment: users_240263.eml (zipped)
Harris, Jeffrey E. wrote:
>
>> -----Original Message-----
>> From: André Warnier [mailto:aw@(protected)]
>> Sent: Monday, March 11, 2013 4:34 AM
>> To: Tomcat Users List
>> Subject: Re: Console when running as a service.
>>
>> Sam Takoy wrote:
>>> Hi,
>>>
>>> Just installed Tomcat 7 as a service (by running "service install").
>>>
>>> This is a change for me: historically, I've been running tomcat by
>> running "startup" in "tomcat/bin", but now I want to get with the
>> times.
>>> With my new, better way of running tomcat, how do I monitor with the
>> server is writing to stdout and stderr? I know where to find the
>> content (tomcat7-stderr.2013-03-11.log, etc.) but what is a good way to
>> monitor it, i.e. see what's going on as it is happening?
>> Well, basically it is either the one or the other, can't have your cake
>> and eat it, etc..
>> A "Service" or "daemon", by definition, runs in the background and
>> doesn't give you a real-time console to look at.
>> Under Unix/Linux, you could use a command like "tail -f <logfile>"
>> which would display the end of the logfile as it is being written. But
>> I do not know if Windows has any equivalent thing.
>>
>
> Yes, there are versions of tail for Windows; Google is our friend. One version is at http://tailforwin32.sourceforge.net/.
>
>> Talking about "getting with the times", maybe you are missing another
>> evolutionary step here : virtualisation (see Vmware etc.). Basically,
>> this allows you to create a "virtual machine" in which to run Windows
>> (and Tomcat), and to connect from a remote location to the (also
>> virtual) console of that machine. This would allow you to continue to
>> run Tomcat in a command window (and see STDOUT/STDERR), without some of
>> the inconvenients due to having to have a physical console to run it
>> on.
>
> But some of the advantages of using a service (whether on a physical or virtual server) are automatic startup (without having to be logged into the server) at boot time, and the ability to restart the service or to take other action if the service should stop (presuming that the cause of the stoppage was not something that would prevent the service from starting again).
>
> And the console only contains a limited amount of information (even considering the data accessible by scrolling back in the window), so if one is not constantly monitoring the console, one is likely to miss events that would also be captured in the log files.
>

I agree with all the above.

On the other hand, running in a console (or command window) as a normal process also has
some advantages compared to running as a Service. For example, a lot of standard Windows
programs will not run, or not correctly, when used in a Service context (MS-Office
programs for example). So if for some scenarios, it would be useful to use say MS-Word to
produce a PDF version of a document, it is not possible (or very difficult) to trigger
this from Tomcat when running as a Service. But it runs perfectly well when Tomcat runs in
a command window.


Attachment: users_240269.eml (zipped)
On Mon, Mar 11, 2013 at 4:33 AM, André Warnier <aw@(protected):

>
> Well, basically it is either the one or the other, can't have your cake
> and eat it, etc..
>

wow, can't have your cake and eat it... that got me cracking up! funny! :)


>
> Under Unix/Linux, you could use a command like "tail -f <logfile>" which
> would display the end of the logfile as it is being written. But I do not
> know if Windows has any equivalent thing.
>
>
On Windows Server 2003 and 2008, I use TextPad (which is a really great
file editor, similar to Multi-Edit, which I previously used many years ago
in the past). Anyway, TextPad always informs me when a file (that I'm
currently viewing in TextPad) has been updated, and then prompts me to load
the newly-updated file.


> Talking about "getting with the times", maybe you are missing another
> evolutionary step here : virtualisation (see Vmware etc.). Basically, this
> allows you to create a "virtual machine" in which to run Windows (and
> Tomcat), and to connect from a remote location to the (also virtual)
> console of that machine. This would allow you to continue to run Tomcat in
> a command window (and see STDOUT/STDERR), without some of the inconvenients
> due to having to have a physical console to run it on.
>

Interesting. this is good to know.

Attachment: users_240274.eml (zipped)
On 11 Mar 2013, at 14:21, "André Warnier" <aw@(protected):

> So if for some scenarios, it would be useful to use say MS-Word to
> produce a PDF version of a document, it is not possible (or very difficult) to trigger
> this from Tomcat when running as a Service.

Eek! Eek I say!


p


Attachment: users_240276.eml (zipped)
pid@(protected):
> On 11 Mar 2013, at 14:21, "André Warnier" <aw@(protected):
>
>> So if for some scenarios, it would be useful to use say MS-Word to
>> produce a PDF version of a document, it is not possible (or very difficult) to trigger
>> this from Tomcat when running as a Service.
>
> Eek! Eek I say!
>
+1. Eek, I tearfully and shamefully agree.
But still 90% or more of corporate internal documents are written as Word documents, and
there is no open-source tool which can perfectly handle this shamefully proprietary format
and convert it to some non-propietary format that one could still read in 10 year's time,
so what is one to do if one wants to get some money to get one's children through computer
school and pay for their iPhones, he ?

But the main point was that there are cases where running as a Service is the most
appropriate way, and cases where it isn't. And that modern technology often provides a
variety of ways to achieve one's goals at minimum expense and frustration. And that many
times it is not that the information on how to do something is not available, it is a
matter of not knowing where or how to find it among the clutter. So indicating some
practical alternatives seemed the right thing to do here.





Attachment: users_240277.eml (zipped)
On 3/11/2013 11:20 AM, André Warnier wrote:
> pid@(protected):
>> On 11 Mar 2013, at 14:21, "André Warnier" <aw@(protected):
>>
>>> So if for some scenarios, it would be useful to use say MS-Word to
>>> produce a PDF version of a document, it is not possible (or very
>>> difficult) to trigger
>>> this from Tomcat when running as a Service.
>>
>> Eek! Eek I say!
>>
> +1. Eek, I tearfully and shamefully agree.
> But still 90% or more of corporate internal documents are written as
> Word documents, and there is no open-source tool which can perfectly
> handle this shamefully proprietary format and convert it to some
> non-propietary format that one could still read in 10 year's time, so
> what is one to do if one wants to get some money to get one's children
> through computer school and pay for their iPhones, he ?

Sigh, I agree if your constraint is "perfectly" then you're pretty much
stuck. However, even Microsoft doesn't deal with their formats "perfectly".

An alternate solution (which I've not played with in a very long time)
could be:

http://poi.apache.org/

This could remove the requirement for interacting with a desktop
application when dealing with some Microsoft formats.

> But the main point was that there are cases where running as a Service
> is the most appropriate way, and cases where it isn't. And that modern
> technology often provides a variety of ways to achieve one's goals at
> minimum expense and frustration. And that many times it is not that the
> information on how to do something is not available, it is a matter of
> not knowing where or how to find it among the clutter. So indicating
> some practical alternatives seemed the right thing to do here.

I know how to do the original request in Eclipse and NetBeans, but I
don't have a quick handle on how to do this for Tomcat running as a
Windows service.

There were several hits with a quick search, but since I've not used any
of the projects I'm a bit reluctant to mention them.

. . . . just my two cents.
/mde/



Attachment: users_240265.eml (zipped)
I would be curious to find out how many users run Tomcat from the console in a virtual machine environment.

When you remote into your virtual machine that is running Tomcat from the console, you must not be logging off of that session are you? How do you keep the console window open, unless you just close the session? When you remote back into your server after time passes, how do you know you will get the same session?

In our virtual environment, I've never been able to leave the console window running. Something eventually kills the console window, so we've been running it as a service.

Leo



Attachment: users_240267.eml (zipped)


> -----Original Message-----
> From: Leo Donahue - RDSA IT [mailto:LeoDonahue@(protected)]
> Sent: Monday, March 11, 2013 10:56 AM
> To: Tomcat Users List (users@(protected))
> Subject: [OT] Console when running as a service.
>
> I would be curious to find out how many users run Tomcat from the
> console in a virtual machine environment.
>
> When you remote into your virtual machine that is running Tomcat from
> the console, you must not be logging off of that session are you? How
> do you keep the console window open, unless you just close the session?
> When you remote back into your server after time passes, how do you
> know you will get the same session?
>
> In our virtual environment, I've never been able to leave the console
> window running. Something eventually kills the console window, so
> we've been running it as a service.
>
> Leo
>
We always run Tomcat as a service, but to answer your questions:

If you run Tomcat from a console, you cannot log off; otherwise, the application terminates.

You can disconnect from the session (not log off) and any applications already running keep running. Normally, you would reconnect to the same session, but if you do not, you can use Terminal Services Manager to reconnect to the session (by default, Windows Server 2000 and 2003 allow two administrator sessions at the same time plus the local console connection; by default, Windows Server 2008 and later normally connect to the console session, although that can be changed by configuring local or domain group policies to allow multiple sessions as in Windows Server 2000 and 2003).

Although the default is that disconnecting a session leaves it running until someone either logs out of the session or reboots the server, many organizations set an idle time limit for disconnected or inactive sessions, and actually reset them after the time limit is reached, which is the same as logging out.

Jeffrey Harris

This e-mail and any attachments are intended only for the use of the addressee(s) named herein and may contain proprietary information. If you are not the intended recipient of this e-mail or believe that you received this email in error, please take immediate action to notify the sender of the apparent error by reply e-mail; permanently delete the e-mail and any attachments from your computer; and do not disseminate, distribute, use, or copy this message and any attachments.


Attachment: users_240268.eml (zipped)
Leo Donahue - RDSA IT wrote:
> I would be curious to find out how many users run Tomcat from the console in a virtual machine environment.
>
> When you remote into your virtual machine that is running Tomcat from the console, you must not be logging off of that session are you? How do you keep the console window open, unless you just close the session? When you remote back into your server after time passes, how do you know you will get the same session?
>
> In our virtual environment, I've never been able to leave the console window running. Something eventually kills the console window, so we've been running it as a service.
>

I do this all the time, on a series of servers (Tomcat or others), often on several
servers at once from my laptop.
Using a vSphere Client or VNC for instance, does not logoff the user session or close any
window when you connect/disconnect.  It is only MS Remote Desktop or Remote Console
thingies who do that.

And both the above solutions require a password to connect to the console, so since there
is no "real" physical console attached to the server, the fact of leaving this console
"logged-in" is not any more of a security issue than anything else.

I am not advocating this solution as a universal solution to everything. There are cases
when running as a Windows Service is more appropriate (or mandatory). In some other
cases, the above solutions are more practical. YMMV as they say.


Attachment: users_240278.eml (zipped)
Mark Eggers wrote:
> On 3/11/2013 11:20 AM, André Warnier wrote:
>> pid@(protected):
>>> On 11 Mar 2013, at 14:21, "André Warnier" <aw@(protected):
>>>
>>>> So if for some scenarios, it would be useful to use say MS-Word to
>>>> produce a PDF version of a document, it is not possible (or very
>>>> difficult) to trigger
>>>> this from Tomcat when running as a Service.
>>>
>>> Eek! Eek I say!
>>>
>> +1. Eek, I tearfully and shamefully agree.
>> But still 90% or more of corporate internal documents are written as
>> Word documents, and there is no open-source tool which can perfectly
>> handle this shamefully proprietary format and convert it to some
>> non-propietary format that one could still read in 10 year's time, so
>> what is one to do if one wants to get some money to get one's children
>> through computer school and pay for their iPhones, he ?
>
> Sigh, I agree if your constraint is "perfectly" then you're pretty much
> stuck. However, even Microsoft doesn't deal with their formats "perfectly".
>

Marking this OT now, because we are deriving significantly from the OP's original question.

My definition of "perfectly" in this case, is "pretty much undistinguishable from what the
user himself would get if he told MS-Office : save this MS-Office document as PDF".
For 95% of MS-Office documents, OpenOffice for instance (which is no problem to run inside
a Service context) will do a very good job. Unfortunately, there are 5% of documents for
which it will produce something of which the look (and even sometimes the content) differs
significantly from the original document, and from the same PDF produced by MS-Office
itself. And 5% of hundreds of documents per day is a large number of documents.
For some users and some documents it doesn't really matter all that much, but for some
others it does. So again, it depends on the exact circumstances.

We have a similar issue with PDFs. There are umpteen libraries out there which create
PDFs, some of them better than others. Some of them produce PDFs which are really buggy -
in the sense of really not respecting the published PDF specification. But they can still
be opened by the Adobe Acrobat Reader, which is the reference that most users refer to
("If I can open it with Acrobat, then it's a correct PDF"). This is basically wrong,
because the Adobe Acrobat Reader is rather tolerant, and will open and display some PDFs
which are obviously sloppy. But it forces us to also create tools which can read and
process such sloppy PDFs, and maybe thus accept a PDF which the next generation of readers
won't be able to open.

Sigh. Sometimes being correct and abiding by the rules conflicts with being practical, and
one has to navigate between them as judiciously as possible.

> An alternate solution (which I've not played with in a very long time)
> could be:
>
> http://poi.apache.org/
>
> This could remove the requirement for interacting with a desktop
> application when dealing with some Microsoft formats.
>

Thanks, I'll have a look at it (maybe again).
There exist a number of such alternatives. Some are better for some documents, worse for
others. And over time, some get better and some get worse (slower development, do not
keep in sync with new document versions). We are always on the lookout for the best
alternative of the moment, and try to structure our applications so that we can switch the
tools we use without too much fuss.
It is always a bit like walking along quicksands though, because the variety of ways in
which people manage to screw up real-world documents is amazing; and because in all
document formats, there is always this "feature creep" which developers seem to be unable
to stop themselves from falling for.
So you have to spend a considerable amount of time on testing over a large volume of
documents before you can really accept any tool as "good enough".

All of this to say that using an (MS or other) desktop application is not the way we would
prefer to do things, but that since it is the reference used by our customers, we are
sometimes forced to do this. And since some of these applications do not exist in a
version that can be used without problems in a Service context, we sometimes have no
better choice than to run the application using it, as a desktop application itself.

Which after all and roundabout, brings us back to the original OP's question.


Attachment: users_240270.eml (zipped)
Hi,

Google didn't give any relevant info so I try here.

I traced a tomcat request and noticed there where two different date formats in the
last-modified header:
2012-12-13T09:52:02Z
and
Mon, 07 Jan 2013 21:49:08 GMT

What determines the format and where do the differences come from?

tnx in advance for all replies

Attachment: users_240271.eml (zipped)
getridofthespam wrote:
> Hi,
>
> Google didn't give any relevant info so I try here.
>
> I traced a tomcat request and noticed there where two different date formats in the
> last-modified header:
> 2012-12-13T09:52:02Z
> and
> Mon, 07 Jan 2013 21:49:08 GMT
>
> What determines the format and where do the differences come from?
>

According to Perl's help, these formats orginate from :
They correspond to the C library routines strftime and ctime.

Searching Google for that, this page provides a lot more information :
http://linux.die.net/man/3/strftime

I am also sure that there must be an RFC (2616?) that mentions the various acceptable
formats in HTTP. Mmmm. For example, searching Google for "http rfc date format" yields
this : https://tools.ietf.org/html/rfc3339) (and also a reference to RFC 2616).

Now, how from there they make their way into Tomcat's "last-modified" headers, I wouldn't
know.


Attachment: users_240281.eml (zipped)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

To whom it may concern,

On 3/11/13 11:17 AM, getridofthespam wrote:
> Google didn't give any relevant info so I try here.
>
> I traced a tomcat request and noticed there where two different
> date formats in the last-modified header: 2012-12-13T09:52:02Z and
> Mon, 07 Jan 2013 21:49:08 GMT
>
> What determines the format and where do the differences come from?

RFC 2616 (HTTP)[1] does not directly reference RFC 2822 (Internet
Message Format), but that's the format that's being used -- covered in
section 3.3 [2]. That's where the format that begins with the day-of-week.

I'm surprised that Tomcat ever emits anything that looks like
yyyyMMddTHHmmssZZ -- that's ISO 8601 date formats. Since ISO 8601
predates HTTP, I'm not sure why that wasn't chosen. But HTTP has some
old crap that should have never been put into the protocol from day
one, so why not an insane date format specification?

- -chris

[1] http://tools.ietf.org/html/rfc2616#section-13.3.1
[2] http://tools.ietf.org/html/rfc2822#section-3.3
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlE+Qm4ACgkQ9CaO5/Lv0PBWZgCgtPmB6J8EVB6nZgOv57EmEvvX
ScsAniX9s6fDJNmHFAbbfDuDClo7T1X5
=VS3F
-----END PGP SIGNATURE-----


Attachment: users_240283.eml (zipped)
Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> To whom it may concern,
>
> On 3/11/13 11:17 AM, getridofthespam wrote:
>> Google didn't give any relevant info so I try here.
>>
>> I traced a tomcat request and noticed there where two different
>> date formats in the last-modified header: 2012-12-13T09:52:02Z and
>> Mon, 07 Jan 2013 21:49:08 GMT
>>
>> What determines the format and where do the differences come from?
>
> RFC 2616 (HTTP)[1] does not directly reference RFC 2822 (Internet
> Message Format), but that's the format that's being used -- covered in
> section 3.3 [2]. That's where the format that begins with the day-of-week.
>
> I'm surprised that Tomcat ever emits anything that looks like
> yyyyMMddTHHmmssZZ -- that's ISO 8601 date formats. Since ISO 8601
> predates HTTP, I'm not sure why that wasn't chosen. But HTTP has some
> old crap that should have never been put into the protocol from day
> one, so why not an insane date format specification?
>

Just by coincidence, I happened to be looking at some HTTP/DAV output right now (from
Apache's DAV), and I noticed this :
...
<D:getcontenttype>application/pdf</D:getcontenttype>
<lp1:creationdate>2012-12-21T09:25:53Z</lp1:creationdate>
<lp1:getlastmodified>Fri, 21 Dec 2012 09:25:53 GMT</lp1:getlastmodified>
<lp1:getcontentlength>1009325</lp1:getcontentlength>
<lp1:resourcetype/>
...

So there we have these 2 formats within a same HTTP response from the same module on the
same server and about the same file, both of which could obviously have used the same format.
Why make it simple when complicated will do ?





Attachment: users_240273.eml (zipped)
Greetings,

On Fri, Mar 8, 2013 at 8:38 PM, Jesse Farinacci <jieryn@(protected):
> I am using Java 7, IBM JRE and Apache Tomcat 7.0.37. I am seeing a
> strange difference between java.util.logging.SimpleFormatter vs
> org.apache.juli.OneLineFormatter: namely, for my applications, the
> SimpleFormatter will produce log records with the Class name included
> but OneLineFormatter will not. The exact same application, with only
> changes to the .formatter are enough to show this change.

Thank you everyone for some good comments. I did not attach a formal
debugger, but I was able to brute force narrow down where the problem
is occurring: org.apache.juli.AsyncFileHandler. If I swap out
org.apache.juli.AsyncFileHandler with org.apache.juli.FileHandler then
the org.apache.juli.OneLineFormatter works just perfectly.

Here is the working configuration:

handlers = 1catalina.org.apache.juli.FileHandler,
2localhost.org.apache.juli.FileHandler,
3manager.org.apache.juli.FileHandler
.handlers = 1catalina.org.apache.juli.FileHandler

1catalina.org.apache.juli.FileHandler.level = ALL
1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.FileHandler.prefix = catalina.
1catalina.org.apache.juli.FileHandler.formatter =
org.apache.juli.OneLineFormatter

2localhost.org.apache.juli.FileHandler.level = ALL
2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
2localhost.org.apache.juli.FileHandler.prefix = localhost.
2localhost.org.apache.juli.FileHandler.formatter =
org.apache.juli.OneLineFormatter

3manager.org.apache.juli.FileHandler.level = ALL
3manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
3manager.org.apache.juli.FileHandler.prefix = manager.
3manager.org.apache.juli.FileHandler.formatter =
org.apache.juli.OneLineFormatter

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = ALL
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers
= 2localhost.org.apache.juli.FileHandler
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level
= ALL
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers
= 3manager.org.apache.juli.FileHandler

A swap to AsyncFileHandler shows the problem. Most times I see
null.null for className and methodName, but sometimes the className is
filled in and the methodName is null. So, perhaps, under heavy load,
AsyncFileHandler doesn't behave predictably with respect to some
LogRecord fields.

-Jesse

--
There are 10 types of people in this world, those
that can read binary and those that can not.


Attachment: users_240279.eml (zipped)
Hi André,


-----Original-Nachricht-----
> Von: André Warnier <aw@(protected)>
> An: Tomcat Users List <users@(protected)>
> Betreff: Re: Console when running as a service.
> Datum: Mon, 11 Mar 2013 19:20:23 +0100


> +1. Eek, I tearfully and shamefully agree.
> But still 90% or more of corporate internal documents are written as
> Word documents, and there is no open-source tool which can perfectly
> handle this shamefully proprietary format and convert it to some
> non-propietary format that one could still read in 10 year's time, so
> what is one to do if one wants to get some money to get one's children
> through computer school and pay for their iPhones, he ?

I guess with "proprietary format" you mean the old/outdated .doc format? :)

This has been superseded (since 2006/2007) by the Office Open XML format which has been standardized as ECMA-376 and ISO/IEC 29500 [1], for which a public documentation is available, so I wouldn't call this proprietary. ;-)

However, you're probably right that a lot of already existing word documents are still in the old .doc format instead of .docx.


Regards,
Konstantin Preißer

[1] http://en.wikipedia.org/wiki/Office_Open_XML




Attachment: users_240282.eml (zipped)
verlag.preisser@(protected):
> Hi André,
>
>
> -----Original-Nachricht-----
>> Von: André Warnier <aw@(protected)>
>> An: Tomcat Users List <users@(protected)>
>> Betreff: Re: Console when running as a service.
>> Datum: Mon, 11 Mar 2013 19:20:23 +0100
>
>
>> +1. Eek, I tearfully and shamefully agree.
>> But still 90% or more of corporate internal documents are written as
>> Word documents, and there is no open-source tool which can perfectly
>> handle this shamefully proprietary format and convert it to some
>> non-propietary format that one could still read in 10 year's time, so
>> what is one to do if one wants to get some money to get one's children
>> through computer school and pay for their iPhones, he ?
>
> I guess with "proprietary format" you mean the old/outdated .doc format? :)
>
> This has been superseded (since 2006/2007) by the Office Open XML format which has been standardized as ECMA-376 and ISO/IEC 29500 [1], for which a public documentation is available, so I wouldn't call this proprietary. ;-)
>
> However, you're probably right that a lot of already existing word documents are still in the old .doc format instead of .docx.
>

This is still [OT], and I like the subject, so let's elaborate a bit.
The above paragraph responded to an "Eek", so it wasn't really meant as technically accurate.
But yes, by proprietary I did mean mainly the .doc, .xls and .ppt formats (and their
associated template formats). And yes, there are still plenty of those around.
For instance, we recently processed a customer archive of more than 100,000 documents, in
which there was a mixture of .doc, .xls, .ppt, .docx, .xlsx, .pptx, .pdf, .tiff, .txt and
a few more.
But even if one talks about the supposedly "open" OpenXML formats .docx, .xlsx and .pptx,
I have been unable so far to find any non-MS tool which can accurately process say more
than 95% of your average collection of such documents without introducing some significant
distorsions in the result, or corrupting or losing some content. So I have to suppose
that either of the following is true :
- the published specification is not accurate enough to cover all the cases one finds in
real-world OpenXML documents
- the programmers who read these specifications are incapable of creating software that
will accurately handle 100% of the documents which are created in this format
- the people who published this specification deliberately made it obscure so that others
would have trouble interpreting it correctly
- the people who published this specification are deliberately making software that
creates documents that violate the specification, to make life miserable for everyone
else, particularly their commercial and non-commercial competition
- the people who published this specification are unwillingly making software that creates
documents that violate the specification through sheer incompetence
- the people who published this specification are making software that creates documents
that violate the specification, because they just don't care and because they published
this specification only so that they could claim to support open-source trends and
non-proprietary standards
- the programmers who read this specification are unwilling to create software that will
accurately handle 100% of the documents which are created in this format, just to make a
point about the spirit of open-source and how bad the companies who make proprietary
software really are

..or more probably, a mixture of all the above.

And the practical result for everyone else it that it is a mess.

But I must add that I am not complaining about it too much, because if it wasn't so, I
would not have either a product or a job. So please, MS and others, keep on adding new
features, standards, revisions, versions, interpretations and new software which follows
them or not, and I will happily spend time cleaning it all up for my bewildered customers.
(And, with a wink but nonetheless a background of seriousness, I would hasard to guess
that the situation isn't too different when one reflects about Java and Tomcat).






Attachment: users_240284.eml (zipped)
I'm trying to create what I thought was a very simple WebSocket example, but boy have I had difficulties…

I started by basically coping the EchoAnnotation example from the Tomcat examples. However, it was like my endpoint was never getting instantiated. (Is this temporary? Will Tomcat 8 ultimately scan for and instantiate these endpoints? Or will the server container always have to be created manually?)

I then noticed the listener that the examples application was using to initialize the container and add the endpoints. I didn't want to tie my example to the Tomcat classes, so I tried to do it a bit more generically based on the WebSocket API. Below you will find the listener I created. It compiles just fine, but on deployment I get the very unusual error further down. What's up with this? Is this just an example of Tomcat being behind the RC1 API?

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import javax.websocket.server.ServerContainer;
import javax.websocket.server.ServerContainerProvider;

@WebListener
public class WebSocketInitializerListener implements ServletContextListener
{
  @Override
  public void contextInitialized(ServletContextEvent servletContextEvent)
  {
    try
    {
       ServerContainer container = ServerContainerProvider.getServerContainer();
       container.addEndpoint(EchoEndpoint.class);
    }
    catch (Exception e)
    {
       System.err.println(e.toString());
       e.printStackTrace(System.err);
       throw new RuntimeException("Could not start WebSocket container.");
    }
  }

  @Override
  public void contextDestroyed(ServletContextEvent servletContextEvent)
  {

  }
}

SEVERE: Exception sending context initialized event to listener instance of class com.wrox.WebSocketInitializerListener
java.lang.IllegalAccessError: tried to access method javax.websocket.server.ServerContainerProvider.getServerContainer()Ljavax/websocket/server/ServerContainer; from class com.wrox.WebSocketInitializerListener
 at com.wrox.WebSocketInitializerListener.contextInitialized(WebSocketInitializerListener.java:17)
 at org.apache.catalina.core.StandardContext.listenerStart (StandardContext.java:4769)
 at org.apache.catalina.core.StandardContext.startInternal (StandardContext.java:5210)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 at org.apache.catalina.core.ContainerBase.addChildInternal (ContainerBase.java:726)
 at org.apache.catalina.core.ContainerBase.addChild (ContainerBase.java:702)
 at org.apache.catalina.core.StandardHost.addChild (StandardHost.java:698)
 at org.apache.catalina.startup.HostConfig.manageApp (HostConfig.java:1492)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke (Method.java:487)
 at org.apache.tomcat.util.modeler.BaseModelMBean.invoke (BaseModelMBean.java:300)
 at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke (DefaultMBeanServerInterceptor.java:819)
 at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke (JmxMBeanServer.java:791)
 at org.apache.catalina.mbeans.MBeanFactory.createStandardContext (MBeanFactory.java:468)
 at org.apache.catalina.mbeans.MBeanFactory.createStandardContext (MBeanFactory.java:415)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke (Method.java:487)
 at org.apache.tomcat.util.modeler.BaseModelMBean.invoke (BaseModelMBean.java:300)
 at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke (DefaultMBeanServerInterceptor.java:819)
 at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke (JmxMBeanServer.java:791)
 at javax.management.remote.rmi.RMIConnectionImpl.doOperation (RMIConnectionImpl.java:1465)
 at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:75)
 at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1306)
 at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation (RMIConnectionImpl.java:1398)
 at javax.management.remote.rmi.RMIConnectionImpl.invoke (RMIConnectionImpl.java:827)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke (Method.java:487)
 at sun.rmi.server.UnicastServerRef.dispatch (UnicastServerRef.java:322)
 at sun.rmi.transport.Transport$1.run(Transport.java:177)
 at sun.rmi.transport.Transport$1.run(Transport.java:174)
 at java.security.AccessController.doPrivileged(Native Method)
 at sun.rmi.transport.Transport.serviceCall (Transport.java:173)
 at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)
 at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)
 at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)
 at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1110)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
 at java.lang.Thread.run (Thread.java:722)
©2008 junlu.com - Jax Systems, LLC, U.S.A.